Skip to content

Commit 77e3af8

Browse files
committed
[test/spec] Failing test cases for fd bugs.
1 parent 72c2c90 commit 77e3af8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

spec/redirect.test.sh

+35
Original file line numberDiff line numberDiff line change
@@ -551,3 +551,38 @@ hi
551551
hi
552552
hi
553553
## END
554+
555+
#### : >/dev/null 2> / (OSH regression: fail to pop fd frame)
556+
# oil 0.8.pre4 fails to restore fds after redirection failure In the
557+
# following case, the fd frame remains after the redirection failure
558+
# "2> /" so that the effect of redirection ">/dev/null" remains after
559+
# the completion of the command.
560+
: >/dev/null 2> /
561+
echo hello
562+
## stdout: hello
563+
## OK dash stdout-json: ""
564+
## OK dash status: 2
565+
## OK mksh stdout-json: ""
566+
## OK mksh status: 1
567+
# dash/mksh terminates the execution of script on the redirection.
568+
569+
#### echo foo >&100 (OSH regression: does not fail with invalid fd 100)
570+
# oil 0.8.pre4 does not fail with non-existent fd 100.
571+
fd=100
572+
echo foo >&$fd
573+
## stdout-json: ""
574+
## status: 1
575+
## OK dash status: 2
576+
577+
#### exec {fd}>&- (OSH regression: fails to close fd)
578+
# mksh, dash do not implement {fd} redirections.
579+
case $SH in (mksh|dash) exit 1 ;; esac
580+
# oil 0.8.pre4 fails to close fd by {fd}&-.
581+
exec {fd}>file1
582+
echo foo >&$fd
583+
exec {fd}>&-
584+
echo bar >&$fd
585+
cat file1
586+
## stdout: foo
587+
## N-I mksh/dash stdout-json: ""
588+
## N-I mksh/dash status: 1

0 commit comments

Comments
 (0)