-
Notifications
You must be signed in to change notification settings - Fork 87
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
Wrong temporary directory created following a reset via fs.os
#965
Comments
Thanks, that's a good point! As far as I can see, the default is 0o666 for regular files and 0x777 for directories, with the umask applied for files (but not always), and not applied for directories. This should not have a big impact (I hope), as most tests don't work with different users / groups. The temp directory creation has to be fixed of course. |
Though I'll probably fix the temp dir problem only (and any other problems you encounter) for now, as the other changes may be a bit more complicated. Always applying the umask as I just tried breaks a few tests both in the fake and the real fs, so this is also not correct. I have to read up on permission handling first... |
@vector-of-bool - as before: shall be fixed in main, please check! |
Thanks for the quick turnaround! Looks to be mostly fixed. I am hitting some issues with |
Describe the bug
The
/tmp
created by_create_temp_dir
may be invalid following modification offs.os
._create_temp_dir
consultstempfile.gettempdir()
to find the default directory for temporary files. After theos
module has been patched, thetempfile
module attempts to probe the filesystem using the mock filesystem. Because the filesystem is reset by writingfs.os
,tempfile
fails to create probe files in the non-existent test directories, andgettempdir()
returns root/
as a fallback. The_create_temp_dir
function will then create a symlink of/tmp -> /
.Background: By default,
pyfakefs
creates directories with mode0o777
, which is not a realistic mode for most directories, and especially not/
. To test directory permissions, I applyos.chown('/', 0, 0); os.chmod('/', 0o755)
to create a more "realistic" root directory that rejects writes.With the merge of #961, the symlink of
/tmp -> /
becomes problematic after marking/
to be non-writable for non-root users, astempfile
assumes that the temporary directory has mode0o777
.How To Reproduce
Your environment
Please run the following in the environment where the problem happened and
paste the output.
The text was updated successfully, but these errors were encountered: