• add patch from Robert Luberda <robert@debian.org> fixing the

four-argument form of test (yet again…), thanks
• drop the obsolete (pre-POSIX) form “test -t” without fd
This commit is contained in:
tg 2011-05-06 15:41:25 +00:00
parent c021aa4cad
commit 3f21a0e199
4 changed files with 54 additions and 13 deletions

36
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.450 2011/05/05 00:04:55 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.451 2011/05/06 15:41:21 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -25,7 +25,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R39 2011/05/04
@(#)MIRBSD KSH R39 2011/05/06
description:
Check version of shell.
stdin:
@ -8787,3 +8787,35 @@ stdin:
expected-stdout:
bar
---
name: debian-117-1
description:
Check test - bug#465250
stdin:
test \( ! -e \) ; echo $?
expected-stdout:
1
---
name: debian-117-2
description:
Check test - bug#465250
stdin:
test \( -e \) ; echo $?
expected-stdout:
0
---
name: debian-117-3
description:
Check test - bug#465250
stdin:
test ! -e ; echo $?
expected-stdout:
1
---
name: debian-117-4
description:
Check test - bug#465250
stdin:
test -e ; echo $?
expected-stdout:
0
---

19
funcs.c
View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.185 2011/04/09 21:01:01 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.186 2011/05/06 15:41:23 tg Exp $");
#if HAVE_KILLPG
/*
@ -2542,11 +2542,23 @@ c_test(const char **wp)
* our parser does the right thing for the omitted steps.
*/
if (argc <= 5) {
const char **owp = wp;
const char **owp = wp, **owpend = te.wp_end;
int invert = 0;
Test_op op;
const char *opnd1, *opnd2;
if (argc >= 2 && ((*te.isa)(&te, TM_OPAREN))) {
te.pos.wp = te.wp_end - 1;
if ((*te.isa)(&te, TM_CPAREN)) {
argc -= 2;
te.wp_end--;
te.pos.wp = owp + 2;
} else {
te.pos.wp = owp + 1;
te.wp_end = owpend;
}
}
while (--argc >= 0) {
if ((*te.isa)(&te, TM_END))
return (!0);
@ -2567,8 +2579,6 @@ c_test(const char **wp)
}
if (argc == 1) {
opnd1 = (*te.getopnd)(&te, TO_NONOP, 1);
if (strcmp(opnd1, "-t") == 0)
break;
res = (*te.eval)(&te, TO_STNZE, opnd1,
NULL, 1);
if (invert & 1)
@ -2581,6 +2591,7 @@ c_test(const char **wp)
break;
}
te.pos.wp = owp + 1;
te.wp_end = owpend;
}
return (test_parse(&te));

8
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.259 2011/05/05 00:04:58 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.260 2011/05/06 15:41:24 tg Exp $
.\" $OpenBSD: ksh.1,v 1.140 2011/04/23 10:14:59 sobrado Exp $
.\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@ -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 5 2011 $
.Dd $Mdocdate: May 6 2011 $
.\"
.\" Check which macro package we use
.\"
@ -4229,14 +4229,12 @@ socket.
.It Fl s Ar file
.Ar file
is not empty.
.It Fl t Op Ar fd
.It Fl t Ar fd
File descriptor
.Ar fd
is a
.Xr tty 4
device.
.Ar fd
may be left out, in which case it is taken to be 1.
.It Fl u Ar file
.Ar file Ns 's
mode has the setuid bit set.

4
sh.h
View File

@ -151,9 +151,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.468 2011/05/05 00:04:59 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.469 2011/05/06 15:41:25 tg Exp $");
#endif
#define MKSH_VERSION "R39 2011/05/04"
#define MKSH_VERSION "R39 2011/05/06"
#ifndef MKSH_INCLUDES_ONLY