Skip to content
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

[Process] A command containing slashes instead of backslashes should be quoted on Windows #22549

Closed
maryo opened this issue Apr 27, 2017 · 2 comments

Comments

@maryo
Copy link
Contributor

maryo commented Apr 27, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 3.3

On Windows it is possible to use / directory separator instead of \ to run a command inside CLI. But to be able to run such a command the path needs to be quoted.

I am using SF 3.3 now but I guess this commit caused the BC break which is merged to many versions.
3779f3f#diff-bfb5d7f8e7485d053a135b3692e8a0ca

Thus also the example in this test is not correct. It would not work on Windows.
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php#L94

D:\Program Files>php\php -r "echo 'hello';"
hello
D:\Program Files>php/php -r "echo 'hello';"
Could not open input file: /php

D:\Program Files>"php/php" -r "echo 'hello';"
hello
D:\Program Files>
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Apr 27, 2017

Can you provide a reproducer test that we could add to the test suite?
The linked commit is applicable to non-Windiws OSes so that's really strange that you found it to have introduced the issue...

@maryo
Copy link
Contributor Author

maryo commented Apr 27, 2017

@nicolas-grekas You're right. I missed the last return inside the Windows condition and the ProcessUtils::escapeArgument is actually not used anymore since SF 3.3. That's the problem. OK, I'll send a PR in few minutes.

fabpot added a commit that referenced this issue Apr 29, 2017
…indows (maryo)

This PR was squashed before being merged into the 3.3-dev branch (closes #22551).

Discussion
----------

[Process] Ecaping of CLI arguments containing slashes on Windows

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22549
| License       | MIT

Actually only the first argument - the command needs to be escaped but that would need another condition. I think it should be OK.

Commits
-------

0d07312 [Process] Ecaping of CLI arguments containing slashes on Windows
@fabpot fabpot closed this as completed Apr 29, 2017
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

5 participants