diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Src/subst.c | 15 | ||||
-rw-r--r-- | Test/D04parameter.ztst | 2 |
3 files changed, 18 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog index b71da9a51..73121da47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-04-20 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 27889: Src/subst.c, Test/D04parameter.ztst: Force more use of + GLOB_SUBST in parameters if ~ is used. + 2010-04-20 Peter Stephenson <pws@csr.com> * "Akinori MUSHA: 27892: Completion/Redhat/Command/.distfiles, @@ -13040,5 +13045,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.4959 $ +* $Revision: 1.4960 $ ***************************************************** diff --git a/Src/subst.c b/Src/subst.c index 6da9bfed8..80a56410a 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -1386,7 +1386,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) int plan9 = isset(RCEXPANDPARAM); /* * Likwise, but with ~ and ~~. Also, we turn it off later - * on if qt is passed down. + * on if qt is passed down. The value can go to 2 if we + * use ~ to force this on. */ int globsubst = isset(GLOBSUBST); /* @@ -1899,12 +1900,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) * spsep, NULL means $IFS. */ } else if (c == '~' || c == Tilde) { - /* GLOB_SUBST on or off (doubled) */ + /* GLOB_SUBST (forced) on or off (doubled) */ if ((c = *++s) == '~' || c == Tilde) { globsubst = 0; s++; } else - globsubst = 1; + globsubst = 2; } else if (c == '+') { /* * Return whether indicated parameter is set. @@ -1935,7 +1936,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) break; } /* Don't activate special pattern characters if inside quotes */ - globsubst = globsubst && !qt; + if (qt) + globsubst = 0; /* * At this point, we usually expect a parameter name. @@ -2417,7 +2419,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) multsub(&val, spbreak && !aspar, (aspar ? NULL : &aval), &isarr, NULL); opts[SHWORDSPLIT] = ws; copied = 1; - spbreak = globsubst = 0; + spbreak = 0; + /* Leave globsubst on if forced */ + if (globsubst != 2) + globsubst = 0; } break; case ':': diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 1035fd49b..13a7af2e4 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -226,10 +226,12 @@ foo="boring*" print ${foo+$foo} print ${foo+"$foo"} + print ${~foo+"$foo"} ) 0:globsubst together with nested quoted expansion >boringfile >boring* +>boringfile print -l "${$(print one word)}" "${=$(print two words)}" 0:splitting of $(...) inside ${...} |