diff --git a/check.t b/check.t index 02ec8d6..5547653 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.647 2014/05/29 21:30:45 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.648 2014/06/09 10:41:01 tg Exp $ # OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44 #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -3726,7 +3726,6 @@ expected-stdout: name: IFS-subst-2 description: Check leading whitespace after trim does not make a field -expected-fail: yes stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } x="X 1 2" diff --git a/eval.c b/eval.c index 8b490a2..faabb82 100644 --- a/eval.c +++ b/eval.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.148 2014/05/27 13:00:30 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.149 2014/06/09 10:41:03 tg Exp $"); /* * string expansion @@ -702,10 +702,11 @@ expand( */ x.str = trimsub(str_val(st->var), dp, st->stype); - if (quote || x.str[0] != '\0') + if (x.str[0] != '\0') { + word = IFS_WS; type = XSUB; - else - type = XNULLSUB; + } else + type = quote ? XSUB : XNULLSUB; if (f&DOBLANK) doblank++; st = st->prev; @@ -796,9 +797,11 @@ expand( if (f&DOBLANK) { doblank--; /* - * not really correct: x=; "$x$@" should - * generate a null argument and - * set A; "${@:+}" shouldn't. + * XXX not really correct: + * x=; "$x$@" + * should generate a null argument and + * set A; "${@:+}" + * shouldn't. */ if (dp == Xstring(ds, dp)) word = IFS_WS;