Thanks to visit codestin.com
Credit goes to github.com

Skip to content

symfony/process throws error when trying to unlink temp file on windows since 3.0.8 #19416

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
fernandobandeira opened this issue Jul 24, 2016 · 4 comments

Comments

@fernandobandeira
Copy link

fernandobandeira commented Jul 24, 2016

This occurs when i try to composer update a laravel project:

  [ErrorException]
  unlink(C:\Users\ferna\AppData\Local\Temp\sf_proc_00.out): Permission denied

Script php artisan optimize handling the post-update-cmd event returned with error code 1

Downgrading to 3.0.7 fix this issue.

Results from debugging:
This issue is caused since this change #19118 and may be related to issue #19336

Thrown in the line 62 of src/Symfony/Component/Process/Pipes/WindowsPipes.php

if (file_exists($file) && !@unlink($file))

The PHP function is_writtable returns true to both $file and $tmpDir.
Removing the @ from the calls gives no extra infos.
Also var_dump(error_get_last()); returns null.
The file exists and it is deleted after the error (the error kill the proccess though) so it may be an issue with another process using the file at the same time?

Using Windows 10 x64 php 7.0.6 composer .

Previously added this as a comment on that issue but it seems a different issue.
Didn't break anything on the projects that i've tested so far so it probably doesn't have a big impact apart from the scary message.

If there's any info's that are required i can provide it.

@nicolas-grekas
Copy link
Member

This error shoudn't happen: the call to unlink is prefixed by the silencing operator. It looks like your error handler is broken...

@nicolas-grekas
Copy link
Member

Anyway, could you please try #19427?

@fernandobandeira
Copy link
Author

fernandobandeira commented Jul 26, 2016

Tried and now at least the error isn't a fatal one, it actually proceeds the execution of the code.

I am running this with xdebug enabled, with it disabled after this PR the errors disappears, before this PR even with xdebug disabled the fatal error is thrown, even after i tried a fresh php.exe 7.0.9

With xdebug enabled now it throws the following stacktrace

PHP Warning:  unlink(C:\Users\ferna\AppData\Local\Temp\sf_proc_00.out): Permission denied in C:\Users\ferna\Code\CodeProject\vendor\symfony\process\Pipes\WindowsPipes.php on line 59
PHP Stack trace:
PHP   1. {main}() C:\Users\ferna\Code\CodeProject\artisan:0
PHP   2. Illuminate\Foundation\Console\Kernel->handle() C:\Users\ferna\Code\CodeProject\artisan:35
PHP   3. Symfony\Component\Console\Application->run() C:\Users\ferna\Code\CodeProject\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:107
PHP   4. Symfony\Component\Console\Application->doRun() C:\Users\ferna\Code\CodeProject\vendor\symfony\console\Application.php:117
PHP   5. Symfony\Component\Console\Application->doRunCommand() C:\Users\ferna\Code\CodeProject\vendor\symfony\console\Application.php:186
PHP   6. Illuminate\Console\Command->run() C:\Users\ferna\Code\CodeProject\vendor\symfony\console\Application.php:791
PHP   7. Symfony\Component\Console\Command\Command->run() C:\Users\ferna\Code\CodeProject\vendor\laravel\framework\src\Illuminate\Console\Command.php:155
PHP   8. Illuminate\Console\Command->execute() C:\Users\ferna\Code\CodeProject\vendor\symfony\console\Command\Command.php:256
PHP   9. Illuminate\Container\Container->call() C:\Users\ferna\Code\CodeProject\vendor\laravel\framework\src\Illuminate\Console\Command.php:169
PHP  10. call_user_func_array:{C:\Users\ferna\Code\CodeProject\vendor\laravel\framework\src\Illuminate\Container\Container.php:507}() C:\Users\ferna\Code\CodeProject\vendor\laravel\framework\src\Illuminate\Container\Container.php:507
PHP  11. Illuminate\Foundation\Console\OptimizeCommand->fire() C:\Users\ferna\Code\CodeProject\vendor\laravel\framework\src\Illuminate\Container\Container.php:507
PHP  12. Illuminate\Support\Composer->dumpOptimized() C:\Users\ferna\Code\CodeProject\vendor\laravel\framework\src\Illuminate\Foundation\Console\OptimizeCommand.php:59
PHP  13. Illuminate\Support\Composer->dumpAutoloads() C:\Users\ferna\Code\CodeProject\vendor\laravel\framework\src\Illuminate\Support\Composer.php:61
PHP  14. Symfony\Component\Process\Process->run() C:\Users\ferna\Code\CodeProject\vendor\laravel\framework\src\Illuminate\Support\Composer.php:51
PHP  15. Symfony\Component\Process\Process->start() C:\Users\ferna\Code\CodeProject\vendor\symfony\process\Process.php:201
PHP  16. Symfony\Component\Process\Process->getDescriptors() C:\Users\ferna\Code\CodeProject\vendor\symfony\process\Process.php:263
PHP  17. Symfony\Component\Process\Pipes\WindowsPipes::create() C:\Users\ferna\Code\CodeProject\vendor\symfony\process\Process.php:1190
PHP  18. Symfony\Component\Process\Pipes\WindowsPipes->__construct() C:\Users\ferna\Code\CodeProject\vendor\symfony\process\Pipes\WindowsPipes.php:186
PHP  19. unlink() C:\Users\ferna\Code\CodeProject\vendor\symfony\process\Pipes\WindowsPipes.php:59

At least now it isn't a fatal error anymore just a warning so no problems.

@nicolas-grekas
Copy link
Member

You must have xdebug.scream enabled in your php.ini, isn't it? Then you should disable it, this is only a debugging option that can't be compatible with normal runtime behavior of any php apps.

nicolas-grekas added a commit that referenced this issue Jul 28, 2016
…olas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Process] Fix write access check for pipes on Windows

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19336, #19416
| License       | MIT
| Doc PR        | -

Commits
-------

66e694e [Process] Fix write access check for pipes on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants