Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID
	autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;
        h=from:message-id:date:in-reply-to:comments:references:to:subject
         :mime-version:content-type;
        bh=uZSYi1m+HJ88kFx9pDaKhWNxSLYZuEsOrDWam9rsJV0=;
        b=Vp3T5V6mmp++Ry/7o9+g8A9P3k6/CiXmQl5yMcayMcHelEHA0vir6iESPgzpl+NI/T
         kFozCfyOF4nWnDzwBt2MtajbNHZjGK/xEEukoMDFqqii88hlZdbXIAdwaB2PyK9Awo4B
         0zoimd/pk2u9Wu6qFJlpbQiL7+UH9WRSOQqh1KRsRUDDYtAwgXC+EvQieYaGU+AiWibM
         91lQNe7qfLo94mHVcNE0fQiIB3bCiSZVo0uNS9LGZckx9ED8AL4lf/+Xd6VkJ1rnwLKL
         gvaP+I31bZ+zm0GgBj21IUOHhVcJRl+ULgQaOhITduJ04UqJAAYOiaqaoPzO9fzHuWmS
         zApA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:date:in-reply-to:comments
         :references:to:subject:mime-version:content-type;
        bh=uZSYi1m+HJ88kFx9pDaKhWNxSLYZuEsOrDWam9rsJV0=;
        b=ZSubs0v9KYySMUWmmAW6kjfsUMtf9bMlau5qz5tjUtHtE4vrdC1a5R9I3IbO9wFmq8
         gZwaIaZPXSRNXJ80BOh9ueYbjLmy5NKBygFZ20QWuYQak6vF/xBxaJdg3kxyEyx3KcVl
         7do12oCrUxI3SkfCKyuQkcLFjp63B/mqs6fmjzBf7Gw7eh2Z/RvtNs52E8lBcHB09oX4
         l/oBfUesSb6xxMWXJiQvBjyD9j6L3spnvAqCjR/UM7NrmhOQtAyg3giNu/h0X2IUqWPE
         8We74b7l5u1yQKyUikLreHNx2jq/Q2R2QPKq4ncBpeNiouzOLEbbtQtCco3zZNZNuK/1
         K8xA==
X-Gm-Message-State: AG10YOQ0lJu/5jmEQcqHj0RqkXdD+B1h/+7BRgsRLc6fMudR+jPa34Oxmw+VtpmfjY0AHQ==
X-Received: by 10.66.218.73 with SMTP id pe9mr36562281pac.91.1454872594638;
        Sun, 07 Feb 2016 11:16:34 -0800 (PST)
From: Bart Schaefer <schaefer@brasslantern.com>
Message-Id: <160207111638.ZM30626@torch.brasslantern.com>
Date: Sun, 7 Feb 2016 11:16:38 -0800
In-Reply-To: <CAHYJk3QRVQ893fMP+4CmdapK10vx5gP581pY358KSQdR1-sZuQ@mail.gmail.com>
Comments: In reply to Mikael Magnusson <mikachu@gmail.com>
        "Unexpected foo==bar errors" (Feb  7,  4:57pm)
References: <CAHYJk3QRVQ893fMP+4CmdapK10vx5gP581pY358KSQdR1-sZuQ@mail.gmail.com>
X-Mailer: OpenZMail Classic (0.9.2 24April2005)
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: Unexpected foo==bar errors
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Seq: zsh-workers 37908

On Feb 7,  4:57pm, Mikael Magnusson wrote:
}
} I always thought of EQUALS expansion as a form of globbing; should it
} be enabled in these contexts even though regular globbing isn't?

It's expansion, like with a leading tilde, not globbing, so GLOB_ASSIGN
doesn't apply here at all.

MAGIC_EQUAL_SUBST has never controlled expansion occurring in parameter
assignments, it only controls whether expansion occurs in normal command
arguments that LOOK LIKE assignments.

torch% bar==echo
torch% print $bar
/bin/echo
torch% print foo==echo
foo==echo
torch% setopt magicequalsubst
torch% print foo==echo       
foo=/bin/echo
torch% setopt no_equals
torch% print foo==echo    
foo==echo
torch% bar==echo
torch% print $bar
=echo
torch% 

} _tar:70 is
} tf=${~words[3]}

Ooh, that's a fun one: (foo) is being taken as glob qualifiers, which is
a larger problem in this case than the expansion of "=".  Then because
globassign is off, the equals expansion (on the empty string) is done,
but the qualifiers are never applied to the result.

If you "setopt shfileexpansion" so that equals applies after globbing
instead of before, the assignment behaves more sensibly, but:

The only use of $tf as far as I can see is to do lookups in the cache.
The apparent intent is to canonicalize the cache name to avoid "tar -tf"
of the same tar file more than once.  That optimization may not be worth
the buggy attempt at expansion, and caching the result of =(command) may
not be the best idea in the first place.

I'm not sure exactly what fix to suggest.

