diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-24 19:46:38 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-24 19:46:38 +0000 |
commit | 5a867317bb1cbf36d396d9cdb552212607dcc2b1 (patch) | |
tree | e8c01f8c4f8242694db730eed60a3616e86f3a48 /shell/ash_test | |
parent | 6fbb43bc3c14fc30030cae77db51c322bece30ab (diff) | |
download | busybox-w32-5a867317bb1cbf36d396d9cdb552212607dcc2b1.tar.gz busybox-w32-5a867317bb1cbf36d396d9cdb552212607dcc2b1.tar.bz2 busybox-w32-5a867317bb1cbf36d396d9cdb552212607dcc2b1.zip |
ash: fix a bug where redirection fds were not closed afterwards.
optimize close+fcntl(DUPFD) into dup2. add testsuites.
function old new delta
copyfd 47 68 +21
argstr 1311 1298 -13
popredir 148 131 -17
redirect 1139 1107 -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 21/-62) Total: -41 bytes
Diffstat (limited to 'shell/ash_test')
-rw-r--r-- | shell/ash_test/ash-redir/redir2.right | 1 | ||||
-rwxr-xr-x | shell/ash_test/ash-redir/redir2.tests | 5 | ||||
-rw-r--r-- | shell/ash_test/ash-redir/redir3.right | 3 | ||||
-rwxr-xr-x | shell/ash_test/ash-redir/redir3.tests | 5 | ||||
-rwxr-xr-x | shell/ash_test/run-all | 4 |
5 files changed, 16 insertions, 2 deletions
diff --git a/shell/ash_test/ash-redir/redir2.right b/shell/ash_test/ash-redir/redir2.right new file mode 100644 index 000000000..d86bac9de --- /dev/null +++ b/shell/ash_test/ash-redir/redir2.right | |||
@@ -0,0 +1 @@ | |||
OK | |||
diff --git a/shell/ash_test/ash-redir/redir2.tests b/shell/ash_test/ash-redir/redir2.tests new file mode 100755 index 000000000..61ccea30c --- /dev/null +++ b/shell/ash_test/ash-redir/redir2.tests | |||
@@ -0,0 +1,5 @@ | |||
1 | # ash once couldn't redirect above fd#9 | ||
2 | exec 1>/dev/null | ||
3 | (echo LOST1 >&22) 22>&1 | ||
4 | (echo LOST2 >&22) 22>&1 | ||
5 | (echo OK >&22) 22>&2 | ||
diff --git a/shell/ash_test/ash-redir/redir3.right b/shell/ash_test/ash-redir/redir3.right new file mode 100644 index 000000000..fd641a8ea --- /dev/null +++ b/shell/ash_test/ash-redir/redir3.right | |||
@@ -0,0 +1,3 @@ | |||
1 | TEST | ||
2 | ./redir3.tests: line 4: 9: Bad file descriptor | ||
3 | Output to fd#9: 1 | ||
diff --git a/shell/ash_test/ash-redir/redir3.tests b/shell/ash_test/ash-redir/redir3.tests new file mode 100755 index 000000000..f50a7674c --- /dev/null +++ b/shell/ash_test/ash-redir/redir3.tests | |||
@@ -0,0 +1,5 @@ | |||
1 | # redirects to closed descriptors should not leave these descriptors" | ||
2 | # open afterwards | ||
3 | echo TEST 9>/dev/null | ||
4 | echo MUST ERROR OUT >&9 | ||
5 | echo "Output to fd#9: $?" | ||
diff --git a/shell/ash_test/run-all b/shell/ash_test/run-all index b0a6d1088..4d0f39a41 100755 --- a/shell/ash_test/run-all +++ b/shell/ash_test/run-all | |||
@@ -3,8 +3,8 @@ | |||
3 | TOPDIR=$PWD | 3 | TOPDIR=$PWD |
4 | 4 | ||
5 | test -x ash || { | 5 | test -x ash || { |
6 | echo "No ./ash?! Perhaps you want to run 'ln -s ../../busybox ash'" | 6 | echo "No ./ash - creating a link to ../../busybox" |
7 | exit | 7 | ln -s ../../busybox ash |
8 | } | 8 | } |
9 | test -x printenv || gcc -O2 -o printenv printenv.c || exit $? | 9 | test -x printenv || gcc -O2 -o printenv printenv.c || exit $? |
10 | test -x recho || gcc -O2 -o recho recho.c || exit $? | 10 | test -x recho || gcc -O2 -o recho recho.c || exit $? |