mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-17 02:51:01 +02:00
33816, 33819: GLOB_ASSIGN changes integer and floating type variables to string scalars
This commit is contained in:
parent
389954beec
commit
49d6aace41
3 changed files with 37 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2014-11-28 Barton E. Schaefer <schaefer@brasslantern.com>
|
||||||
|
|
||||||
|
* 33819: Test/A06assign.ztst: regression tests for 33816
|
||||||
|
|
||||||
|
* 33816 (2nd part): Src/exec.c: GLOB_ASSIGN changes integer and
|
||||||
|
floating type variables to string scalars rather than treat single
|
||||||
|
match file names as arithmetic expressions
|
||||||
|
|
||||||
2014-11-28 Wayne Davison <wayned@users.sourceforge.net>
|
2014-11-28 Wayne Davison <wayned@users.sourceforge.net>
|
||||||
|
|
||||||
* unposted: avoid compiler warning about a set-but-not-used var.
|
* unposted: avoid compiler warning about a set-but-not-used var.
|
||||||
|
|
10
Src/exec.c
10
Src/exec.c
|
@ -2243,8 +2243,16 @@ addvars(Estate state, Wordcode pc, int addflags)
|
||||||
state->pc = opc;
|
state->pc = opc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isset(GLOBASSIGN) || !isstr)
|
if (!isstr || (isset(GLOBASSIGN) &&
|
||||||
|
haswilds((char *)getdata(firstnode(vl))))) {
|
||||||
globlist(vl, 0);
|
globlist(vl, 0);
|
||||||
|
/* Unset the parameter to force it to be recreated
|
||||||
|
* as either scalar or array depending on how many
|
||||||
|
* matches were found for the glob.
|
||||||
|
*/
|
||||||
|
if (isset(GLOBASSIGN))
|
||||||
|
unsetparam(name);
|
||||||
|
}
|
||||||
if (errflag) {
|
if (errflag) {
|
||||||
state->pc = opc;
|
state->pc = opc;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
# Tests of parameter assignments
|
# Tests of parameter assignments
|
||||||
|
|
||||||
|
%prep
|
||||||
|
mkdir assign.tmp && cd assign.tmp
|
||||||
|
|
||||||
|
touch tmpfile1 tmpfile2
|
||||||
|
|
||||||
%test
|
%test
|
||||||
|
|
||||||
typeset -A assoc
|
typeset -A assoc
|
||||||
|
@ -413,3 +418,18 @@
|
||||||
>world
|
>world
|
||||||
>worldliness
|
>worldliness
|
||||||
>world
|
>world
|
||||||
|
|
||||||
|
integer i n x
|
||||||
|
float f
|
||||||
|
setopt globassign
|
||||||
|
i=tmpfile1
|
||||||
|
n=tmp*
|
||||||
|
x=*2
|
||||||
|
f=2+2
|
||||||
|
typeset -p i n x f
|
||||||
|
0:GLOB_ASSIGN with numeric types
|
||||||
|
>typeset -i i=0
|
||||||
|
>typeset -a n
|
||||||
|
>n=(tmpfile1 tmpfile2)
|
||||||
|
>typeset x=tmpfile2
|
||||||
|
>typeset -E f=4.000000000e+00
|
||||||
|
|
Loading…
Reference in a new issue