zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: [[ is being treated as a pattern in the command/reserved word position.
Date: Sat, 28 Mar 2015 22:44:58 +0000	[thread overview]
Message-ID: <20150328224458.3ab1d39a@ntlworld.com> (raw)
In-Reply-To: <150328152430.ZM18574@torch.brasslantern.com>

On Sat, 28 Mar 2015 15:24:30 -0700
Bart Schaefer <schaefer@brasslantern.com> 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;


  parent reply	other threads:[~2015-03-28 22:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-28 21:08 Eric Cook
2015-03-28 21:18 ` Eric Cook
2015-03-28 21:25 ` Eric Cook
2015-03-28 21:36 ` ZyX
2015-03-28 21:44 ` Bart Schaefer
2015-03-28 21:55   ` Eric Cook
2015-03-28 22:24     ` Bart Schaefer
2015-03-28 22:33       ` ZyX
2015-03-28 22:45         ` Bart Schaefer
2015-03-28 23:07         ` Eric Cook
2015-03-28 23:19           ` ZyX
2015-03-28 23:27             ` Eric Cook
2015-03-28 23:57               ` ZyX
2015-03-29  0:09                 ` Eric Cook
2015-03-28 22:44       ` Peter Stephenson [this message]
2015-03-28 22:48         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150328224458.3ab1d39a@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).