From 2ca968e25f84490eb0c7c091adec06ff158bc937 Mon Sep 17 00:00:00 2001 From: tg Date: Thu, 25 Oct 2007 13:51:19 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=A2=20fix=20for=20the=20pipeline-as-copro?= =?UTF-8?q?cess=20problem=20=E2=80=A2=20bump=20to=20mksh=20R32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check.t | 18 +++++++++++++++--- jobs.c | 6 ++++-- mksh.1 | 12 ++---------- sh.h | 4 ++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/check.t b/check.t index f9c0975..31b9fe2 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.141 2007/10/18 20:32:31 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.142 2007/10/25 13:51:18 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 $ @@ -7,7 +7,7 @@ # http://www.research.att.com/~gsf/public/ifs.sh expected-stdout: - @(#)MIRBSD KSH R31 2007/10/18 + @(#)MIRBSD KSH R32 2007/10/25 description: Check version of shell. category: pdksh @@ -3851,7 +3851,7 @@ expected-stdout: posix brex --- -name: pipeline-subshell-1 +name: pipeline-1 description: pdksh bug: last command of a pipeline is executed in a subshell - make sure it still is, scripts depend on it @@ -3877,6 +3877,18 @@ expected-stdout: * abcx abcy --- +name: pipeline-2 +description: + check that co-processes work with TCOMs, TPIPEs and TPARENs +stdin: + "$0" -c 'i=100; print hi |& while read -p line; do print "$((i++)) $line"; done' + "$0" -c 'i=200; print hi | cat |& while read -p line; do print "$((i++)) $line"; done' + "$0" -c 'i=300; (print hi | cat) |& while read -p line; do print "$((i++)) $line"; done' +expected-stdout: + 100 hi + 200 hi + 300 hi +--- name: persist-history-1 description: Check if persistent history saving works diff --git a/jobs.c b/jobs.c index 336a147..ae9d698 100644 --- a/jobs.c +++ b/jobs.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.29 2007/10/25 13:27:00 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.30 2007/10/25 13:51:18 tg Exp $"); /* Order important! */ #define PRUNNING 0 @@ -432,8 +432,10 @@ exchild(struct op *t, int flags, /* used if XPCLOSE or XCCLOSE */ int close_fd) tty_close(); cleartraps(); execute(t, (flags & XERROK) | XEXEC); /* no return */ - internal_warningf("exchild: execute() returned"); #ifndef MKSH_SMALL + if (t->type == TPIPE) + unwind(LLEAVE); + internal_warningf("exchild: execute() returned"); fptreef(shl_out, 2, "exchild: tried to execute {\n%T\n}\n", t); shf_flush(shl_out); #endif diff --git a/mksh.1 b/mksh.1 index 71bf95e..f1e7f4d 100644 --- a/mksh.1 +++ b/mksh.1 @@ -1,7 +1,7 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.103 2007/10/18 20:32:32 tg Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.104 2007/10/25 13:51:18 tg Exp $ .\" $OpenBSD: ksh.1,v 1.120 2007/05/31 20:47:44 otto Exp $ .\" -.Dd October 18, 2007 +.Dd October 25, 2007 .Dt MKSH 1 .Os MirBSD .Sh NAME @@ -5399,11 +5399,3 @@ mailing list or in the .Pq or Li \&#ksh IRC channel at .Pa irc.freenode.net:6667 . -.Pp -By the way, the snippet -.Bd -literal -offset indent -$ print hi \*(Ba read a; print $a # Does not show hi -.Ed -.Pp -does not work, because commands of a pipe sequence are executed in -a subshell (but you can usually use co-processes instead of pipes). diff --git a/sh.h b/sh.h index 6c0406b..2fddb66 100644 --- a/sh.h +++ b/sh.h @@ -8,8 +8,8 @@ /* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */ /* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */ -#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.178 2007/10/18 20:32:33 tg Exp $" -#define MKSH_VERSION "R31 2007/10/18" +#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.179 2007/10/25 13:51:19 tg Exp $" +#define MKSH_VERSION "R32 2007/10/25" #if HAVE_SYS_PARAM_H #include