You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
syntax: converting a backtick command substitution with escaped characters leaves too many backslashes #1041
shfmt 3.7.0 incorrectly escapes backslashes in the following example:
### input
x=`echo "1.2" | sed -e 's/\./\\\\./g'`
echo $x # prints out 1\.2
### actual output
x=$(echo "1.2" | sed -e 's/\./\\\\./g')
echo $x # prints out 1\\.2
### expected output
x=$(echo "1.2" | sed -e 's/\./\\./g')
echo $x # prints out 1\.2
changed the title [-]backslahes may be incorrectly escaped when converting to $(...) notation[/-][+]backslashes may be incorrectly escaped when converting to $(...) notation[/+]on Oct 26, 2023
changed the title [-]backslashes may be incorrectly escaped when converting to $(...) notation[/-][+]syntax: converting a backtick command substitution with escaped characters leaves too many backslashes[/+]on Nov 12, 2023
Activity
[-]backslahes may be incorrectly escaped when converting to $(...) notation[/-][+]backslashes may be incorrectly escaped when converting to $(...) notation[/+]Fix incorrect conversion in rpz system test
mvdan commentedon Nov 12, 2023
Thanks - this sounds like a bug. We probably never noticed given that it's a relatively rare edge case. Happy to review a PR with a test.
[-]backslashes may be incorrectly escaped when converting to $(...) notation[/-][+]syntax: converting a backtick command substitution with escaped characters leaves too many backslashes[/+]syntax: backquotes affect backslashes in single quotes too