hush: fix handling of \" in quoted/unquoted `cmd`

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
diff --git a/shell/hush_test/hush-misc/heredoc_backslash1.right b/shell/hush_test/hush-misc/heredoc_backslash1.right
index 2633908..6a61148 100644
--- a/shell/hush_test/hush-misc/heredoc_backslash1.right
+++ b/shell/hush_test/hush-misc/heredoc_backslash1.right
@@ -5,6 +5,8 @@
 	b
  123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
 	-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
+ 123456 `echo  v'-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-'`
+ 123456 $(echo v'-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-')
 c\
 
 Unquoted heredoc:
@@ -13,6 +15,8 @@
 	b
  123456 -qwerty-\t-\-\"-\'-`-\--\z-\*-\?-
 	-qwerty-\t-\-\"-\'-`-\--\z-\*-\?-
+ 123456 v-$a-\t-\-\"-\x-`-\--\z-\*-\?-
+ 123456 v-$a-\t-\\-\"-\x-\`-\--\z-\*-\?-
 cEOF2
 
 Quoted -heredoc:
@@ -22,6 +26,8 @@
 b
  123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
+ 123456 `echo  v'-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-'`
+ 123456 $(echo v'-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-')
 c\
 
 Unquoted -heredoc:
@@ -30,6 +36,8 @@
 b
  123456 -qwerty-\t-\-\"-\'-`-\--\z-\*-\?-
 -qwerty-\t-\-\"-\'-`-\--\z-\*-\?-
+ 123456 v-$a-\t-\-\"-\x-`-\--\z-\*-\?-
+ 123456 v-$a-\t-\\-\"-\x-\`-\--\z-\*-\?-
 cEOF4
 
 Done: 0
diff --git a/shell/hush_test/hush-misc/heredoc_backslash1.tests b/shell/hush_test/hush-misc/heredoc_backslash1.tests
index 22045d4..501af54 100755
--- a/shell/hush_test/hush-misc/heredoc_backslash1.tests
+++ b/shell/hush_test/hush-misc/heredoc_backslash1.tests
@@ -11,6 +11,8 @@
 	b
  123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
 	-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
+ 123456 `echo  v'-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-'`
+ 123456 $(echo v'-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-')
 c\
 EOF1
 echo
@@ -23,6 +25,8 @@
 	b
  123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
 	-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
+ 123456 `echo  v'-$a-\t-\\-\"-\x-\`-\--\z-\*-\?-'`
+ 123456 $(echo v'-$a-\t-\\-\"-\x-\`-\--\z-\*-\?-')
 c\
 EOF2
 EOF2
@@ -36,6 +40,8 @@
 	b
  123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
 	-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
+ 123456 `echo  v'-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-'`
+ 123456 $(echo v'-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-')
 c\
 	EOF3
 # In -heredoc case the marker is detected even if it is indented.
@@ -49,6 +55,8 @@
 	b
  123456 -$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
 	-$a-\t-\\-\"-\'-\`-\--\z-\*-\?-
+ 123456 `echo  v'-$a-\t-\\-\"-\x-\`-\--\z-\*-\?-'`
+ 123456 $(echo v'-$a-\t-\\-\"-\x-\`-\--\z-\*-\?-')
 c\
 EOF4
 	EOF4
diff --git a/shell/hush_test/hush-psubst/tick3.right b/shell/hush_test/hush-psubst/tick3.right
index dc84e92..00f267a 100644
--- a/shell/hush_test/hush-psubst/tick3.right
+++ b/shell/hush_test/hush-psubst/tick3.right
@@ -2,5 +2,5 @@
 $TEST
 Q
 a\bc
-a"c
+11-$a-\t-\-\"-`-\--\z-\*-\?-22 33-$a-\t-\-"-`-\--\z-\*-\?-44
 done:0
diff --git a/shell/hush_test/hush-psubst/tick3.tests b/shell/hush_test/hush-psubst/tick3.tests
index 469c43c..3aeb241 100755
--- a/shell/hush_test/hush-psubst/tick3.tests
+++ b/shell/hush_test/hush-psubst/tick3.tests
@@ -7,6 +7,8 @@
 echo `echo \\$TEST`
 echo `echo \$TEST`
 echo a`echo \\\\b`c
-# \" etc are NOT special (passed verbatim WITH \)!
-echo a`echo \"`c
+
+# \" is not special if in unquoted `cmd` (passed verbatim WITH \),
+# but is special in quoted one
+echo `echo 11'-$a-\t-\\-\"-\`-\--\z-\*-\?-'22` "`echo 33'-$a-\t-\\-\"-\`-\--\z-\*-\?-'44`"
 echo done:$?