-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-10496: posixpath.expanduser() catchs pwd.getpwuid() error #10919
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
Conversation
* posixpath.expanduser() now returns the input path unchanged if the HOME environment variable is not set and pwd.getpwuid() raises KeyError (the current user identifier doesn't exist in the password database). * Add test_no_home_directory() to test_site.
I tested manually this change on my Fedora 29:
The site module doesn't fail anymore. Test to ensure that site fails without the fix:
Note: I had to re-clone CPython in /tmp since user 12345 is not allowed to access my $HOME directory. |
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.
LGTM. Just added few minor suggestion for tests.
@vstinner I can confirm that the patch works:
LGTM. |
* Add more tests to test_expanduser_home_envvar() * Fix typo: assertTrue => assertEqual * Use support.import_module()
@serhiy-storchaka, @izbyshev: Would you mind to review the updated PR? |
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.
LGTM, though I'm uncertain about unexpanded paths in sysconfig
(see https://bugs.python.org/issue10496#msg331115).
On Travis CI, the coverage job (gcc) failed with:
It should be fixed by my latest commit. |
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
GH-10924 is a backport of this pull request to the 3.7 branch. |
…GH-10919) * posixpath.expanduser() now returns the input path unchanged if the HOME environment variable is not set and pwd.getpwuid() raises KeyError (the current user identifier doesn't exist in the password database). * Add test_no_home_directory() to test_site. (cherry picked from commit f2f4555) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* posixpath.expanduser() now returns the input path unchanged if the HOME environment variable is not set and pwd.getpwuid() raises KeyError (the current user identifier doesn't exist in the password database). * Add test_no_home_directory() to test_site. (cherry picked from commit f2f4555) Co-authored-by: Victor Stinner <vstinner@redhat.com>
…) (GH-10925) * posixpath.expanduser() now returns the input path unchanged if the HOME environment variable is not set and pwd.getpwuid() raises KeyError (the current user identifier doesn't exist in the password database). * Add test_no_home_directory() to test_site. (cherry picked from commit f2f4555)
|
…) (GH-10930) * posixpath.expanduser() now returns the input path unchanged if the HOME environment variable is not set and pwd.getpwuid() raises KeyError (the current user identifier doesn't exist in the password database). * Add test_no_home_directory() to test_site. (cherry picked from commit f2f4555)
the HOME environment variable is not set and pwd.getpwuid() raises
KeyError (the current user identifier doesn't exist in the password
database).
https://bugs.python.org/issue10496