Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
bug #14246 [Filesystem] dumpFile() negates default file permissions#17063
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
Apply the mode change after writing to the file, the umask may remove the write permission.
linaori commentedDec 30, 2015
If I understand it correctly, there has been a deprecation added in 2.8 which was never merged into 3.0 and the code was never fixed properly there. If you take a look at thehistory of Filesystem.php:
This means that the only case where no permissions would be set, would be by passing When you take a look at the3.0 Filesystem.php, you can see that the permissions are not longer fixed. The only non-deprecated way, which is setting it /cc@xabbuh |
xabbuh commentedDec 30, 2015
@iltar I think your reasoning is correct and we need to always set the permissions as proposed here. By the way, the solution before Symfony 3.0 was not really atomic, was it? I mean the |
hboomsma commentedDec 30, 2015
@iltar, this is indeed the case. Code that ran in 2.8 without any deprication message stops working in 3.0 because the |
hboomsma commentedDec 30, 2015
xabbuh commentedDec 30, 2015
@hboomsma Would you like to create a pull request for older Symfony versions that swaps the order of the calls? |
hboomsma commentedDec 30, 2015
@xabbuh sure, which versions should we patch? I'll create a pull request for 2.8 right away. |
xabbuh commentedDec 30, 2015
Hm, I think we will get other issues when merging this on filesystems that don't allow to change permissions (see#8205). |
hboomsma commentedDec 30, 2015
@xabbuh you are right, I'll fix it in the same way, it was fixed in the mentioned issue, because if As for the request for 2.8 do you have an open issue for me to mention in the PR? |
xabbuh commentedDec 30, 2015
@hboomsma I think you can refer to the same issue (it's also talking about the (not)-atomic behaviour). |
hboomsma commentedDec 30, 2015
linaori commentedDec 30, 2015
Looks like the failure is unrelated to the changes in this PR. |
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.
Why is this done twice? And what does$tempFile refer to?
hboomsma commentedJan 4, 2016
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.
Takingumask() into account here looks like a new feature to me.
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.
@xabbuh, I agree you could see it that way, lets not take the umask into account and create a separate pull request for it.
hboomsma commentedJan 4, 2016
@xabbuh updated PR to not take the umask 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.
Unit-test can be simplified now, no need to set the umask anymore.
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 want to explicitly show that the umask does not influence the resulting access permissions.
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.
If we wanted to improve the tests this way, we should do that on the2.3 branch imo.
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 agree, removed the extra tests, because I will create a separate pull request for enhancing the test and taking the umask into account for 2.3.
hboomsma commentedJan 6, 2016
@xabbuh updated pr to not enhance the unit tests, I will create a separate PR for taking the umask into account with the extra tests for 2.3 after this PR is finished. |
xabbuh commentedJan 7, 2016
👍 Status: Reviewed |
fabpot commentedJan 7, 2016
Thank you@hboomsma. |
…rmissions (Hidde Boomsma)This PR was merged into the 3.0 branch.Discussion----------bug#14246 [Filesystem] dumpFile() negates default file permissions| Q | A| ------------- | ---| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#14246| License | MIT| Doc PR | noneRemain BC compatible with Symfony 2.8.Without this change a chmod is needed after calling `dumpFile`, making it non atomic.Commits-------53d6d4b bug#14246 [Filesystem] dumpFile() negates default file permissions
…e (leofeyer)This PR was merged into the 3.1 branch.Discussion----------[Filesystem] Consider the umask setting when dumping a file| Q | A| ------------- | ---| Branch? | 3.1| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#14246 ,#17063| License | MIT| Doc PR | -`Filesystem::dumpFile()` does not consider the umask setting and thus creates files with write permissions for everyone (`0666`). Other `chmod()` calls in Symfony do consider the umask setting (see e.g. [here](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/File/File.php#L101) or [here](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/File/UploadedFile.php#L230)), therefore I have adjusted the `dumpFile()` method accordingly.Commits-------fdd266f Consider the umask setting when dumping a file.
Remain BC compatible with Symfony 2.8.
Without this change a chmod is needed after calling
dumpFile, making it non atomic.