-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
file copy may not always chmod permissions #15510
base: master
Are you sure you want to change the base?
Conversation
the remote volume may allow copy but not changes to file permissions after writing
This is a breaking change: we document that src permissions will be set on dst. Silencing the error means that they may or may not be set and you won't know about it. |
Yeah, I don't think swallowing errors is an option. Usually you would want to know if things break at this point. This is a use-case specific issue, and I'm not sure if there could be a general solution. An application-specific implementation where you explicitly specify that you only want to copy the data and not the permissions might be the only reasonable way to handle this. It would be interesting to look how other file copy tools (the equivalent in other programing languages, but also programs like |
@straight-shoota Both |
Can we add an optional And what about the flush call above? |
@HertzDevil yes, though "preserve" means more than just mode. For example
And |
ruby has a preserve option that applies the chmod as well as timestamps etc https://github.com/ruby/ruby/blob/master/lib/fileutils.rb#L1077-L1082
|
Enhancing the API could be a great improvement, let's continue that discussion #15518.
Lines 847 to 858 in 62c92a0
The code comment explains that we only apply the permissions after writing the content to prevent write restrictions from applied permissions. But that's unnecessary. Changing the permissions on disk does not have any effect on existing file descriptors. The OS only checks permissions when opening a file. Combine that with telling
|
@straight-shoota I'm not sure this stands: by the time we call |
Of course it depends on what exactly doesn't work in this specific setup. |
the remote volume may allow copy but not changes to file permissions after writing
as is the case with azure cloud storage volumes attached to docker containers