| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This reduces the attack surface -- readable files avoid the race condition.
Co-authored-by: Stan Ulbrych <stan@python.org>
Documentation build overview18 files changed · ± 18 modified ± Modified |
Sorry, something went wrong.
|
I'm not sure why Emscripten failed in this run on test_cleanup_with_symlink_race: ======================================================================
FAIL: test_cleanup_with_symlink_race (test.test_tempfile.TestTemporaryDirectory.test_cleanup_with_symlink_race)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/runner/work/cpython/cpython/Lib/test/test_tempfile.py", line 1907, in test_cleanup_with_symlink_race
self.assertTrue(os.path.exists(target_file))
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False is not true
The test swaps a directory for a symlink to the outside directory mid-recovery, however the unlink followed the symlink and deleted it. This is odd because the unlink was passed a dir_fd for the directory that got swapped out. However, it doesn’t hit our skip (so the platform meets the requirements, which means os.unlink is indeed in os.supports_dir_fd). CC @hoodmane any idea what's going on here? |
Sorry, something went wrong.
|
Will take a look. |
Sorry, something went wrong.
|
Meanwhile let's start buildbots for all the other architectures/configurations |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @encukou for commit a837624 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F157580%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
|
And it seems all the buildbots older with masOS <26 (and iOS) are failing on test_cleanup_with_symlink_race with: ======================================================================
ERROR: test_cleanup_with_symlink_race (test.test_tempfile.TestTemporaryDirectory.test_cleanup_with_symlink_race)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/buildbot/buildarea/pull_request.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/test_tempfile.py", line 1904, in test_cleanup_with_symlink_race
os.chmod(dir1, 0o700)
~~~~~~~~^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/test_python_lxxiashb/3w36qc28/dir1'
We don't know if the test passes or not, as we don't reach the final assertions. I'm also not quite sure why this happens, and I don't have access to a machine to debug. It's possible that the hook's rename of the 0o500 directory fails? Any ideas Petr? |
Sorry, something went wrong.
|
Funny story
I can reproduce! .... on an ancient Intel MacBook that bought it in this state to take macOS screenshots for tutorials. It lasts ~10 min on battery and has a broken screen. It also has only has 1 USB port, so I can charge it, or connect a monitor/LAN, but not both at once. (This was never a problem for screenshots...) So, work is slow. But, in the end, after several tries, I did manage to find a compatible dongle. Turns out that on old macOS, you can't rename a directory if you don't have write permissions on that directory. (On Linux and -- apparently -- new macs, you need write on the containing directory; that has the inode you're manipulating.) The rmtree will:
Back in the test, in the finally:
|
Sorry, something went wrong.
|
Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
Sorry, something went wrong.
|
Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
|
Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
Sorry, something went wrong.
|
Sorry, @StanFromIreland and @encukou, I could not cleanly backport this to 3.12 due to a conflict. cherry_picker 5c20517a4fc56683efe63a7751020db9573f538d 3.12 |
Sorry, something went wrong.
|
Sorry, @StanFromIreland and @encukou, I could not cleanly backport this to 3.11 due to a conflict. cherry_picker 5c20517a4fc56683efe63a7751020db9573f538d 3.11 |
Sorry, something went wrong.
|
Sorry, @StanFromIreland and @encukou, I could not cleanly backport this to 3.10 due to a conflict. cherry_picker 5c20517a4fc56683efe63a7751020db9573f538d 3.10 |
Sorry, something went wrong.
|
GH-158429 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
|
GH-158430 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
|
GH-158431 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
|
GH-158489 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
…raryDirectory (GH-157580) (#158489) * gh-157579: Fix race condition in the cleanup of `tempfile.TemporaryDirectory` (GH-157580) (cherry picked from commit 5c20517) * Add root user checks to test.support This partially backports commit 86b8617 (GH-146195); making existing tests use the helper is omitted. * gh-134993: Add os.lstat() to os.supports_dir_fd (#135188) Co-authored-by: Stan Ulbrych <stan@python.org> Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Petr Viktorin <encukou@gmail.com>
…1527) Grype matches CVE-2026-12345 (TemporaryDirectory cleanup race, medium) against the python 3.14.8 binary in the base image and lists a fix only in 3.15.0. The fix is merged on main and 3.15 (python/cpython#157580, #158431); the 3.14 backport (python/cpython#158430) is still open. Refs #1412 Signed-off-by: Jürgen Kreileder <jk@blackdown.de>
…oraryDirectory` (GH-157580) (GH-158430) * gh-157579: Fix race condition in the cleanup of `tempfile.TemporaryDirectory` (GH-157580) (cherry picked from commit 5c20517) * Add root user checks to test.support This partially backports commit 86b8617 (GH-146195); making existing tests use the helper is omitted. --------- Co-authored-by: Stan Ulbrych <stan@python.org> Co-authored-by: Petr Viktorin <encukou@gmail.com>
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.