Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commita3c6cca
committed
bug#43665 [Console] Fix backslash escaping in bash completion (GromNaN)
This PR was squashed before being merged into the 5.4 branch.Discussion----------[Console] Fix backslash escaping in bash completion| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |#43664| License | MIT| Doc PR | -Fully tested code with#43598- `printf` options `%b` and `%q` are handy to escape string using in shell input.- Backslashes must to be escaped (doubled) in normal input (`bin/console debug:form App\\Form\\CommentType`). Otherwise they are dropped when PHP receive the argument (`App\Form\CommentType` become `AppFormCommentType` in `$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 `\` using `printf '%b'`.- Completion does not process escaping. If `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.- I choose to detect when quotes are typed to allow them in completion and add quotes to suggestions.- Suggestion with spaces are still not properly working.https://user-images.githubusercontent.com/400034/138536102-e282ee75-56c8-414b-8b16-7c3c290276d7.movCommits-------e9e0c07 [Console] Fix backslash escaping in bash completionFile tree
5 files changed
+56
-20
lines changed- src/Symfony/Component/Console
- Command
- Completion/Output
- Resources
- Tests
- Command
- Completion
5 files changed
+56
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| |||
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 161 | + | |
163 | 162 | | |
164 | 163 | | |
165 | 164 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 28 | + | |
31 | 29 | | |
32 | 30 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
20 | 35 | | |
21 | 36 | | |
22 | 37 | | |
23 | 38 | | |
24 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
25 | 64 | | |
26 | 65 | | |
27 | 66 | | |
| |||
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
| 106 | + | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
0 commit comments
Comments
(0)