Skip to content

Conversation

@hroncok
Copy link
Contributor

@hroncok hroncok commented Dec 9, 2025

The order of filenames provided by os.walk is filesystem-dependent.

Different filesystems return the files in a different order, hence invalidating the digest.
Keeping everything sorted makes the digest deterministic.

Fixes #142454

…e files in Tools/jit

The order of filenames provided by os.walk is filesystem-dependent.

Different filesystems return the files in a different order,
hence invalidating the digest.
Keeping everything sorted makes the digest deterministic.

Fixes python#142454
…4.cqUxzQ.rst

Co-authored-by: Ken Jin <kenjin4096@gmail.com>
Copy link
Contributor

@diegorusso diegorusso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change makes sense, LGTM. Thanks a lot!

Copy link
Member

@savannahostrowski savannahostrowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change makes sense but it sounded like you only started seeing this issue in 3.15.0a2 in the issue. @hroncok Can you confirm that this worked as expected in 3.15.0a1?

@diegorusso
Copy link
Contributor

I guess this needs to be back ported to 3.14 as well (as specified in the original issue)

@savannahostrowski
Copy link
Member

Ah, I missed that and was confused by the wording "we have found out that the digest in JIT stencils in 3.15.0a2 differs." Sounded like this was a new issue. The reason I was asking is because I think this bug existing from the very beginning, in 3.13 as well. I bisected and this appears to have always been the case.

@savannahostrowski savannahostrowski added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Dec 9, 2025
@hroncok
Copy link
Contributor Author

hroncok commented Dec 9, 2025

Indeed, this is not new in 3.15.0a2. Sorry for the confusing wording. 3.15.0a2 only happens to be the first version we have attempted to build in this build system while asserting the prebuilt stencils match the just built ones. This bug appears to have existed from the very beginning of the _compute_digest function.

@savannahostrowski savannahostrowski enabled auto-merge (squash) December 9, 2025 17:05
@savannahostrowski
Copy link
Member

Thanks for catching this issue and opening the fix, @hroncok!

@savannahostrowski savannahostrowski merged commit bcf90de into python:main Dec 9, 2025
72 checks passed
@miss-islington-app
Copy link

Thanks @hroncok for the PR, and @savannahostrowski for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @hroncok and @savannahostrowski, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker bcf90de8ba2ea087540a5f632656ef880ee46b5c 3.14

@miss-islington-app
Copy link

Sorry, @hroncok and @savannahostrowski, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker bcf90de8ba2ea087540a5f632656ef880ee46b5c 3.13

@hroncok
Copy link
Contributor Author

hroncok commented Dec 9, 2025

Should I open a backport PR?

@savannahostrowski
Copy link
Member

If you'd like to do it, feel free. Otherwise, I'm happy to handle it!

@hroncok
Copy link
Contributor Author

hroncok commented Dec 9, 2025

I am happy to do it but the conflict is because of #138131, which seems safe to backport as well. WDYT?

@savannahostrowski
Copy link
Member

savannahostrowski commented Dec 9, 2025

I think so. I'm kind of surprised that wasn't backported originally, given that the original bug report was for 3.14. I think we could also backport that fix first and then retrigger the backport for this PR, if we want clearer separation of concerns.

@hroncok
Copy link
Contributor Author

hroncok commented Dec 9, 2025

I don't have the right to request backports via the labels, but if done in order, it should no longer conflict.

@hroncok hroncok deleted the sort-jit-tools branch December 9, 2025 17:53
@savannahostrowski savannahostrowski added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes and removed needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Dec 9, 2025
@miss-islington-app
Copy link

Thanks @hroncok for the PR, and @savannahostrowski for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @hroncok for the PR, and @savannahostrowski for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 9, 2025
…e files in Tools/jit (pythonGH-142455)

(cherry picked from commit bcf90de)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 9, 2025
…e files in Tools/jit (pythonGH-142455)

(cherry picked from commit bcf90de)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Dec 9, 2025

GH-142484 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Dec 9, 2025
@bedevere-app
Copy link

bedevere-app bot commented Dec 9, 2025

GH-142485 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Dec 9, 2025
@hroncok
Copy link
Contributor Author

hroncok commented Dec 9, 2025

Thanks.

savannahostrowski pushed a commit that referenced this pull request Dec 9, 2025
…he files in Tools/jit (GH-142455) (#142484)

gh-142454: Make the JIT digest more deterministic by sorting the files in Tools/jit (GH-142455)
(cherry picked from commit bcf90de)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
savannahostrowski pushed a commit that referenced this pull request Dec 9, 2025
…he files in Tools/jit (GH-142455) (#142485)

gh-142454: Make the JIT digest more deterministic by sorting the files in Tools/jit (GH-142455)
(cherry picked from commit bcf90de)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT digest differs based on filesystem order

4 participants