[Python-Dev] os.path.exists() / os.path.isdir() inconsistency when dealing with gvfs directories
Oleg Broytman
phd at phdru.name
Wed Jun 27 09:32:52 CEST 2012
On Wed, Jun 27, 2012 at 01:49:34AM +0200, Giampaolo Rodol? <g.rodola at gmail.com> wrote:
> I've just noticed a strange behavior when dealing with gvfs filesystems:
>
> giampaolo at ubuntu:~$ python -c "import os;
> print(os.path.exists('/home/giampaolo/.gvfs'))"
> True
> giampaolo at ubuntu:~$ sudo su
> root at ubuntu:~# python -c "import os;
> print(os.path.exists('/home/giampaolo/.gvfs'))"
> False
>
> This is due to os.stat() which internally fails with PermissionError (EACCES).
BTW, the same is true for FUSE when an FS has been mounted without
something like "-o allow_other" or "-o allow_root":
root at nb # ls /home/phd/mnt/net
ls: cannot access /home/phd/mnt/net: Permission denied
Oleg.
--
Oleg Broytman http://phdru.name/ phd at phdru.name
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-Dev
mailing list