-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
install: create destination file with safer modes before copy #6595
base: main
Are you sure you want to change the base?
Conversation
Could you please add a test to make sure we don't regress? Thanks |
11830cd
to
2eb2c4c
Compare
There was indeed a regression: when the I added a test to make sure that no file will be created when I'm not sure how to use a test case to check whether the new file is created in mode 0600, since the creation is in the middle of an internal function, but the strace output confirms so If you have any suggestions please let me know. Thanks! |
c9ded01
to
5b9c0c6
Compare
GNU testsuite comparison:
|
dbe383a
to
051539c
Compare
051539c
to
43cca95
Compare
GNU testsuite comparison:
|
43cca95
to
bdbef46
Compare
GNU testsuite comparison:
|
bdbef46
to
9fc58f9
Compare
Fix #6435.
As is suggested by the original issue, the creation of the destination file is delegated to
fs::copy
which creates the file with default mode0644
. This makes the file readable by other users before the finalchmod
is done, which is potentially unsafe and inconsistent with GNU install.Since the current implementation unconditionally removes the destination path before the copy, creating the file with a minimal
u=rw
permission would not hurt the copy. This patch implements this (for unix).