-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Filesystem] silence fileperms() issues on remote filesystems #23340
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
Conversation
xabbuh
commented
Jun 30, 2017
Q | A |
---|---|
Branch? | 2.7 |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #23312 |
License | MIT |
Doc PR |
@@ -69,7 +69,9 @@ public function copy($originFile, $targetFile, $overwriteNewerFiles = false) | |||
} | |||
|
|||
// Like `cp`, preserve executable permission bits | |||
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111)); | |||
if (stream_is_local($originFile)) { |
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.
I just wonder if there are other resource types we need to consider too
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.
I was reading about the stream_is_local()
function and I saw this user comment: http://php.net/manual/en/function.stream-is-local.php#121126 Should we take that into account?
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.
TL;DR @javiereguiluz's point: stream_is_local()
return false for file://
paths, but chmod()
works on them. So yes, we should have a case for them.
@@ -69,7 +69,7 @@ public function copy($originFile, $targetFile, $overwriteNewerFiles = false) | |||
} | |||
|
|||
// Like `cp`, preserve executable permission bits | |||
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111)); | |||
@chmod($targetFile, fileperms($targetFile) | (@fileperms($originFile) & 0111)); |
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.
shouldn't the first "fileperms" also be silenced?
would that work?
@(chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111)));
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.
Shouldn't we always be able to get the perms of the newly written file?
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.
can't the new file be remote, thus have the same issue?
wait, the original issue is buggy! things are already silenced, that's a "SilencedErrorContext" |