This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Matt Wozniski
Recipients Matt Wozniski, thierry.parmentelat
Date 2020-03-06.20:00:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583524835.18.0.230178099237.issue38894@roundup.psfhosted.org>
In-reply-to
Content
A simple test case for this issue:

~>mkdir tmp
~>cd tmp
tmp>touch 1.txt
tmp>ln -s subdir/file 2.txt
tmp>touch 3.txt
tmp>ls -l
total 0
-rw-rw-r-- 1 mwoznisk general  0 Mar  6 14:52 1.txt
lrwxrwxrwx 1 mwoznisk general 11 Mar  6 14:52 2.txt -> subdir/file
-rw-rw-r-- 1 mwoznisk general  0 Mar  6 14:52 3.txt
tmp>python3.8 -c "import pathlib; print(list(pathlib.Path('.').glob('*')))"
[PosixPath('1.txt'), PosixPath('2.txt'), PosixPath('3.txt')]
tmp>mkdir subdir
tmp>python3.8 -c "import pathlib; print(list(pathlib.Path('.').glob('*')))"
[PosixPath('1.txt'), PosixPath('2.txt'), PosixPath('3.txt'), PosixPath('subdir')]

So far so good, but if the subdirectory isn't readable, things fall apart:

tmp>chmod 000 subdir
tmp>python3.8 -c "import pathlib; print(list(pathlib.Path('.').glob('*')))"
[PosixPath('1.txt')]

Looks like this is caused by entry.is_dir() in pathlib._WildcardSelector raising a PermissionError when trying to check if a symlink pointing into an unreadable directory is or isn't a directory.  EACCESS isn't in IGNORED_ERROS (sic) and so the loop over directory entries is broken out of, and the "except PermissionError:" block in _select_from swallows the exception so that the failure is silent.
History
Date User Action Args
2020-03-06 20:00:35Matt Wozniskisetrecipients: + Matt Wozniski, thierry.parmentelat
2020-03-06 20:00:35Matt Wozniskisetmessageid: <1583524835.18.0.230178099237.issue38894@roundup.psfhosted.org>
2020-03-06 20:00:35Matt Wozniskilinkissue38894 messages
2020-03-06 20:00:35Matt Wozniskicreate