sh testsuite: create hush-redir/* and move files around

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2016-10-02 17:55:51 +02:00
parent 1b73f8471a
commit c4cf542c57
30 changed files with 143 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
Ok
Ok
Done

View File

@@ -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

View File

@@ -0,0 +1,3 @@
Ok
Ok
Done

View File

@@ -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

View File

@@ -0,0 +1,2 @@
Ok
Done:0

View File

@@ -0,0 +1,4 @@
echo Ok >file.tmp
cat 0<>file.tmp
echo Done:$?
rm file.tmp

View File

@@ -0,0 +1,2 @@
tmp11
tmp11

View File

@@ -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*