-
-
Notifications
You must be signed in to change notification settings - Fork 780
respect umask for files / dirs (1.2) #6403
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
respect umask for files / dirs (1.2) #6403
Conversation
this feels a bit dirty considering that it undoes some efforts of chmod'ing it while it has the temp name at least avoids concurrent (and potentially even different) chmods onto the same filename. |
…up#6400 we tried to be very private / secure here, but that created the issue that a less secure umask (like e.g. 0o007) just did not work. to make the umask work, we must start from 0o777 mode and let the umask do its work, like e.g. 0o777 & ~0o007 --> 0o770. with borg's default umask of 0o077, it usually ends up being 0o700, so only permissions for the user (not group, not others).
7a9ae85
to
f5a47d8
Compare
^^^ @enkore @textshell please review. |
def ensure_dir(path, mode=stat.S_IRWXU, pretty_deadly=True): | ||
def ensure_dir(path, mode=stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO, pretty_deadly=True): |
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.
btw, borg never calls this with the mode
parameter, so the default value is always used.
permissions to the leaf directory | ||
permissions to the leaf directory. The current umask value is masked out first. |
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.
^^^ from the os.makedirs
docs.
not giving a non-default mode to ensure_dir
makes the leaf directory creation consistent with the potential parent directory creation: it just uses 0o777 & ~ umask
everywhere (as usual).
No description provided.