Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] _gpg: Use explicit UIDs for public / secret keys.
- X-seq: zsh-workers 42941
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Doron Behar <doron.behar@xxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: [PATCH] _gpg: Use explicit UIDs for public / secret keys.
- Date: Thu, 07 Jun 2018 06:40:14 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=k+mRin zLbwaXz6h1+WY8hZaZ5lbP2Fe/4s0zX/SyN6M=; b=hO1wz29XLdPNBI6Yz0XIkI zMBdDu6kAvR0ovihrJ2mFkDKALy0l/fk2UX4mQK4vG5rBzpJToQpOPXwSiPTSqzg z5RVE2+PQm7yOJ0I7f7xBNXCFYrQy0yi92+Mfl3hcbwlEXeuPVO9jaAp+jBjSETz sC/G/lMMf6SdcIDEFbmhlBfj7dXzyjJR3zqVKz+jF75T3GAq+vNdvAZxv14v41mQ St08iGwI3S4vRZQAoklJS2hRIN6IPfJlDMLnTx52M6I40wvCHPjm2T1fhj4Swrdw vYL3tWX7c5xWmt5vi6BS60Gj6mR+yUpqFaZGACrxo6esxCNRSPV/dVeL/7DglXfg ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=k+mRin zLbwaXz6h1+WY8hZaZ5lbP2Fe/4s0zX/SyN6M=; b=FIavD2DUzXNhdUM2t3vT8d MO/yaLiXmPxT37BGBFa6mW5EzQgC/9RXjtPLIkIcDB7jiCkETOtcYtOoXR1J+8a5 ibAlqGAQWvj7ZPbZX38ZsyfvTw6til52l0bWJUh7MiIQpaXket5ZZe1hSIkOBqyX WZge0GoRUwqEJv5opBBYmHmbsKutvY8MLu3vBpCxugeebhjpwBYCQqjpQSpfQ1h2 3+C2ybeQuT/iif2mBNumLsXmEaB+QPyz6WRFc+hVu8Day0yRC5QkayCE40UxEWv5 VqQIwwnkuAxmr6TbAKOh+kdC8kfAWoQiyWVzQ4MY8eG8N3b4i2H4hh3W3Hf56UCw ==
- In-reply-to: <20180605154751.6jx27re6d3pgdgxd@NUC.doronbehar.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180602152651.16904-1-doron.behar@gmail.com> <20180603214350.a247lk4n6lbbz56l@tarpaulin.shahaf.local2> <20180605154751.6jx27re6d3pgdgxd@NUC.doronbehar.com>
Doron Behar wrote on Tue, 05 Jun 2018 18:47 +0300:
> On Sun, Jun 03, 2018 at 09:43:50PM +0000, Daniel Shahaf wrote:
> > doron.behar@xxxxxxxxx wrote on Sat, Jun 02, 2018 at 18:26:51 +0300:
> > > From: Doron Behar <doron.behar@xxxxxxxxx>
> > >
> > > Use the `--with-colons` option and parse the output.
> > > ---
> > > Completion/Unix/Command/_gpg | 69 ++++++++++++++++++++++++++++++++----
> > > 1 file changed, 63 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg
> > > index 48a36eff2..7e707c5f6 100644
> > > --- a/Completion/Unix/Command/_gpg
> > > +++ b/Completion/Unix/Command/_gpg
> > > @@ -206,20 +206,77 @@ fi
> > >
> > > case "$state" in
> > > public-keys)
> > > - _wanted public-keys expl 'public key' \
> > > - compadd ${${(Mo)$(_call_program public-keys $words[1] $needed --list-public-keys --list-options no-show-photos):%<*>}//(<|>)/} && return
> > > + local public_keys=(${(@s.:.)$(_call_program public-keys eval IFS=$'\n' $words[1] $needed --list-public-keys --list-options no-show-photos --with-colons)})
> >
> > This isn't quite right.
> >
> > The first argument to «eval» here is the five bytes «IFS=\n» (where \n stands
> > for an 0x0A byte), so the eval'd code sets IFS to the empty string, not to the
> > one-byte string $'\n', and the assignment isn't specific to the command either.
> >
> > I'm not sure what value you _meant_ to set IFS to. If you meant to set it to a
> > newline, you could do something like this:
> >
> > …$(_call_program public-keys eval IFS=${(q):-$'\n'} ${(q)words[1]} ${(q)needed} --list-public-keys --list-options no-show-photos --with-colons)…
> >
> > I also added (q) to the other variable expansions.
>
> Actually, I've mistakenly sent the patch with eval, I got confused with
> `env` which was my original intention. Both using my original version
> with `env` instead of `eval` and your version with the quoted IFS work,
> what shall it be?
IFS should never be exported, so use eval please.
Please use double escaping, though (that is, ${(q)${(q)foo}}: that's needed since
_call_program does an eval anyway, in addition to the one you spell out
in _call_program's arguments.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author