Skip to content

[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

Closed
wants to merge 1 commit into from

Conversation

xabbuh
Copy link
Member

@xabbuh 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)) {
Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member

@nicolas-grekas nicolas-grekas Jul 3, 2017

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.

@xabbuh xabbuh changed the title [Filesystem] do not read file perms from remote streams [Filesystem] silence fileperms() issues on remote filesystems Jul 3, 2017
@@ -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));
Copy link
Member

@nicolas-grekas nicolas-grekas Jul 3, 2017

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)));

Copy link
Member Author

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?

Copy link
Member

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?

@nicolas-grekas
Copy link
Member

wait, the original issue is buggy! things are already silenced, that's a "SilencedErrorContext"

@xabbuh xabbuh closed this Jul 3, 2017
@xabbuh xabbuh deleted the issue-23312 branch July 3, 2017 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants