Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Filesystem] check permissions if dump target dir is missing#24105
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
| if (!@chdir(dirname($dir))) { | ||
| // The target directory may exists, but we are unable to make a decision as we lack proper permissions | ||
| // to enter its parent directory. | ||
| thrownewIOException(sprintf('Unable to detect if the target directory %s exists.',$dir)); |
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.
%s should be quoted with".
| $oldCwd =getcwd(); | ||
| if (!@chdir(dirname($dir))) { | ||
| // The target directory may exists, but we are unable to make a decision as we lack proper permissions |
javiereguiluzSep 6, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
may exists ->may exist
And maybe you could add this important information in the PHP comment (you only added in the PR description):
is_dir() returns false if the parent directory misses the executablebit even when the directory itself is present.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.
Better this way?
`is_dir()` returns `false` if the parent directory misses the executablebit even when the directory itself is present.
fabpot commentedSep 7, 2017
Thank you@xabbuh. |
…ng (xabbuh)This PR was merged into the 2.7 branch.Discussion----------[Filesystem] check permissions if dump target dir is missing| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#24097| License | MIT| Doc PR |`is_dir()` returns `false` if the parent directory misses the executablebit even when the directory itself is present.Commits-------a0f9f2c check permissions if dump target dir is missing
robfrawley commentedSep 8, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@xabbuh@fabpot This completely breaks I don't believe we're using the method incorrectly; we're passing the method a path (some of which point to paths that already exists and others that don't, sometimes with multiple levels of not-yet-created directories) along with its contents. For test failures, see thisrecent Travis build. You can also clone the Are we doing something wrong? Or did this change break things it should not have? I'll take a closer look shortly... |
xabbuh commentedSep 8, 2017
@robfrawley Thanks for stepping up here. I think you are right and this change was not completely right. I'll check if we can fix it easily. Otherwise I suggest we revert this PR as the improved error reporting is not worth it if it breaks functionality. |
robfrawley commentedSep 8, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
My issue is definitely that 535a536> $exists = $dir;537c538,542< if (!@chdir(dirname($exists))) {---> do {> $exists = dirname($exists);> } while (!empty($exists) && !is_dir($exists));>> if (!empty($exists) && !@chdir(dirname($exists))) { A straight removal of the 535,544d534< $oldCwd = getcwd();<< if (!@chdir(dirname($exists))) {< // When the parent directory misses the executable permission bit, we are unable to enter it and thus< // cannot check if the target directory exists.< throw new IOException(sprintf('Unable to detect if the target directory "%s" exists.', $dir));< }<< chdir($oldCwd);< |
robfrawley commentedSep 9, 2017
@xabbuh@fabpot Can we please revert this PR in the immediate until another solution is found? Aworking The bugfix release For now: please revert. |
fabpot commentedSep 9, 2017
@robfrawley reverted |
* 2.7: Revert "bug#24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)" [Filesystem] skip tests if not applicable [Fabbot] Do not run php-cs-fixer if there are no change in src/ [Security] Fix exception when use_referer option is true and referer is not set or empty Get KERNEL_DIR through $_ENV too for KernelTestCase check permissions if dump target dir is missing
robfrawley commentedSep 9, 2017
Wonderful; thanks for the quick response! |
* 2.8: Revert "bug#24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)" [Filesystem] skip tests if not applicable [Fabbot] Do not run php-cs-fixer if there are no change in src/ [Security] Fix exception when use_referer option is true and referer is not set or empty Get KERNEL_DIR through $_ENV too for KernelTestCase check permissions if dump target dir is missing
* 3.3: Revert "bug#24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)" [Filesystem] skip tests if not applicable [Fabbot] Do not run php-cs-fixer if there are no change in src/ [Security] Fix exception when use_referer option is true and referer is not set or empty [HttpKernel] "controller.service_arguments" services should be public Get KERNEL_DIR through $_ENV too for KernelTestCase Get KERNEL_CLASS through $_ENV too check permissions if dump target dir is missing
* 3.4: [SecurityBundle] Fix valid provider considered undefined Revert "bug#24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)" [Filesystem] skip tests if not applicable [Fabbot] Do not run php-cs-fixer if there are no change in src/ [ExpressionLanguage] make a proposal in SyntaxError message [Security] Fix exception when use_referer option is true and referer is not set or empty [HttpKernel] "controller.service_arguments" services should be public Get KERNEL_DIR through $_ENV too for KernelTestCase Get KERNEL_CLASS through $_ENV too check permissions if dump target dir is missing
xabbuh commentedSep 11, 2017
@fabpot thanks 👍 @robfrawley I have some code locally that would probably fix the issue that you experienced. Though I don't think it's worth it as the error we tried to detect here is an extreme edge case IMO. However, we have#24134 which may provide some other improved error handling. Would you mind testing that PR with your code base? |
is_dir()returnsfalseif the parent directory misses the executablebit even when the directory itself is present.