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,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc:content-type;
        bh=4XI6WYTj3RwI3cZ2k4oqweohAPR8+DGOx1yig1AQz9Q=;
        b=Oe2lvwjg2kMKz6muH3Mr8Nkg+NYhSskoEsSBXATijGqBJg1M9HDGYxTqASGQZBKDse
         gv1MbUumQMPPu/XEkcpdomLxcFBzrrmX8q+hP+RPaxoMuFY2RUaOj5GK4F+Zvlfbvk7P
         wTVbOXsZROqs3M0k13vOHR8OR0hYFNWHDJjKvJQcLJ4BNehK6R78jRPAKjj7qPXp059A
         7dvCtIe2UX5bn5IU5+//VYRSKz/SvpxM1cZcE+C+cUQlIfc2/xoPYVpFGrx1jye9lZjQ
         U3euF2rb+7JPf/FuQABy1H1xawdtX99PM0mUXN0kZ3NSDeBADfvUYvf0WgpD9KwxqcV8
         4X5g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:cc:content-type;
        bh=4XI6WYTj3RwI3cZ2k4oqweohAPR8+DGOx1yig1AQz9Q=;
        b=EuFjMkfWUfMWsdjQhs8zvZNx77z9JQ03RiZVZ4sjMBSD/sEeQk0kWKwN0tmdFBf/Uc
         xsnIbQcOAL3Ki32DuCLPON4j9HWRnvAyb5oGdp9atDrhAWnUOmswgZpyP0N1la/zQhh4
         mIcVre1uaKfm1eJxjioxsPNPx8G9wpagKGNXRBZslSgM0siqc0hfFAgW//EiGCr9N/uy
         2rL3UMMZOyhX/QmxxKw0wSLYgjJK7EfHKULB95p/A7j2et27A9hnfredNxAeNle96oCy
         8k0jqmIMJGiXv5xve7Wv1S3L468j/BfnTPVgFAov40oojSDepccwZAy9434Xxutigsd3
         rYcQ==
X-Gm-Message-State: AG10YORyxj1ibyUhVFBOfd9dcjRKAyGXttNqi3uB0/4pXu+8In8uS7xL8/e4aNT4D13T9/PSOC58y1ld0ca9fw==
MIME-Version: 1.0
X-Received: by 10.140.165.205 with SMTP id l196mr19827809qhl.58.1454903574062;
 Sun, 07 Feb 2016 19:52:54 -0800 (PST)
In-Reply-To: <160207111638.ZM30626@torch.brasslantern.com>
References: <CAHYJk3QRVQ893fMP+4CmdapK10vx5gP581pY358KSQdR1-sZuQ@mail.gmail.com>
	<160207111638.ZM30626@torch.brasslantern.com>
Date: Mon, 8 Feb 2016 04:52:54 +0100
Message-ID: <CAHYJk3S-Vj24041msXn6f8w3DM1pbv2uooxHUF3F=Ou8od_PxQ@mail.gmail.com>
Subject: Re: Unexpected foo==bar errors
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh workers <zsh-workers@zsh.org>
Content-Type: text/plain; charset=UTF-8
X-Seq: zsh-workers 37911

On Sun, Feb 7, 2016 at 8:16 PM, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 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.

Ah yes, you're right; I also get errors if I do
% tar tf ~blurg <tab>
_tar:70: no such user or named directory: blurg

> 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.
[...]
> } _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.

Presumably at some point the given filename has to be interpreted so
that it can give any completions at all, even if it's not cached? I
didn't look closely at the rest of the completer though.

> I'm not sure exactly what fix to suggest.

I wonder if there's anywhere in the completion system that depends on
EQUALS being set... But maybe we should just 2> /dev/null the
assignment since tilde expansion also prints errors. (_zattr and _zip
also have this issue, presumably there are other places as well).

-- 
Mikael Magnusson

