Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Console] Fix backslash escaping in bash completion#43665
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
Uh oh!
There was an error while loading.Please reload this page.
This comment has been minimized.
This comment has been minimized.
wouterj commentedOct 23, 2021
sorry, I've hidden my comment. The PR changed a lot from what I looked at yesterday night. I'll have to look again before sharing my opinion |
Uh oh!
There was an error while loading.Please reload this page.
GromNaN commentedOct 24, 2021
I'm rewriting this solution to use more native bash and less PHP. Mainly to remove dependency of the input in BashOutput. |
GromNaN commentedOct 25, 2021
@wouterj I'm done with something more bash-native. The only limitation is with some values that are not unescaped: the token It would be awesome if we find a way to add tests to the bash script (unit or functional). |
4befcb8 tob914980Comparestof commentedOct 25, 2021
I agree with that, but I have no idea how. |
wouterj commentedOct 28, 2021 • 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.
Hi! I just tested it and I think this is perfect now you support both ways! I have 2 suggestions after quickly testing this:
|
fabpot commentedOct 29, 2021
@GromNaN Do you have time to have a look at Wouter's comments? I'd love to be able to merge this one to unlock some other PRs. Thank you. |
wouterj commentedOct 29, 2021
Imho, we can also merge this one and fix both of them between beta1 and rc1. The feature is complete - it's just some minor polishing. |
GromNaN commentedOct 29, 2021
I'm going to make the requested changes tonight. |
GromNaN commentedOct 29, 2021
By default, completion of a FQCN will contain only a single quote, since namespaces are different. Not a big deal. |
b914980 to56a74edCompare5d29751 to7220038Compare7220038 toe9e0c07Comparefabpot commentedOct 30, 2021
Thank you@GromNaN. |
This PR was merged into the 5.4 branch.Discussion----------[Console] [AppVeyor] Fix EOL in the tests| Q | A| ------------- | ---| Branch? | 5.4 <!-- see below -->| Bug fix? | yes| New feature? | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| License | MIT[Probably caused by this fix](#43665)AppVeyor run tests on Windows and tests with EOL [failing](https://ci.appveyor.com/project/fabpot/symfony/builds/41346183#L1559)`@derrabus` pls reviewCommits-------d4a9e6e [Console][AppVeyor] Fix EOL in the tests
This PR was merged into the 6.4 branch.Discussion----------[Console] Fix handling of `\E` in Bash completion| Q | A| ------------- | ---| Branch? | 6.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Issues | -| License | MITRelated to#43665The problem with `$(printf -- '%b' "$w")` is that it also interprets `\E` as an escape sequence.For example, in```bashbin/console debug:form 'Symfony\Component\Form\Extension\Core\Type\EmailType'```the `\E` in the class name is replaced with the ASCII escape character:```Symfony\Component\Form�xtension\Core\Type�mailType```This PR switches to simply replacing double backslashes with a single one instead of using `printf -- '%b'`.Commits-------f1f50e6 [Console] Fix handling of `\E` in Bash completion
Uh oh!
There was an error while loading.Please reload this page.
Fully tested code with#43598
printfoptions%band%qare handy to escape string using in shell input.bin/console debug:form App\\Form\\CommentType). Otherwise they are dropped when PHP receive the argument (App\Form\CommentTypebecomeAppFormCommentTypein$SERVER['argv']). This is not necessary for quoted arguments (bin/console debug:form "App\Form\CommentType"is OK). In the context of a command stored in a variable, like in the bash script, escaping is not interpreted: we must replace\\by\usingprintf '%b'.App\\Form\\is typed, the suggestions must contain a\\to match. Since these values are provided to shell, double backslash must be escaped:\becomes\\\\in suggestion output.screen-autocomplete-backslash.mov