Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [[ is being treated as a pattern in the command/reserved word position.
On Mar 29, 1:33am, ZyX wrote:
} Subject: Re: [[ is being treated as a pattern in the command/reserved word
}
} 29.03.2015, 01:25, "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>:
} >
} > The '[[' reserved word is handled a special kind of built-in alias [*]
} > and the change to POSIX_ALIASES handling caused that to be disabled.
}
} I would say that this is actually an expected behaviour:
} `posh -c '[[ a == a ]]'` will show `posh: [[: not found`
} because `[[` is not in POSIX. Similar error will be shown by dash.
That could be, but POSIX_ALIASES is the wrong way to handle that. If we
wanted to remove the '[[' extension for posix emulation, we should do
`disable -r "[["` instead.
diff --git a/Src/lex.c b/Src/lex.c
index 4d8355b..2e61170 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1794,9 +1794,6 @@ exalias(void)
if (has_token(tokstr)) {
char *p, *t;
- if (isset(POSIXALIASES))
- return 0;
-
zshlextext = p = copy;
for (t = tokstr;
(*p++ = itok(*t) ? ztokens[*t++ - Pound] : *t++););
@@ -1816,7 +1813,7 @@ exalias(void)
if (tok == STRING) {
/* Check for an alias */
- if (checkalias()) {
+ if ((zshlextext != copy || !isset(POSIXALIASES)) && checkalias()) {
if (zshlextext == copy)
zshlextext = tokstr;
return 1;
diff --git a/Test/B07emulate.ztst b/Test/B07emulate.ztst
index 315206a..2de097e 100644
--- a/Test/B07emulate.ztst
+++ b/Test/B07emulate.ztst
@@ -247,3 +247,7 @@
>extendedglob is initially off
>bareglobqual is still on
>extendedglob is on, too
+
+ emulate sh -c '[[ a == a ]]'
+0:regression test for POSIX_ALIASES reserved words
+F:Some reserved tokens are handled in alias expansion
Messages sorted by:
Reverse Date,
Date,
Thread,
Author