sh testsuite: create hush-redir/* and move files around
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/shell/hush_test/hush-misc/redir1.right b/shell/ash_test/ash-redir/redir1.right
similarity index 100%
copy from shell/hush_test/hush-misc/redir1.right
copy to shell/ash_test/ash-redir/redir1.right
diff --git a/shell/hush_test/hush-misc/redir1.tests b/shell/ash_test/ash-redir/redir1.tests
similarity index 100%
copy from shell/hush_test/hush-misc/redir1.tests
copy to shell/ash_test/ash-redir/redir1.tests
diff --git a/shell/hush_test/hush-misc/redir_script.right b/shell/ash_test/ash-redir/redir_script.right
similarity index 100%
copy from shell/hush_test/hush-misc/redir_script.right
copy to shell/ash_test/ash-redir/redir_script.right
diff --git a/shell/hush_test/hush-misc/redir_script.tests b/shell/ash_test/ash-redir/redir_script.tests
similarity index 100%
copy from shell/hush_test/hush-misc/redir_script.tests
copy to shell/ash_test/ash-redir/redir_script.tests
diff --git a/shell/hush_test/hush-parsing/redir_space.right b/shell/ash_test/ash-redir/redir_space.right
similarity index 100%
copy from shell/hush_test/hush-parsing/redir_space.right
copy to shell/ash_test/ash-redir/redir_space.right
diff --git a/shell/hush_test/hush-parsing/redir_space.tests b/shell/ash_test/ash-redir/redir_space.tests
similarity index 100%
copy from shell/hush_test/hush-parsing/redir_space.tests
copy to shell/ash_test/ash-redir/redir_space.tests
diff --git a/shell/hush_test/hush-misc/redir1.right b/shell/hush_test/hush-redir/redir1.right
similarity index 100%
rename from shell/hush_test/hush-misc/redir1.right
rename to shell/hush_test/hush-redir/redir1.right
diff --git a/shell/hush_test/hush-misc/redir1.tests b/shell/hush_test/hush-redir/redir1.tests
similarity index 100%
rename from shell/hush_test/hush-misc/redir1.tests
rename to shell/hush_test/hush-redir/redir1.tests
diff --git a/shell/hush_test/hush-misc/redir2.right b/shell/hush_test/hush-redir/redir2.right
similarity index 100%
rename from shell/hush_test/hush-misc/redir2.right
rename to shell/hush_test/hush-redir/redir2.right
diff --git a/shell/hush_test/hush-misc/redir2.tests b/shell/hush_test/hush-redir/redir2.tests
similarity index 100%
rename from shell/hush_test/hush-misc/redir2.tests
rename to shell/hush_test/hush-redir/redir2.tests
diff --git a/shell/hush_test/hush-misc/redir3.right b/shell/hush_test/hush-redir/redir3.right
similarity index 100%
rename from shell/hush_test/hush-misc/redir3.right
rename to shell/hush_test/hush-redir/redir3.right
diff --git a/shell/hush_test/hush-misc/redir3.tests b/shell/hush_test/hush-redir/redir3.tests
similarity index 100%
rename from shell/hush_test/hush-misc/redir3.tests
rename to shell/hush_test/hush-redir/redir3.tests
diff --git a/shell/hush_test/hush-misc/redir4.right b/shell/hush_test/hush-redir/redir4.right
similarity index 100%
rename from shell/hush_test/hush-misc/redir4.right
rename to shell/hush_test/hush-redir/redir4.right
diff --git a/shell/hush_test/hush-misc/redir4.tests b/shell/hush_test/hush-redir/redir4.tests
similarity index 100%
rename from shell/hush_test/hush-misc/redir4.tests
rename to shell/hush_test/hush-redir/redir4.tests
diff --git a/shell/hush_test/hush-misc/redir5.right b/shell/hush_test/hush-redir/redir5.right
similarity index 100%
rename from shell/hush_test/hush-misc/redir5.right
rename to shell/hush_test/hush-redir/redir5.right
diff --git a/shell/hush_test/hush-misc/redir5.tests b/shell/hush_test/hush-redir/redir5.tests
similarity index 100%
rename from shell/hush_test/hush-misc/redir5.tests
rename to shell/hush_test/hush-redir/redir5.tests
diff --git a/shell/hush_test/hush-misc/redir6.right b/shell/hush_test/hush-redir/redir6.right
similarity index 100%
rename from shell/hush_test/hush-misc/redir6.right
rename to shell/hush_test/hush-redir/redir6.right
diff --git a/shell/hush_test/hush-misc/redir6.tests b/shell/hush_test/hush-redir/redir6.tests
similarity index 100%
rename from shell/hush_test/hush-misc/redir6.tests
rename to shell/hush_test/hush-redir/redir6.tests
diff --git a/shell/hush_test/hush-redir/redir7.right b/shell/hush_test/hush-redir/redir7.right
new file mode 100644
index 0000000..6430b02
--- /dev/null
+++ b/shell/hush_test/hush-redir/redir7.right
@@ -0,0 +1,3 @@
+Ok
+Ok
+Done
diff --git a/shell/hush_test/hush-redir/redir7.tests b/shell/hush_test/hush-redir/redir7.tests
new file mode 100755
index 0000000..e873a46
--- /dev/null
+++ b/shell/hush_test/hush-redir/redir7.tests
@@ -0,0 +1,12 @@
+# Chars above 0x7f are used as special codes.
+# 0x81 is CTLESC (see ash.c).
+# The bug was that quoting and unquoting of them
+# was out of sync for redirect filenames.
+
+>unicode.sh
+printf 'echo Ok >uni\x81code\n' >>unicode.sh
+printf 'cat uni\x81code\n' >>unicode.sh
+printf 'cat uni?code\n' >>unicode.sh
+. ./unicode.sh
+rm uni*code*
+echo Done
diff --git a/shell/hush_test/hush-redir/redir8.right b/shell/hush_test/hush-redir/redir8.right
new file mode 100644
index 0000000..6430b02
--- /dev/null
+++ b/shell/hush_test/hush-redir/redir8.right
@@ -0,0 +1,3 @@
+Ok
+Ok
+Done
diff --git a/shell/hush_test/hush-redir/redir8.tests b/shell/hush_test/hush-redir/redir8.tests
new file mode 100755
index 0000000..2bd3867
--- /dev/null
+++ b/shell/hush_test/hush-redir/redir8.tests
@@ -0,0 +1,15 @@
+# Chars above 0x7f are used as special codes.
+# 0x81 is CTLESC (see ash.c).
+# The bug was that quoting and unquoting of them
+# was out of sync for redirect filenames.
+
+# Subcase when redirect filename is specified in a variable.
+
+>unicode.sh
+printf 'v=uni\x81code\n' >>unicode.sh
+printf 'echo Ok >"$v"\n' >>unicode.sh
+printf 'cat uni\x81code\n' >>unicode.sh
+printf 'cat uni?code\n' >>unicode.sh
+. ./unicode.sh
+rm uni*code*
+echo Done
diff --git a/shell/hush_test/hush-redir/redir9.right b/shell/hush_test/hush-redir/redir9.right
new file mode 100644
index 0000000..34c2512
--- /dev/null
+++ b/shell/hush_test/hush-redir/redir9.right
@@ -0,0 +1,2 @@
+Ok
+Done:0
diff --git a/shell/hush_test/hush-redir/redir9.tests b/shell/hush_test/hush-redir/redir9.tests
new file mode 100755
index 0000000..8befa61
--- /dev/null
+++ b/shell/hush_test/hush-redir/redir9.tests
@@ -0,0 +1,4 @@
+echo Ok >file.tmp
+cat 0<>file.tmp
+echo Done:$?
+rm file.tmp
diff --git a/shell/hush_test/hush-redir/redirA.right b/shell/hush_test/hush-redir/redirA.right
new file mode 100644
index 0000000..31406e3
--- /dev/null
+++ b/shell/hush_test/hush-redir/redirA.right
@@ -0,0 +1,2 @@
+tmp11
+tmp11
diff --git a/shell/hush_test/hush-redir/redirA.tests b/shell/hush_test/hush-redir/redirA.tests
new file mode 100755
index 0000000..56833f9
--- /dev/null
+++ b/shell/hush_test/hush-redir/redirA.tests
@@ -0,0 +1,11 @@
+x="tmp11:tmp22"
+
+# Bug was incorrectly expanding variables in >redir
+echo "${x%:*}" >"${x%:*}"
+echo tmp1*
+rm tmp1*
+
+# Also try unquoted
+echo "${x%:*}" >${x%:*}
+echo tmp1*
+rm tmp1*
diff --git a/shell/hush_test/hush-misc/redir_script.right b/shell/hush_test/hush-redir/redir_script.right
similarity index 100%
rename from shell/hush_test/hush-misc/redir_script.right
rename to shell/hush_test/hush-redir/redir_script.right
diff --git a/shell/hush_test/hush-misc/redir_script.tests b/shell/hush_test/hush-redir/redir_script.tests
similarity index 100%
rename from shell/hush_test/hush-misc/redir_script.tests
rename to shell/hush_test/hush-redir/redir_script.tests
diff --git a/shell/hush_test/hush-parsing/redir_space.right b/shell/hush_test/hush-redir/redir_space.right
similarity index 100%
rename from shell/hush_test/hush-parsing/redir_space.right
rename to shell/hush_test/hush-redir/redir_space.right
diff --git a/shell/hush_test/hush-parsing/redir_space.tests b/shell/hush_test/hush-redir/redir_space.tests
similarity index 100%
rename from shell/hush_test/hush-parsing/redir_space.tests
rename to shell/hush_test/hush-redir/redir_space.tests