use a perl test for fd-cloexec to avoid testing the tester with the tester; improve fd-cloexec description

This commit is contained in:
tg 2015-03-20 23:37:29 +00:00
parent 1351c5eb0f
commit 0947d274f6
2 changed files with 39 additions and 21 deletions

42
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.685 2015/03/14 05:23:12 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.686 2015/03/20 23:37:27 tg Exp $
# -*- mode: sh -*-
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -9756,25 +9756,33 @@ description:
Verify that file descriptors > 2 are private for Korn shells
AT&T ksh93 does this still, which means we must keep it as well
category: shell:legacy-no
file-setup: file 644 "test.sh"
echo >&3 Fowl
stdin:
exec 3>&1
"$__progname" test.sh
cat >cld <<-EOF
#!$__perlname
open(my \$fh, ">&", 9) or die "E: open \$!";
syswrite(\$fh, "Fowl\\n", 5) or die "E: write \$!";
EOF
chmod +x cld
exec 9>&1
./cld
expected-exit: e != 0
expected-stderr-pattern:
/bad file descriptor/
/E: open /
---
name: fd-cloexec-2
description:
Verify that file descriptors > 2 are not private for POSIX shells
See Debian Bug #154540, Closes: #499139
file-setup: file 644 "test.sh"
echo >&3 Fowl
stdin:
test -n "$POSH_VERSION" || set -o sh
exec 3>&1
"$__progname" test.sh
cat >cld <<-EOF
#!$__perlname
open(my \$fh, ">&", 9) or die "E: open \$!";
syswrite(\$fh, "Fowl\\n", 5) or die "E: write \$!";
EOF
chmod +x cld
test -n "$POSH_VERSION" || set -o posix
exec 9>&1
./cld
expected-stdout:
Fowl
---
@ -9782,11 +9790,15 @@ name: fd-cloexec-3
description:
Verify that file descriptors > 2 are not private for LEGACY KSH
category: shell:legacy-yes
file-setup: file 644 "test.sh"
echo >&3 Fowl
stdin:
exec 3>&1
"$__progname" test.sh
cat >cld <<-EOF
#!$__perlname
open(my \$fh, ">&", 9) or die "E: open \$!";
syswrite(\$fh, "Fowl\\n", 5) or die "E: write \$!";
EOF
chmod +x cld
exec 9>&1
./cld
expected-stdout:
Fowl
---

18
lksh.1
View File

@ -1,6 +1,6 @@
.\" $MirOS: src/bin/mksh/lksh.1,v 1.5 2013/05/22 18:18:06 tg Exp $
.\" $MirOS: src/bin/mksh/lksh.1,v 1.6 2015/03/20 23:37:29 tg Exp $
.\"-
.\" Copyright (c) 2008, 2009, 2010, 2012, 2013
.\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015
.\" Thorsten “mirabilos” Glaser <tg@mirbsd.org>
.\"
.\" Provided that these terms and disclaimer and all copyright notices
@ -72,7 +72,7 @@
.\" with -mandoc, it might implement .Mx itself, but we want to
.\" use our own definition. And .Dd must come *first*, always.
.\"
.Dd $Mdocdate: May 22 2013 $
.Dd $Mdocdate: March 20 2015 $
.\"
.\" Check which macro package we use, and do other -mdoc setup.
.\"
@ -245,11 +245,17 @@ passes through the errorlevel from the
.Xr getopt 1
command.
.It
.Nm lksh ,
unlike
Unlike
.At
.Nm ksh ,
does not keep file descriptors \*(Gt 2 private.
.Nm mksh
in
.Fl o Ic posix
or
.Fl o Ic sh
mode and
.Nm lksh
do not keep file descriptors \*(Gt 2 private from sub-processes.
.El
.Sh SEE ALSO
.Xr mksh 1