spotted a missing substitute() call inside evaluate() call

incl. regression test
This commit is contained in:
tg 2009-08-28 21:35:43 +00:00
parent 1fd4515528
commit dc976e5923
2 changed files with 20 additions and 3 deletions

19
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.299 2009/08/08 13:08:48 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.300 2009/08/28 21:35:42 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 $
@ -5048,6 +5048,23 @@ expected-stdout:
c ä ä c
d 3 d
---
name: varexpand-substr-6
description:
Check that string substitution works correctly
stdin:
foo=1
bar=2
baz=qwertyuiop
echo a ${baz: foo: bar}
echo b ${baz: foo: $bar}
echo c ${baz: $foo: bar}
echo d ${baz: $foo: $bar}
expected-stdout:
a we
b we
c we
d we
---
name: print-funny-chars
description:
Check print builtin's capability to output designated characters

4
eval.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.66 2009/08/28 20:30:55 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.67 2009/08/28 21:35:43 tg Exp $");
/*
* string expansion
@ -385,7 +385,7 @@ expand(const char *cp, /* input word */
&from, KSH_UNWIND_ERROR, true);
afree(stg, ATEMP);
if (end) {
evaluate(stg = wdstrip(mid, false, false),
evaluate(substitute(stg = wdstrip(mid, false, false), 0),
&num, KSH_UNWIND_ERROR, true);
afree(stg, ATEMP);
}