[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#702348: marked as done (unblock: mksh/40.9.20120630-7)



Your message dated Thu, 04 Apr 2013 18:13:16 +0200
with message-id <515DA69C.6050005@thykier.net>
and subject line Re: Bug#702348: unblock: mksh/40.9.20120630-7
has caused the Debian Bug report #702348,
regarding unblock: mksh/40.9.20120630-7
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
702348: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702348
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package mksh

unblock mksh/40.9.20120630-7

(Thanks to Lisandro for his posting on Planet Debian!)

Dear Release Team,

please unblock mksh (40.9.20120630-7) for wheezy.
The debdiff between the two source packages (40.9.20120630-4 currently
in testing and 40.9.20120630-7 currently in sid) follows, except the
diff between the debian/patches/debian-changes file was replaced by an
interdiff between them for better legibility (see #689193 for the
reason), and I removed changes to the RCS IDs, i.e. lines only changing
the “$MirOS$” strings, and changes to the copyright years, to get it
more legible. Then, I sorted changes logically and let each block be
followed by the explanation for the change.

Please just ask back if you need any clarification. I am aware that
a Unix shell is complex code; I tried to select only patches to back‐
port for this that I really think the wheezy release will benefit from.

The upload will not change the shell language or behaviour, except
that $? in/after eval is now correct and that the ERR and EXIT traps
are run at all, once only, and in the correct order, and that set -e
aborts correctly when a function returned nonzero; all of these are
regressions against versions of mksh several years old and had been
introduced by earlier bugfixes, so the interface does not change.

--- mksh-40.9.20120630/debian/changelog	2012-10-13 14:57:14.000000000 +0000
+++ mksh-40.9.20120630/debian/changelog	2013-02-15 19:01:25.000000000 +0000
@@ -1,3 +1,34 @@
+mksh (40.9.20120630-7) unstable; urgency=low
+
+  * The “customer service” upload
+  * Correct the fix for LP#1104543 (Closes: #700526)
+  * Fix uninitialised memory access (Closes: #700604)
+
+ -- Thorsten Glaser <tg@mirbsd.de>  Fri, 15 Feb 2013 19:00:40 +0000
+
+mksh (40.9.20120630-6) unstable; urgency=low
+
+  * Revert the fix for LP#1104543 as it causes Debian #700526
+    (not closing as it’s not a proper fix)
+
+ -- Thorsten Glaser <tg@mirbsd.de>  Fri, 15 Feb 2013 17:44:20 +0000
+
+mksh (40.9.20120630-5) unstable; urgency=low
+
+  * Bump versioned B-D on libklibc-dev [armhf] to known-fixed
+  * Fix input command line editing display redrawing issue
+  * Backport fixes to the regression testsuite and some new tests
+  * Add bugfixes for error handling related issues:
+    - behaviour of $? in eval (RedHat BZ#865121)
+    - running the EXIT and ERR traps (Closes: #696823)
+    - set -e vs. use of &&/|| in a function (LP#1104543)
+  * Add appropriate regression tests for these fixes
+  * Update the mailing list address in lksh.1 manpage
+  * In /etc/skel/.mkshrc handle /etc/debian_chroot like bashrc does
+  * Update copyright year
+
+ -- Thorsten Glaser <tg@mirbsd.de>  Mon, 11 Feb 2013 14:14:37 +0100
+
 mksh (40.9.20120630-4) unstable; urgency=low
 
   * The “Cookie” upload

This is the changelog, with reference to the bug numbers of the bugs
fixed by the changes below also. The change in -6 just reverted one of
the changes in -5 and was immediately followed up by the correct fix
in -7 once I had it working.

--- mksh-40.9.20120630/debian/.mkshrc	2011-11-26 00:04:53.000000000 +0000
+++ mksh-40.9.20120630/debian/.mkshrc	2013-02-11 13:18:28.000000000 +0000
@@ -19,6 +19,8 @@
 else
 	p=$'\001'
 fi
+[[ -z ${debian_chroot:-} && -r /etc/debian_chroot ]] && \
+    debian_chroot=$(</etc/debian_chroot)
 PS1=$p$'\r${debian_chroot:+'$p$'\e[0;1m'$p'($debian_chroot)'$p$'\e[0m'$p'}'$PS1
 unset p
 

This change aligns the standard mkshrc file with what bash’s initiali‐
sation files do wrt. behaviour in chroots (dchroot/schroot, cowbuilder
--login).

--- mksh-40.9.20120630/debian/control	2012-09-30 14:50:32.000000000 +0000
+++ mksh-40.9.20120630/debian/control	2012-10-06 13:05:08.000000000 +0000
@@ -19,7 +19,8 @@
 Build-Depends: bsdmainutils, ed,
 # # try klibc on any architectures it has ever been built; this aids people
 # # trying to debug klibc itself (hppa, powerpcspe, sh4)
-  libklibc-dev [alpha amd64 armel armhf hppa i386 ia64 m68k mips mipsel powerpc powerpcspe ppc64 s390 s390x sh4 sparc sparc64],
+  libklibc-dev (>= 2.0.1-2~) [armhf],
+  libklibc-dev [alpha amd64 armel hppa i386 ia64 m68k mips mipsel powerpc powerpcspe ppc64 s390 s390x sh4 sparc sparc64],
 # # same for dietlibc; the hppa one is optional for now
   dietlibc-dev (>= 0.33~cvs20120325-4~) [armhf],
   dietlibc-dev (>= 0.33~cvs20111108-5~) [hppa] | dietlibc-doc [hppa],

This change merely introduces a versioning to the klibc dependency
for armhf as it got usable only late in the release process. I’ve
had this in for a while already, even said so on the mailing list,
but I think it went unseen in the flood of messages.

Omitted change for debian/copyright: only the year 2013 was added.

--- mksh-40.9.20120630/debian/lksh.1	2012-07-20 23:34:00.000000000 +0000
+++ mksh-40.9.20120630/debian/lksh.1	2013-02-11 13:18:30.000000000 +0000
@@ -258,7 +258,7 @@
 Talk to the
 .Mx
 development team using the mailing list at
-.Aq miros\-discuss@mirbsd.org
+.Aq miros\-mksh@mirbsd.org
 or the
 .Li \&#\&!/bin/mksh
 .Pq or Li \&#ksh

This changes the mailing list address, since we got one specifically
for mksh upstream in the meantime, so people don’t need to follow the
development of “all of MirBSD”. Inclusion of this change was requested
by users who didn’t know of the list.

=== following is interdiff for debian/patches/debian-changes ===

Omitted change to Build.sh (version only)

--- mksh-40.9.20120630/edit.c
+++ mksh-40.9.20120630/edit.c
@@ -900,7 +900,7 @@
  * we use x_adj_done so that functions can tell
  * whether x_adjust() has been called while they are active.
  */
-static bool x_adj_done;
+static int x_adj_done;
 
 static int x_col;
 static int x_displen;
@@ -1166,7 +1166,7 @@
 	if (x_col >= xx_cols)
 		x_col %= xx_cols;
 	x_displen = xx_cols - 2 - x_col;
-	x_adj_done = false;
+	x_adj_done = 0;
 
 	pprompt(prompt, 0);
 	if (x_displen < 1) {
@@ -1339,7 +1339,7 @@
 x_ins(const char *s)
 {
 	char *cp = xcp;
-	bool adj = x_adj_done;
+	int adj = x_adj_done;
 
 	if (x_do_ins(s, strlen(s)) < 0)
 		return (-1);
@@ -1616,7 +1616,7 @@
 static void
 x_zots(char *str)
 {
-	bool adj = x_adj_done;
+	int adj = x_adj_done;
 
 	x_lastcp();
 	while (*str && str < xlp && adj == x_adj_done)
@@ -2847,7 +2847,7 @@
 x_adjust(void)
 {
 	/* flag the fact that we were called. */
-	x_adj_done = true;
+	x_adj_done++;
 	/*
 	 * we had a problem if the prompt length > xx_cols / 2
 	 */
@@ -2969,7 +2969,7 @@
 static void
 x_e_puts(const char *s)
 {
-	bool adj = x_adj_done;
+	int adj = x_adj_done;
 
 	while (*s && adj == x_adj_done)
 		x_e_putc3(&s);

This fixes display corruption when inserting characters in the
middle of the input line, when following the insertion point
there were multi-byte characters (e.g. Russian or Japanese).

I reported this to the mailing list already, but I think it
got swamped by the mass of the reports.

Omitted changes to sh.h: version only.

--- mksh-40.9.20120630/expr.c
+++ mksh-40.9.20120630/expr.c
@@ -205,11 +205,10 @@
 	int i;
 
 	/* save state to allow recursive calls */
+	memset(&curstate, 0, sizeof(curstate));
 	curstate.expression = curstate.tokp = expr;
-	curstate.noassign = 0;
+	curstate.tok = BAD;
 	curstate.arith = arith;
-	curstate.evaling = NULL;
-	curstate.natural = false;
 
 	newenv(E_ERRH);
 	if ((i = kshsetjmp(e->jbuf))) {
@@ -647,7 +646,7 @@
 static void
 assign_check(Expr_state *es, enum token op, struct tbl *vasn)
 {
-	if (es->tok == END ||
+	if (es->tok == END || !vasn ||
 	    (vasn->name[0] == '\0' && !(vasn->flag & EXPRLVALUE)))
 		evalerr(es, ET_LVALUE, opinfo[(int)op].name);
 	else if (vasn->flag & RDONLY)

Fix for uninitialised memory access (#700604)

--- mksh-40.9.20120630.orig/main.c
+++ mksh-40.9.20120630/main.c
@@ -840,26 +840,43 @@ shell(Source * volatile s, volatile bool
 	}
 	quitenv(NULL);
 	source = old_source;
 	return (exstat & 0xFF);
 }
 
 /* return to closest error handler or shell(), exit if none found */
 void
 unwind(int i)
 {
+	/*
+	 * This is a kludge. We need to restore everything that was
+	 * changed in the new environment, see cid 1005090337C7A669439
+	 * and 10050903386452ACBF1, but fail to even save things most of
+	 * the time. funcs.c:c_eval() changes FERREXIT temporarily to 0,
+	 * which needs to be restored thus (related to Debian #696823).
+	 * We did not save the shell flags, so we use a special or'd
+	 * value here... this is mostly to clean up behind *other*
+	 * callers of unwind(LERROR) here; exec.c has the regular case.
+	 */
+	if (Flag(FERREXIT) & 0x80) {
+		/* GNU bash does not run this trapsig */
+		trapsig(ksh_SIGERR);
+		Flag(FERREXIT) &= ~0x80;
+	}
+
 	/* ordering for EXIT vs ERR is a bit odd (this is what AT&T ksh does) */
-	if (i == LEXIT || (Flag(FERREXIT) && (i == LERROR || i == LINTR) &&
-	    sigtraps[ksh_SIGEXIT].trap)) {
+	if (i == LEXIT ||
+	    ((i == LERROR || i == LINTR) && sigtraps[ksh_SIGEXIT].trap)) {
 		++trap_nested;
 		runtrap(&sigtraps[ksh_SIGEXIT], trap_nested == 1);
 		--trap_nested;
 		i = LLEAVE;
-	} else if (Flag(FERREXIT) && (i == LERROR || i == LINTR)) {
+	} else if (Flag(FERREXIT) == 1 && (i == LERROR || i == LINTR)) {
 		++trap_nested;
 		runtrap(&sigtraps[ksh_SIGERR], trap_nested == 1);
 		--trap_nested;
 		i = LLEAVE;
 	}
+
 	while (/* CONSTCOND */ 1) {
 		switch (e->type) {
 		case E_PARSE:
--- mksh-40.9.20120630.orig/exec.c
+++ mksh-40.9.20120630/exec.c
@@ -476,9 +476,14 @@ execute(struct op * volatile t,
 		unwind(LEXIT);
 	if (rv != 0 && !(flags & XERROK) &&
 	    (xerrok == NULL || !*xerrok)) {
-		trapsig(ksh_SIGERR);
-		if (Flag(FERREXIT))
-			unwind(LERROR);
+		if (Flag(FERREXIT) & 0x80) {
+			/* inside eval */
+			Flag(FERREXIT) = 0;
+		} else {
+			trapsig(ksh_SIGERR);
+			if (Flag(FERREXIT))
+				unwind(LERROR);
+		}
 	}
 	return (rv);
 }

This ensures that the EXIT and ERR traps are run correctly
(at all and exactly once) in both set -e and set +e cases,
see #696823.

--- mksh-40.9.20120630.orig/exec.c
+++ mksh-40.9.20120630/exec.c
@@ -728,8 +733,7 @@ comexec(struct op *t, struct tbl * volat
 
 		e->type = E_FUNC;
 		if (!(i = kshsetjmp(e->jbuf))) {
-			/* seems odd to pass XERROK here, but AT&T ksh does */
-			exstat = execute(tp->val.t, flags & XERROK, xerrok);
+			exstat = execute(tp->val.t, flags & XERROK, NULL) & 0xFF;
 			i = LRETURN;
 		}
 		kshname = old_kshname;

This is the fix for LP#1104543 and #700526 which corrects the
mistake of not triggering the “set -e” caused exit when a shell
function returns nonzero but uses an && or || sequence inside.

Since Debian is a heavy user of “set -e” (in fact, the only one
I know of), this fix should _really_ be included in the release.

--- mksh-40.9.20120630.orig/funcs.c
+++ mksh-40.9.20120630/funcs.c
@@ -2208,15 +2208,20 @@ c_eval(const char **wp)
 	 *	If there are no arguments, or only null arguments,
 	 *	eval shall return a zero exit status; ...
 	 */
-	/* exstat = subst_exstat; */	/* AT&T ksh88 */
-	exstat = 0;			/* SUSv4 */
+	/* AT&T ksh88: use subst_exstat */
+	/* exstat = subst_exstat; */
+	/* SUSv4: OR with a high value never written otherwise */
+	exstat |= 0x4000;
 
 	savef = Flag(FERREXIT);
-	Flag(FERREXIT) = 0;
+	Flag(FERREXIT) |= 0x80;
 	rv = shell(s, false);
 	Flag(FERREXIT) = savef;
 	source = saves;
 	afree(s, ATEMP);
+	if (exstat & 0x4000)
+		/* detect old exstat, use 0 in that case */
+		rv = 0;
 	return (rv);
 }
 
@@ -2278,7 +2283,7 @@ c_exitreturn(const char **wp)
 			exstat = 1;
 			warningf(true, "%s: %s", arg, "bad number");
 		} else
-			exstat = n;
+			exstat = n & 0xFF;
 	} else if (trap_exstat != -1)
 		exstat = trap_exstat;
 	if (wp[0][0] == 'r') {
--- mksh-40.9.20120630.orig/main.c
+++ mksh-40.9.20120630/main.c
@@ -693,7 +693,7 @@ include(const char *name, int argc, cons
 			 * intr_ok is set if we are including .profile or $ENV.
 			 * If user ^Cs out, we don't want to kill the shell...
 			 */
-			if (intr_ok && (exstat - 128) != SIGTERM)
+			if (intr_ok && ((exstat & 0xFF) - 128) != SIGTERM)
 				return (1);
 			/* FALLTHROUGH */
 		case LEXIT:
@@ -831,7 +831,7 @@ shell(Source * volatile s, volatile bool
 			}
 		}
 		if (t && (!Flag(FNOEXEC) || (s->flags & SF_TTY)))
-			exstat = execute(t, 0, NULL);
+			exstat = execute(t, 0, NULL) & 0xFF;
 
 		if (t != NULL && t->type != TEOF && interactive && really_exit)
 			really_exit = false;
@@ -840,5 +840,5 @@ shell(Source * volatile s, volatile bool
 	}
 	quitenv(NULL);
 	source = old_source;
-	return (exstat);
+	return (exstat & 0xFF);
 }
@@ -935,7 +952,7 @@ quitenv(struct shf *shf)
 #endif
 			j_exit();
 			if (ep->flags & EF_FAKE_SIGDIE) {
-				int sig = exstat - 128;
+				int sig = (exstat & 0xFF) - 128;
 
 				/*
 				 * ham up our death a bit (AT&T ksh
@@ -954,7 +971,7 @@ quitenv(struct shf *shf)
 		if (shf)
 			shf_close(shf);
 		reclaim();
-		exit(exstat);
+		exit(exstat & 0xFF);
 	}
 	if (shf)
 		shf_close(shf);
--- mksh-40.9.20120630.orig/var.c
+++ mksh-40.9.20120630/var.c
@@ -260,7 +260,7 @@ global(const char *n)
 				vp->flag &= ~(ISSET|INTEGER);
 			break;
 		case '?':
-			vp->val.i = exstat;
+			vp->val.i = exstat & 0xFF;
 			break;
 		case '#':
 			vp->val.i = l->argc;
--- mksh-40.9.20120630.orig/exec.c
+++ mksh-40.9.20120630/exec.c
@@ -461,7 +461,7 @@ execute(struct op * volatile t,
 			errorf("%s: %s", s, strerror(rv));
 	}
  Break:
-	exstat = rv;
+	exstat = rv & 0xFF;
 	if (vp_pipest->flag & INT_L) {
 		unset(vp_pipest, 1);
 		vp_pipest->flag = DEFINED | ISSET | INTEGER | RDONLY |
@@ -750,7 +754,7 @@ comexec(struct op *t, struct tbl * volat
 		switch (i) {
 		case LRETURN:
 		case LERROR:
-			rv = exstat;
+			rv = exstat & 0xFF;
 			break;
 		case LINTR:
 		case LEXIT:
@@ -810,7 +814,7 @@ comexec(struct op *t, struct tbl * volat
 	}
  Leave:
 	if (flags & XEXEC) {
-		exstat = rv;
+		exstat = rv & 0xFF;
 		unwind(LLEAVE);
 	}
 	return (rv);

This series of patches converts all users of exstat to only use
its lower bits and makes a flag bit out of one of the higher bits,
to fix the value of $? in and after an eval (RedHat BZ#865121).

=== patches to the mksh testsuite follow

--- mksh-40.9.20120630/check.t
+++ mksh-40.9.20120630/check.t
@@ -217,14 +217,21 @@
 	the time-limit clause (e.g. to 7) if this occurs.
 time-limit: 3
 stdin:
-	echo -n >tf
-	alias ls=ls
-	ls
-	echo $(ls)
+	print '#!'"$__progname"'\necho tf' >lq
+	chmod +x lq
+	PATH=$PWD:$PATH
+	alias lq=lq
+	lq
+	echo = now
+	i=`lq`
+	print -r -- $i
+	echo = out
 	exit 0
 expected-stdout:
 	tf
+	= now
 	tf
+	= out
 ---
 name: alias-10
 description:
@@ -2025,6 +2032,7 @@
 # breaks on Mac OSX (HFS+ non-standard Unicode canonical decomposition)
 # breaks on Cygwin 1.7 (files are now UTF-16 or something)
 category: !os:cygwin,!os:darwin,!os:msys
+need-pass: no
 file-setup: file 644 "a�"
 stdin:
 	echo a[��*
@@ -5571,11 +5579,12 @@
 stdin:
 	echo ${A=a=}~ b=~ c=d~ ~
 	set +o braceexpand
+	unset A
 	echo ${A=a=}~ b=~ c=d~ ~
 expected-stdout:
 	a=/sweet b=/sweet c=d~ /sweet
 	a=~ b=~ c=d~ /sweet
 ---
 name: exit-err-1
 description:
 	Check some "exit on error" conditions

These are bugfixes to some existing regression tests. The first
hunk made a test actually test for what it was supposed to, the
second hunk marks a test as optional since it depends on filesy‐
stem semantics, the third one fixes an oversight.

--- mksh-40.9.20120630/check.t
+++ mksh-40.9.20120630/check.t
@@ -5571,12 +5579,30 @@
 stdin:
 	echo ${A=a=}~ b=~ c=d~ ~
 	set +o braceexpand
 	unset A
 	echo ${A=a=}~ b=~ c=d~ ~
 expected-stdout:
 	a=/sweet b=/sweet c=d~ /sweet
 	a=~ b=~ c=d~ /sweet
 ---
+name: tilde-expand-2
+description:
+	Check tilde expansion works
+env-setup: !HOME=/sweet!
+stdin:
+	wd=$PWD
+	cd /
+	plus=$(print -r -- ~+)
+	minus=$(print -r -- ~-)
+	nix=$(print -r -- ~)
+	[[ $plus = / ]]; echo one $? .
+	[[ $minus = "$wd" ]]; echo two $? .
+	[[ $nix = /sweet ]]; echo nix $? .
+expected-stdout:
+	one 0 .
+	two 0 .
+	nix 0 .
+---
 name: exit-err-1
 description:
 	Check some "exit on error" conditions
@@ -8059,6 +8259,36 @@
 expected-stdout:
 	okay
 ---
+name: redir-1
+description:
+	Check some of the most basic invariants of I/O redirection
+stdin:
+	i=0
+	function d {
+		print o$i.
+		print -u2 e$((i++)).
+	}
+	d >a 2>b
+	echo =1=
+	cat a
+	echo =2=
+	cat b
+	echo =3=
+	d 2>&1 >c
+	echo =4=
+	cat c
+	echo =5=
+expected-stdout:
+	=1=
+	o0.
+	=2=
+	e0.
+	=3=
+	e1.
+	=4=
+	o1.
+	=5=
+---
 name: bashiop-1
 description:
 	Check if GNU bash-like I/O redirection works

These are new regression tests that make sure that old
behaviour, which was already working and expected, will
not break in the future (with fixes or ports to other
architectures). (tilde-expand-2 was inspired by posh.)

--- mksh-40.9.20120630/check.t
+++ mksh-40.9.20120630/check.t
@@ -5712,19 +5766,29 @@
 description:
 	Check eval vs substitution exit codes (ksh93 alike)
 stdin:
+	(exit 12)
 	eval $(false)
 	echo A $?
+	(exit 12)
 	eval ' $(false)'
 	echo B $?
+	(exit 12)
 	eval " $(false)"
 	echo C $?
+	(exit 12)
 	eval "eval $(false)"
 	echo D $?
+	(exit 12)
 	eval 'eval '"$(false)"
 	echo E $?
 	IFS="$IFS:"
+	(exit 12)
 	eval $(echo :; false)
 	echo F $?
+	echo -n "G "
+	(exit 12)
+	eval 'echo $?'
+	echo H $?
 expected-stdout:
 	A 0
 	B 1
@@ -5732,6 +5796,8 @@
 	D 0
 	E 0
 	F 0
+	G 12
+	H 0
 ---
 name: exit-trap-1
 description:

This test ensures that $? behaves correctly evan with eval,
and fixes the old test to ensure that the errorlevel 12 does
not leak into $? later.

--- mksh-40.9.20120630/check.t
+++ mksh-40.9.20120630/check.t
@@ -5686,6 +5713,33 @@
 	
 	Stop in WD/zd/a (line 2 of Makefile).
 ---
+name: exit-err-7
+description:
+	"set -e" regression (LP#1104543)
+stdin:
+	set -e
+	bla() {
+		[ -x $PWD/nonexistant ] && $PWD/nonexistant
+	}
+	echo x
+	bla
+	echo y$?
+expected-stdout:
+	x
+expected-exit: 1
+---
+name: exit-err-8
+description:
+	"set -e" regression (Debian #700526)
+stdin:
+	set -e
+	_db_cmd() { return $1; }
+	db_input() { _db_cmd 30; }
+	db_go() { _db_cmd 0; }
+	db_input || :
+	db_go
+	exit 0
+---
 name: exit-enoent-1
 description:
 	SUSv4 says that the shell should exit with 126/127 in some situations
@@ -5743,6 +5809,140 @@
 	hi
 expected-exit: 9
 ---
+name: exit-trap-2
+description:
+	Check that ERR and EXIT traps are run just like ksh93 does.
+	GNU bash does not run ERtrap in ±e eval-undef but runs it
+	twice (bug?) in +e eval-false, so does ksh93 (bug?), which
+	also has a bug to continue execution (echoing "and out" and
+	returning 0) in +e eval-undef.
+file-setup: file 644 "x"
+	v=; unset v
+	trap 'echo EXtrap' EXIT
+	trap 'echo ERtrap' ERR
+	set $1
+	echo "and run $2"
+	eval $2
+	echo and out
+file-setup: file 644 "xt"
+	v=; unset v
+	trap 'echo EXtrap' EXIT
+	trap 'echo ERtrap' ERR
+	set $1
+	echo 'and run true'
+	true
+	echo and out
+file-setup: file 644 "xf"
+	v=; unset v
+	trap 'echo EXtrap' EXIT
+	trap 'echo ERtrap' ERR
+	set $1
+	echo 'and run false'
+	false
+	echo and out
+file-setup: file 644 "xu"
+	v=; unset v
+	trap 'echo EXtrap' EXIT
+	trap 'echo ERtrap' ERR
+	set $1
+	echo 'and run ${v?}'
+	${v?}
+	echo and out
+stdin:
+	runtest() {
+		rm -f rc
+		(
+			"$__progname" "$@"
+			echo $? >rc
+		) 2>&1 | sed \
+		    -e 's/parameter not set/parameter null or not set/' \
+		    -e 's/[[]6]//' -e 's/: eval: line 1//' -e 's/: line 6//' \
+		    -e "s^${__progname%.exe}\.*e*x*e*: <stdin>\[[0-9]*]PROG"
+	}
+	xe=-e
+	echo : $xe
+	runtest x $xe true
+	echo = eval-true $(<rc) .
+	runtest x $xe false
+	echo = eval-false $(<rc) .
+	runtest x $xe '${v?}'
+	echo = eval-undef $(<rc) .
+	runtest xt $xe
+	echo = noeval-true $(<rc) .
+	runtest xf $xe
+	echo = noeval-false $(<rc) .
+	runtest xu $xe
+	echo = noeval-undef $(<rc) .
+	xe=+e
+	echo : $xe
+	runtest x $xe true
+	echo = eval-true $(<rc) .
+	runtest x $xe false
+	echo = eval-false $(<rc) .
+	runtest x $xe '${v?}'
+	echo = eval-undef $(<rc) .
+	runtest xt $xe
+	echo = noeval-true $(<rc) .
+	runtest xf $xe
+	echo = noeval-false $(<rc) .
+	runtest xu $xe
+	echo = noeval-undef $(<rc) .
+expected-stdout:
+	: -e
+	and run true
+	and out
+	EXtrap
+	= eval-true 0 .
+	and run false
+	ERtrap
+	EXtrap
+	= eval-false 1 .
+	and run ${v?}
+	x: v: parameter null or not set
+	ERtrap
+	EXtrap
+	= eval-undef 1 .
+	and run true
+	and out
+	EXtrap
+	= noeval-true 0 .
+	and run false
+	ERtrap
+	EXtrap
+	= noeval-false 1 .
+	and run ${v?}
+	xu: v: parameter null or not set
+	EXtrap
+	= noeval-undef 1 .
+	: +e
+	and run true
+	and out
+	EXtrap
+	= eval-true 0 .
+	and run false
+	ERtrap
+	and out
+	EXtrap
+	= eval-false 0 .
+	and run ${v?}
+	x: v: parameter null or not set
+	ERtrap
+	EXtrap
+	= eval-undef 1 .
+	and run true
+	and out
+	EXtrap
+	= noeval-true 0 .
+	and run false
+	ERtrap
+	and out
+	EXtrap
+	= noeval-false 0 .
+	and run ${v?}
+	xu: v: parameter null or not set
+	EXtrap
+	= noeval-undef 1 .
+---
 name: test-stlt-1
 description:
 	Check that test also can handle string1 < string2 etc.

These are new tests for the “set -e” issue and the trap running issue.


-- System Information:
Debian Release: 7.0
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing'), (490, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/mksh-static

--- End Message ---
--- Begin Message ---
On 2013-03-05 16:16, Thorsten Glaser wrote:
> Package: release.debian.org
> Severity: normal
> User: release.debian.org@packages.debian.org
> Usertags: unblock
> 
> Please unblock package mksh
> 
> unblock mksh/40.9.20120630-7
> 
> (Thanks to Lisandro for his posting on Planet Debian!)
> 
> Dear Release Team,
> 
> please unblock mksh (40.9.20120630-7) for wheezy.
> The debdiff between the two source packages (40.9.20120630-4 currently
> in testing and 40.9.20120630-7 currently in sid) follows, except the
> diff between the debian/patches/debian-changes file was replaced by an
> interdiff between them for better legibility (see #689193 for the
> reason), and I removed changes to the RCS IDs, i.e. lines only changing
> the “$MirOS$” strings, and changes to the copyright years, to get it
> more legible. Then, I sorted changes logically and let each block be
> followed by the explanation for the change.
> 

Thanks for the hint, the interdiff was much easier to review.

> [...]
> 
> The upload will not change the shell language or behaviour, except
> that $? in/after eval is now correct and that the ERR and EXIT traps
> are run at all, once only, and in the correct order, and that set -e
> aborts correctly when a function returned nonzero; all of these are
> regressions against versions of mksh several years old and had been
> introduced by earlier bugfixes, so the interface does not change.
> 
> [...]


Unblocked, thanks.

~Niels

--- End Message ---

Reply to: