summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-11-18 10:07:31 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-11-18 10:07:31 +0000
commit14231691e15744c0aac39224e9aa0d84835313fe (patch)
tree27682b81236d64e641f4bb476ff710dc84e968c4
parent0d0e497c693939633fda6cfa0c3269258b8e97ec (diff)
downloadzsh-14231691e15744c0aac39224e9aa0d84835313fe.tar.gz
zsh-14231691e15744c0aac39224e9aa0d84835313fe.zip
26061: fix clash between process subst and numeric glob
26062: additional compmatch change, missed from 26047
-rw-r--r--ChangeLog8
-rw-r--r--Src/Zle/compmatch.c3
-rw-r--r--Src/lex.c4
-rw-r--r--Src/parse.c9
-rw-r--r--Src/subst.c5
-rw-r--r--Src/zsh.h19
-rw-r--r--Test/D02glob.ztst6
7 files changed, 35 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index fede2f8e1..14133be43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-18 Peter Stephenson <pws@csr.com>
+
+ * 26062: Src/Zle/compmatch.c: missed change needed with 26047.
+
+ * 26061: Src/lex.c, Src/parse.c, Src/subst.c, Src/zsh.h,
+ Test/D02glob.ztst: fix clashes between numeric glob and
+ process substitution such as "<->(N)".
+
2008-11-17 Peter Stephenson <pws@csr.com>
* 26056: Doc/Zsh/expn.yo, Src/exec.c: < <(...)more_stuff is
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index 77dc5958d..c4523ae47 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -1812,7 +1812,6 @@ bld_line(Cmatcher mp, ZLE_STRING_T line, char *mword, char *word,
/* we now reuse mp, lpat, wpat for the global matchers */
MB_METACHARINIT();
while (llen && wlen) {
- convchar_t wchr;
int wmtp;
convchar_t *wp;
Cpattern tmpgenpat;
@@ -1835,7 +1834,7 @@ bld_line(Cmatcher mp, ZLE_STRING_T line, char *mword, char *word,
if (curgenpat->tp == CPAT_CHAR)
lchr = curgenpat->u.chr;
else
- lchr = wchr;
+ lchr = *wp;
if (sfx)
*--line = lchr;
diff --git a/Src/lex.c b/Src/lex.c
index f5999d798..b66630acc 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -33,7 +33,7 @@
/* tokens */
/**/
-mod_export char ztokens[] = "#$^*()$=|{}[]`<>?~`,'\"\\\\";
+mod_export char ztokens[] = "#$^*()$=|{}[]`<>>?~`,'\"\\\\";
/* parts of the current token */
@@ -1160,7 +1160,7 @@ gettokstr(int c, int sub)
lexstop = 0;
goto brk;
}
- add(Outang);
+ add(OutangProc);
if (skipcomm()) {
peek = LEXERR;
goto brk;
diff --git a/Src/parse.c b/Src/parse.c
index 6ff73a831..722809a78 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -1574,7 +1574,7 @@ par_simple(int *complex, int nr)
* we need process handling.
*/
if (p[1] == Inpar &&
- (*p == Equals || *p == Inang || *p == Outang)) {
+ (*p == Equals || *p == Inang || *p == OutangProc)) {
*complex = 1;
break;
}
@@ -1833,7 +1833,7 @@ par_redir(int *rp, char *idstring)
}
case REDIR_WRITE:
case REDIR_WRITENOW:
- if (tokstr[0] == Outang && tokstr[1] == Inpar)
+ if (tokstr[0] == OutangProc && tokstr[1] == Inpar)
/* > >(...) */
type = REDIR_OUTPIPE;
else if (tokstr[0] == Inang && tokstr[1] == Inpar)
@@ -1843,11 +1843,12 @@ par_redir(int *rp, char *idstring)
if (tokstr[0] == Inang && tokstr[1] == Inpar)
/* < <(...) */
type = REDIR_INPIPE;
- else if (tokstr[0] == Outang && tokstr[1] == Inpar)
+ else if (tokstr[0] == OutangProc && tokstr[1] == Inpar)
YYERROR(ecused);
break;
case REDIR_READWRITE:
- if ((tokstr[0] == Inang || tokstr[0] == Outang) && tokstr[1] == Inpar)
+ if ((tokstr[0] == Inang || tokstr[0] == OutangProc) &&
+ tokstr[1] == Inpar)
type = tokstr[0] == Inang ? REDIR_INPIPE : REDIR_OUTPIPE;
break;
}
diff --git a/Src/subst.c b/Src/subst.c
index a8f894c68..42f880965 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -152,12 +152,13 @@ stringsubst(LinkList list, LinkNode node, int ssub, int asssub)
char *str = str3, c;
while (!errflag && (c = *str)) {
- if (((c = *str) == Inang || c == Outang || (str == str3 && c == Equals))
+ if (((c = *str) == Inang || c == OutangProc ||
+ (str == str3 && c == Equals))
&& str[1] == Inpar) {
char *subst, *rest, *snew, *sptr;
int str3len = str - str3, sublen, restlen;
- if (c == Inang || c == Outang)
+ if (c == Inang || c == OutangProc)
subst = getproc(str, &rest); /* <(...) or >(...) */
else
subst = getoutputfile(str, &rest); /* =(...) */
diff --git a/Src/zsh.h b/Src/zsh.h
index 12dee443f..36755c719 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -147,28 +147,29 @@ struct mathfunc {
#define Tick ((char) 0x91)
#define Inang ((char) 0x92)
#define Outang ((char) 0x93)
-#define Quest ((char) 0x94)
-#define Tilde ((char) 0x95)
-#define Qtick ((char) 0x96)
-#define Comma ((char) 0x97)
+#define OutangProc ((char) 0x94)
+#define Quest ((char) 0x95)
+#define Tilde ((char) 0x96)
+#define Qtick ((char) 0x97)
+#define Comma ((char) 0x98)
/*
* Null arguments: placeholders for single and double quotes
* and backslashes.
*/
-#define Snull ((char) 0x98)
-#define Dnull ((char) 0x99)
-#define Bnull ((char) 0x9a)
+#define Snull ((char) 0x99)
+#define Dnull ((char) 0x9a)
+#define Bnull ((char) 0x9b)
/*
* Backslash which will be returned to "\" instead of being stripped
* when we turn the string into a printable format.
*/
-#define Bnullkeep ((char) 0x9b)
+#define Bnullkeep ((char) 0x9c)
/*
* Null argument that does not correspond to any character.
* This should be last as it does not appear in ztokens and
* is used to initialise the IMETA type in inittyptab().
*/
-#define Nularg ((char) 0x9c)
+#define Nularg ((char) 0x9d)
/*
* Take care to update the use of IMETA appropriately when adding
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index d5f654a71..74f933842 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -386,3 +386,9 @@
[[ foo = (#c0)foo ]]
1:Misplaced (#c...) flag
?(eval):1: bad pattern: (#c0)foo
+
+ mkdir glob.tmp/dir5
+ touch glob.tmp/dir5/N123
+ print glob.tmp/dir5/N<->(N)
+0:Numeric glob is not usurped by process substitution.
+>glob.tmp/dir5/N123