Set file permissions when the archive is created from STDIN#5437
Set file permissions when the archive is created from STDIN#5437schors wants to merge 0 commit intoborgbackup:masterfrom schors:master
Conversation
|
Thanks for the PR. Yes, please fix the pep8 issues. You can ignore #5438, that has nothing to do with your changes and needs to be addressed separately. |
|
And please clean up the commits, there should be no "merge" in a PR and also we need good/clear commit comments that are suitable to create a changelog entry from. You can (carefully!) do that with |
ThomasWaldmann
left a comment
There was a problem hiding this comment.
looks pretty good! a few minor nitpicks which i have found...
src/borg/constants.py
Outdated
| UMASK_DEFAULT = 0o077 | ||
|
|
||
| # default file mode to store stdin data, defaults to read/write for owner and group | ||
| # forsing to 0o100XXX later |
There was a problem hiding this comment.
typo: "forcing" (also fix that globally, please)
src/borg/archiver.py
Outdated
| subparser.add_argument('--stdin-user', metavar='USER', dest='stdin_user', default=uid2user(0), | ||
| help='set user USER in archive for stdin data (default: %(default)r)') | ||
| subparser.add_argument('--stdin-group', metavar='GROUP', dest='stdin_group', default=gid2group(0), | ||
| help='set group GROUP in archive for stdin data (default: %(default)r)') | ||
| subparser.add_argument('--stdin-mode', metavar='M', dest='stdin_mode', type=lambda s: int(s, 8), default=STDIN_MODE_DEFAULT, | ||
| help='set mode to M in archive for stdin data (default: %(default)04o)') |
There was a problem hiding this comment.
cool, that's pretty much how i would have solved it! :-)
src/borg/archive.py
Outdated
| mode=0o100660, # regular file, ug=rw | ||
| uid=uid, user=uid2user(uid), | ||
| gid=gid, group=gid2group(gid), | ||
| mode=mode&0o107777|0o100000, # forsing regular file mode |
There was a problem hiding this comment.
if you set the regular file bit anyway (via "or"), guess you do not need to have it in the "and" mask.
|
@schors did you see my feedback? |
|
@ThomasWaldmann yes, I did. I am very busy at the moment. I have any free time only on weekends. I'm going to do something related this issue tomorrow. |
Codecov Report
@@ Coverage Diff @@
## master #5437 +/- ##
==========================================
- Coverage 83.69% 83.60% -0.10%
==========================================
Files 37 37
Lines 9957 9973 +16
Branches 1656 1659 +3
==========================================
+ Hits 8334 8338 +4
- Misses 1140 1149 +9
- Partials 483 486 +3
Continue to review full report at Codecov.
|
--stdin-mode,--stdin-userand--stdin-groupaddedFile mode forces to regular file with other values from the option
--stdin-mode. Default mode is 0o100660.Error if given user or group do not exists. Default user and group values are taken from system uid/gid 0