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 Sat, 28 Mar 2015 15:24:30 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Mar 28,  5:55pm, Eric Cook wrote:
> }
> } % print $ZSH_PATCHLEVEL; emulate sh -c '[[ a == a ]]'
> } zsh-5.0.7-362-gab40656
> } zsh: command not found: [[
> } 
> } Did that behavior change?
> 
> Aha.  That makes more sense.
> 
> The '[[' reserved word is handled a special kind of built-in alias [*]
> and the change to POSIX_ALIASES handling caused that to be disabled.
> 
> This will take a bit of thought.

Is this good enough?

Looks like we need some more emulation tests for POSIX_ALIASES.

pws

diff --git a/Src/lex.c b/Src/lex.c
index 6d0079c..4758354 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1789,13 +1789,14 @@ exalias(void)
 	    return 0;
 	return checkalias();
     } else {
+	int noalias = 0;
 	VARARR(char, copy, (strlen(tokstr) + 1));
 
 	if (has_token(tokstr)) {
 	    char *p, *t;
 
 	    if (isset(POSIXALIASES))
-		return 0;
+		noalias = 1;
 
 	    zshlextext = p = copy;
 	    for (t = tokstr;
@@ -1816,7 +1817,7 @@ exalias(void)
 
 	if (tok == STRING) {
 	    /* Check for an alias */
-	    if (checkalias()) {
+	    if (!noalias && checkalias()) {
 		if (zshlextext == copy)
 		    zshlextext = tokstr;
 		return 1;



Messages sorted by: Reverse Date, Date, Thread, Author