in ${foo=bar}, “bar” must be scalar context; spotted by Martijn Dekker

This commit is contained in:
tg 2017-02-17 22:40:13 +00:00
parent 287507fb21
commit 7b02f1ec8d
3 changed files with 25 additions and 8 deletions

25
check.t
View File

@ -1,8 +1,8 @@
# $MirOS: src/bin/mksh/check.t,v 1.756 2016/11/11 23:31:31 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.757 2017/02/17 22:40:09 tg Exp $
# -*- mode: sh -*- # -*- mode: sh -*-
#- #-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014, 2015, 2016 # 2011, 2012, 2013, 2014, 2015, 2016, 2017
# mirabilos <m@mirbsd.org> # mirabilos <m@mirbsd.org>
# #
# Provided that these terms and disclaimer and all copyright notices # Provided that these terms and disclaimer and all copyright notices
@ -30,7 +30,7 @@
# (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date # (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R54 2016/11/11 @(#)MIRBSD KSH R54 2017/02/17
description: description:
Check version of shell. Check version of shell.
stdin: stdin:
@ -39,7 +39,7 @@ name: KSH_VERSION
category: shell:legacy-no category: shell:legacy-no
--- ---
expected-stdout: expected-stdout:
@(#)LEGACY KSH R54 2016/11/11 @(#)LEGACY KSH R54 2017/02/17
description: description:
Check version of legacy shell. Check version of legacy shell.
stdin: stdin:
@ -4711,6 +4711,23 @@ expected-stdout:
8 ok 8 ok
<9> <ab> <a b> . <9> <ab> <a b> .
--- ---
name: IFS-subst-10
description:
Scalar context in ${var=$subst}
stdin:
showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
set -- one "two three" four
unset -v var
save_IFS=$IFS
IFS=
set -- ${var=$*}
IFS=$save_IFS
echo "var=$var"
showargs "$@"
expected-stdout:
var=onetwo threefour
<onetwo threefour> .
---
name: IFS-arith-1 name: IFS-arith-1
description: description:
http://austingroupbugs.net/view.php?id=832 http://austingroupbugs.net/view.php?id=832

4
eval.c
View File

@ -23,7 +23,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.196 2017/02/17 21:15:55 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/eval.c,v 1.197 2017/02/17 22:40:12 tg Exp $");
/* /*
* string expansion * string expansion
@ -640,7 +640,7 @@ expand(
*/ */
if (!(x.var->flag & INTEGER)) if (!(x.var->flag & INTEGER))
f |= DOASNTILDE | DOTILDE; f |= DOASNTILDE | DOTILDE;
f |= DOTEMP; f |= DOTEMP | DOSCALAR;
/* /*
* These will be done after the * These will be done after the
* value has been assigned. * value has been assigned.

4
sh.h
View File

@ -175,9 +175,9 @@
#endif #endif
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.791 2016/11/11 23:31:38 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.792 2017/02/17 22:40:13 tg Exp $");
#endif #endif
#define MKSH_VERSION "R54 2016/11/11" #define MKSH_VERSION "R54 2017/02/17"
/* arithmetic types: C implementation */ /* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES #if !HAVE_CAN_INTTYPES