[Python-Dev] os.path.exists() / os.path.isdir() inconsistency when dealing with gvfs directories

Christian Heimes lists at cheimes.de
Wed Jun 27 14:56:39 CEST 2012


Am 27.06.2012 01:49, schrieb Giampaolo Rodolà:
> 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

The issue isn't isolated to GVFS. It's more the current user doesn't
have the exec persmission on the directory entry /home/giampaolo. On
most systems the home directories have either 0700 or 0750.

A user needs the 'x' bit enter or traverse through a directory
(mnemonic: exec -> enter), the 'r' bit to read the content of a
directory (e.g. listdir) and the 'w' bit to write (create or delete
files unless the sticky bit is set).

Christian



More information about the Python-Dev mailing list