commit patch from LP#1381965 and two testcases, one showing this is fixed,

another showing deeper problems (probably LP#1381993 “non-list contexts” or
the IFS_WS/IFS_IWS story, perhaps *all* IFS_WS (not just ternaries) really
should be IFS_IWS instead?)
This commit is contained in:
tg 2014-10-19 20:56:33 +00:00
parent 996e05548a
commit 2fd0482761
3 changed files with 36 additions and 9 deletions

35
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.663 2014/10/12 19:54:58 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.664 2014/10/19 20:56:30 tg Exp $
# OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -27,7 +27,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R50 2014/10/12
@(#)MIRBSD KSH R50 2014/10/19
description:
Check version of shell.
stdin:
@ -36,7 +36,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R50 2014/10/12
@(#)LEGACY KSH R50 2014/10/19
description:
Check version of legacy shell.
stdin:
@ -3751,7 +3751,7 @@ stdin:
expected-stdout:
<1> <shift> <1> <2>
---
name: IFS-subst-3
name: IFS-subst-3-arr
description:
Check leading IFS non-whitespace after trim does make a field
but leading IFS whitespace does not, nor empty replacements
@ -3767,6 +3767,33 @@ expected-stdout:
<1> <> <foo> <bar>
<2> <foo> <bar>
---
name: IFS-subst-3-ass
description:
Check non-field semantics
expected-fail: yes
stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; }
showargs 0 x=${-+}
IFS=:
showargs 1 x=${-+:foo:bar}
IFS=' '
showargs 2 x=${-+ foo bar}
expected-stdout:
<0> <x=>
<1> <x=> <foo> <bar>
<2> <x=> <foo> <bar>
---
name: IFS-subst-3-lcl
description:
Check non-field semantics, smaller corner case (LP#1381965)
stdin:
set -x
local regex=${2:-}
exit 1
expected-exit: e != 0
expected-stderr-pattern:
/regex=/
---
name: IFS-subst-4-1
description:
reported by mikeserv

6
eval.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.153 2014/10/07 15:22:16 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.154 2014/10/19 20:56:32 tg Exp $");
/*
* string expansion
@ -631,7 +631,7 @@ expand(
*/
if (!Flag(FSH)) {
*dp++ = MAGIC;
*dp++ = '@' | 0x80;
*dp++ = 0x80 | '@';
}
break;
case '=':
@ -664,7 +664,7 @@ expand(
f |= DOTEMP;
/* FALLTHROUGH */
default:
word = quote ? IFS_WORD : IFS_IWS;
word = quote || (!*x.str && (f & DOASNFIELD)) ? IFS_WORD : IFS_WS;
/* Enable tilde expansion */
tilde_ok = 1;
f |= DOTILDE;

4
sh.h
View File

@ -169,9 +169,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.699 2014/10/12 21:58:53 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.700 2014/10/19 20:56:33 tg Exp $");
#endif
#define MKSH_VERSION "R50 2014/10/12"
#define MKSH_VERSION "R50 2014/10/19"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES