-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
Sequential Backslashes are removed during interpretation. #1106
Comments
Thanks for reporting, this does seem like a bug. Out of curiosity, how did you find this? Are you using the interpreter via the Go API? |
Yup. Using the interp Go API for some shell scripts with gnarly arguments including some regexps. Some of the regexps were off after going through my program and after debugging, I managed to localize the issue to the library as above. |
Further investigation seems to indicate this is a problem specific to double quoted literals. |
I'll prep a PR after lunch. Changing to the below seems to fix it and still pass all the test cases I could think of as relevant.
|
Got side tracked by some other issues Friday afternoon. PR to fix the backslash issue: #1107 |
Sequential Backslashes seem to be reduced to a single backslash. Is there a purposeful reason behind this or am I correct in believing this to be a bug?
Example:
gosh -c 'echo "hello \\\\\\ world"'
yieldshello \ world
Running the same thing in bash:
bash -c 'echo "hello \\\\\\ world"'
yieldshello \\\ world
matching my expectations.In code:
I believe this is an issue in the interp as running a
syntax.DebugPrint
onprog
yields:The text was updated successfully, but these errors were encountered: