mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-22 12:31:26 +01:00
28360: NO_UNSET option should check parameters with trailing options
This commit is contained in:
parent
91564ce04c
commit
3f3d80c394
3 changed files with 36 additions and 4 deletions
|
@ -1,5 +1,8 @@
|
|||
2010-10-22 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 28360: Src/subst.c, Test/E01options.ztst: NO_UNSET option
|
||||
should test parameters with following operators, too.
|
||||
|
||||
* not quite posted: Completion/Unix/Command/_screen: better to
|
||||
allow sessions to be completed after -S.
|
||||
|
||||
|
@ -13778,5 +13781,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5112 $
|
||||
* $Revision: 1.5113 $
|
||||
*****************************************************
|
||||
|
|
|
@ -2649,8 +2649,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
|||
}
|
||||
getmatcharr(&aval, s, flags, flnum, replstr);
|
||||
} else {
|
||||
if (vunset)
|
||||
if (vunset) {
|
||||
if (unset(UNSET)) {
|
||||
*idend = '\0';
|
||||
zerr("%s: parameter not set", idbeg);
|
||||
return NULL;
|
||||
}
|
||||
val = dupstring("");
|
||||
}
|
||||
if (!copied) {
|
||||
val = dupstring(val);
|
||||
copied = 1;
|
||||
|
|
|
@ -998,7 +998,7 @@
|
|||
>two
|
||||
>words
|
||||
|
||||
fn() { unset foo; print $foo; }
|
||||
fn() { unset foo; print value is $foo; }
|
||||
setopt nounset
|
||||
print option unset unset by setting nounset
|
||||
eval fn
|
||||
|
@ -1008,9 +1008,32 @@
|
|||
0:UNSET option
|
||||
>option unset unset by setting nounset
|
||||
>option unset reset
|
||||
>
|
||||
>value is
|
||||
?fn: foo: parameter not set
|
||||
|
||||
fn1() { unset foo; print value 1 is ${foo#bar}; }
|
||||
fn2() { unset foo; print value 2 is ${foo%bar}; }
|
||||
fn3() { unset foo; print value 3 is ${foo/bar}; }
|
||||
setopt nounset
|
||||
print option unset unset by setting nounset
|
||||
eval fn1
|
||||
eval fn2
|
||||
eval fn3
|
||||
print option unset reset
|
||||
setopt unset
|
||||
fn1
|
||||
fn2
|
||||
fn3
|
||||
0:UNSET option with operators
|
||||
>option unset unset by setting nounset
|
||||
>option unset reset
|
||||
>value 1 is
|
||||
>value 2 is
|
||||
>value 3 is
|
||||
?fn1: foo: parameter not set
|
||||
?fn2: foo: parameter not set
|
||||
?fn3: foo: parameter not set
|
||||
|
||||
fn() {
|
||||
emulate -L zsh
|
||||
setopt warncreateglobal
|
||||
|
|
Loading…
Reference in a new issue