GeezerVison is showing github.com — GH-118447: Fix handling of unreadable symlinks in `os.path.realpath()` by barneygale · Pull Request #118489 · python/cpython
Conversation
barneygale
commented
May 1, 2024
•
edited by bedevere-app
Bot
Loading
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.
barneygale
changed the title
GH-118447: Handle unreadable symlinks in os.path.realpath()
GH-118447: Fix handling of unreadable symlinks in os.path.realpath()
May 1, 2024
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
If not resolving unreadable symlinks is acceptable, you still need to raise an error for link/...
realpath() shouldn't raise OSError in non-strict mode.
|
nineteendo reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, you're right, it shouldn't raise an error. That's what strict is for.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I think that it is reasonable to expect that realpath('dir/badlink/rest') returns the same result when badlink does not exist, is a file, is in non-readable directory or is non-readable itself, for any rest. It's error prone, but that's how it was defined.
|
nineteendo reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Barney, would you like to continue working on this? You have my approval if it means anything.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
barneygale reacted with thumbs up emoji
|
Thanks for the reviews and suggestions, both!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @barneygale for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Sorry, @barneygale, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker caf6064a1bc15ac344afd78b780188e60b9c628e 3.12
|
Sorry, something went wrong.
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.
|
If no one objects, I'll skip backporting to 3.12 as this is a fairly minor bug and I can't be bothered to fix the conflicts :)
|
hugovk reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot AMD64 FreeBSD 3.x has failed when building commit caf6064.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1223/builds/3134) and take a look at the build logs.
- Check if the failure is related to this commit (caf6064) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/all/#builders/1223/builds/3134
Failed tests:
Failed subtests:
- test_realpath_unreadable_symlink - test.test_posixpath.PosixPathTest.test_realpath_unreadable_symlink
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/buildbot/buildarea/3.x.ware-freebsd/build/Lib/test/test_posixpath.py", line 670, in test_realpath_unreadable_symlink
self.assertEqual(realpath(ABSTFN), ABSTFN)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '/bui[19 chars].ware-freebsd/build/build/test_python_57143æ/@test_57143_tmpæ1' != '/bui[19 chars].ware-freebsd/build/build/test_python_57143æ/@test_57143_tmpæ'
- /buildbot/buildarea/3.x.ware-freebsd/build/build/test_python_57143æ/@test_57143_tmpæ1
? -
+ /buildbot/buildarea/3.x.ware-freebsd/build/build/test_python_57143æ/@test_57143_tmpæ
Traceback (most recent call last):
File "/buildbot/buildarea/3.x.ware-freebsd/build/Lib/test/test_posixpath.py", line 670, in test_realpath_unreadable_symlink
self.assertEqual(realpath(ABSTFN), ABSTFN)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '/bui[19 chars].ware-freebsd/build/build/test_python_66351æ/@test_66351_tmpæ1' != '/bui[19 chars].ware-freebsd/build/build/test_python_66351æ/@test_66351_tmpæ'
- /buildbot/buildarea/3.x.ware-freebsd/build/build/test_python_66351æ/@test_66351_tmpæ1
? -
+ /buildbot/buildarea/3.x.ware-freebsd/build/build/test_python_66351æ/@test_66351_tmpæ
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot AMD64 FreeBSD14 3.x has failed when building commit caf6064.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1232/builds/2352) and take a look at the build logs.
- Check if the failure is related to this commit (caf6064) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/all/#builders/1232/builds/2352
Failed tests:
Failed subtests:
- test_realpath_unreadable_symlink - test.test_posixpath.PosixPathTest.test_realpath_unreadable_symlink
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/test/test_posixpath.py", line 670, in test_realpath_unreadable_symlink
self.assertEqual(realpath(ABSTFN), ABSTFN)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '/hom[24 chars].opsec-fbsd14/build/build/test_python_79925æ/@test_79925_tmpæ1' != '/hom[24 chars].opsec-fbsd14/build/build/test_python_79925æ/@test_79925_tmpæ'
- /home/buildbot/buildarea/3.x.opsec-fbsd14/build/build/test_python_79925æ/@test_79925_tmpæ1
? -
+ /home/buildbot/buildarea/3.x.opsec-fbsd14/build/build/test_python_79925æ/@test_79925_tmpæ
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.opsec-fbsd14/build/Lib/test/test_posixpath.py", line 670, in test_realpath_unreadable_symlink
self.assertEqual(realpath(ABSTFN), ABSTFN)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '/hom[24 chars].opsec-fbsd14/build/build/test_python_75684æ/@test_75684_tmpæ1' != '/hom[24 chars].opsec-fbsd14/build/build/test_python_75684æ/@test_75684_tmpæ'
- /home/buildbot/buildarea/3.x.opsec-fbsd14/build/build/test_python_75684æ/@test_75684_tmpæ1
? -
+ /home/buildbot/buildarea/3.x.opsec-fbsd14/build/build/test_python_75684æ/@test_75684_tmpæ
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot AMD64 FreeBSD 3.13 has failed when building commit 7407267.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1491/builds/46) and take a look at the build logs.
- Check if the failure is related to this commit (7407267) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/all/#builders/1491/builds/46
Failed tests:
Failed subtests:
- test_realpath_unreadable_symlink - test.test_posixpath.PosixPathTest.test_realpath_unreadable_symlink
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/buildbot/buildarea/3.13.ware-freebsd/build/Lib/test/test_posixpath.py", line 670, in test_realpath_unreadable_symlink
self.assertEqual(realpath(ABSTFN), ABSTFN)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '/bui[20 chars].ware-freebsd/build/build/test_python_84680æ/@test_84680_tmpæ1' != '/bui[20 chars].ware-freebsd/build/build/test_python_84680æ/@test_84680_tmpæ'
- /buildbot/buildarea/3.13.ware-freebsd/build/build/test_python_84680æ/@test_84680_tmpæ1
? -
+ /buildbot/buildarea/3.13.ware-freebsd/build/build/test_python_84680æ/@test_84680_tmpæ
Traceback (most recent call last):
File "/buildbot/buildarea/3.13.ware-freebsd/build/Lib/test/test_posixpath.py", line 670, in test_realpath_unreadable_symlink
self.assertEqual(realpath(ABSTFN), ABSTFN)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '/bui[20 chars].ware-freebsd/build/build/test_python_77930æ/@test_77930_tmpæ1' != '/bui[20 chars].ware-freebsd/build/build/test_python_77930æ/@test_77930_tmpæ'
- /buildbot/buildarea/3.13.ware-freebsd/build/build/test_python_77930æ/@test_77930_tmpæ1
? -
+ /buildbot/buildarea/3.13.ware-freebsd/build/build/test_python_77930æ/@test_77930_tmpæ
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot AMD64 FreeBSD14 3.13 has failed when building commit 7407267.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1481/builds/45) and take a look at the build logs.
- Check if the failure is related to this commit (7407267) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/all/#builders/1481/builds/45
Failed tests:
Failed subtests:
- test_realpath_unreadable_symlink - test.test_posixpath.PosixPathTest.test_realpath_unreadable_symlink
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.13.opsec-fbsd14/build/Lib/test/test_posixpath.py", line 670, in test_realpath_unreadable_symlink
self.assertEqual(realpath(ABSTFN), ABSTFN)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '/hom[25 chars].opsec-fbsd14/build/build/test_python_95351æ/@test_95351_tmpæ1' != '/hom[25 chars].opsec-fbsd14/build/build/test_python_95351æ/@test_95351_tmpæ'
- /home/buildbot/buildarea/3.13.opsec-fbsd14/build/build/test_python_95351æ/@test_95351_tmpæ1
? -
+ /home/buildbot/buildarea/3.13.opsec-fbsd14/build/build/test_python_95351æ/@test_95351_tmpæ
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.13.opsec-fbsd14/build/Lib/test/test_posixpath.py", line 670, in test_realpath_unreadable_symlink
self.assertEqual(realpath(ABSTFN), ABSTFN)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '/hom[25 chars].opsec-fbsd14/build/build/test_python_94029æ/@test_94029_tmpæ1' != '/hom[25 chars].opsec-fbsd14/build/build/test_python_94029æ/@test_94029_tmpæ'
- /home/buildbot/buildarea/3.13.opsec-fbsd14/build/build/test_python_94029æ/@test_94029_tmpæ1
? -
+ /home/buildbot/buildarea/3.13.opsec-fbsd14/build/build/test_python_94029æ/@test_94029_tmpæ
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|