• fix for the pipeline-as-coprocess problem

• bump to mksh R32
This commit is contained in:
tg 2007-10-25 13:51:19 +00:00
parent 84e78bcfb6
commit 2ca968e25f
4 changed files with 23 additions and 17 deletions

18
check.t
View File

@ -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: 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: 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 $ # $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 # http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R31 2007/10/18 @(#)MIRBSD KSH R32 2007/10/25
description: description:
Check version of shell. Check version of shell.
category: pdksh category: pdksh
@ -3851,7 +3851,7 @@ expected-stdout:
posix posix
brex brex
--- ---
name: pipeline-subshell-1 name: pipeline-1
description: description:
pdksh bug: last command of a pipeline is executed in a pdksh bug: last command of a pipeline is executed in a
subshell - make sure it still is, scripts depend on it subshell - make sure it still is, scripts depend on it
@ -3877,6 +3877,18 @@ expected-stdout:
* *
abcx abcy 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 name: persist-history-1
description: description:
Check if persistent history saving works Check if persistent history saving works

6
jobs.c
View File

@ -2,7 +2,7 @@
#include "sh.h" #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! */ /* Order important! */
#define PRUNNING 0 #define PRUNNING 0
@ -432,8 +432,10 @@ exchild(struct op *t, int flags, /* used if XPCLOSE or XCCLOSE */ int close_fd)
tty_close(); tty_close();
cleartraps(); cleartraps();
execute(t, (flags & XERROK) | XEXEC); /* no return */ execute(t, (flags & XERROK) | XEXEC); /* no return */
internal_warningf("exchild: execute() returned");
#ifndef MKSH_SMALL #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); fptreef(shl_out, 2, "exchild: tried to execute {\n%T\n}\n", t);
shf_flush(shl_out); shf_flush(shl_out);
#endif #endif

12
mksh.1
View File

@ -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 $ .\" $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 .Dt MKSH 1
.Os MirBSD .Os MirBSD
.Sh NAME .Sh NAME
@ -5399,11 +5399,3 @@ mailing list or in the
.Pq or Li \&#ksh .Pq or Li \&#ksh
IRC channel at IRC channel at
.Pa irc.freenode.net:6667 . .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).

4
sh.h
View File

@ -8,8 +8,8 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */ /* $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 $ */ /* $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_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.179 2007/10/25 13:51:19 tg Exp $"
#define MKSH_VERSION "R31 2007/10/18" #define MKSH_VERSION "R32 2007/10/25"
#if HAVE_SYS_PARAM_H #if HAVE_SYS_PARAM_H
#include <sys/param.h> #include <sys/param.h>