Visitar URL original
realpath has a race condition which might cause it to throw spurious exceptions · Issue #97566 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20220929142930/https://github.com/python/cpython/issues/97566
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

realpath has a race condition which might cause it to throw spurious exceptions #97566

Open
bitonic opened this issue Sep 26, 2022 · 0 comments
Labels
3.9 type-bug An unexpected behavior, bug, or error

Comments

@bitonic
Copy link

bitonic commented Sep 26, 2022

Bug report

realpath tests if a file is a symlink using islink, which just returns False if the file does not exist. But then uses readlink a bit later to test the source of the link, which throws an exception if the file does not exists. If the file is a symlink and is deleted between islink and readlink, we get a spurious exception.

This reproduces the error using code copy-pasted from Python 3.9: https://gist.github.com/bitonic/e0977aaa674523a9ffe0e77a96cd6cc7 .

Your environment

  • CPython 3.9
  • ArchLinux x86_64
@bitonic bitonic added the type-bug An unexpected behavior, bug, or error label Sep 26, 2022
@mdboom mdboom added the 3.9 label Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.9 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants