From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25099 invoked by alias); 7 Jun 2018 15:50:14 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42944 Received: (qmail 13224 invoked by uid 1010); 7 Jun 2018 15:50:14 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f65.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.65):SA:0(-1.9/5.0):. Processed in 1.651227 secs); 07 Jun 2018 15:50:14 -0000 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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: doron.behar@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=f0hSwtmILF0Ah6H1eAx+mn6RfcsuKkVD4IG+qk+ut3Y=; b=D4wDX+8AyK9EfVOIxJb0dMEElxMGL8IOYuz2VNhPHihu3U9365PrNeMUN/gI/crE+E B5Eru5le/IO82ZL8WUnz4y1Efh8ataGPlk+LzT69nPvyygFXZP7momKckJQNaXTPq/OX SV8wpXlJ4U9GfSpDT3/bXuSmQM6zEfhcDsVXFcjnMpsPNw8ktPiu96Fo7cyMkKwUJTac TrADq/5uVNUhDzvIRtSIdITFFiVydutc9b3MCVt1ybrnLdXgKFvHupDzxsT47iz9jdZz 5Nr1bqjB03REHoO6cPb9m37tEFKl9ZygScirRxcbIdwlDWig/9Vumdb2Q9Ew6eJ/7Ldz Jy2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=f0hSwtmILF0Ah6H1eAx+mn6RfcsuKkVD4IG+qk+ut3Y=; b=q8MEog9hXoTfCKWoaSxqPSIjpBdupONDKOTI+mqACpH+aVZzeduleMiU2sVvM0OrvI oH+3c83se8dhlZx8XYT3GMeVdKTnjirIM1O60PfTzpkpfarp5mNqDCGRWhfKGCt+VB3s jdRXSOgUqXpiGMhrS6vuGrlFCtk6UL6lZcFwAORcXAQAOJgn2P1K8cSC5IShsh9Wwn0w yUjZlGF9bPggBh8ILospINPdi817ARvzuv6B002Olw0yvT9t0nebYlLSWNOQT8FsVo13 2ALriQF+6o7+lmkU5BEg4/bxjpUgJuHsZsGCX1NNWeU31Us25Xe8hE9khGuqmzJL2VhJ kXlQ== X-Gm-Message-State: APt69E2UzD6s+0kak/JznjHCIbPNzjqgRnyypzBiSVqUbZT3tQJ3I02k D5UeoYd7m1IcEUrNx4d19Pyrijdf X-Google-Smtp-Source: ADUXVKLvYiUA+n0vsp77sb/O/uzamheUZpD45Sp9Kr1vPAgnrExYEufcQwwvyh1RL3ivL254GGrLyg== X-Received: by 2002:a1c:6803:: with SMTP id d3-v6mr2169449wmc.70.1528386609121; Thu, 07 Jun 2018 08:50:09 -0700 (PDT) Date: Thu, 7 Jun 2018 18:50:00 +0300 From: Doron Behar To: zsh-workers@zsh.org Subject: Re: [PATCH] _gpg: Use explicit UIDs for public / secret keys. Message-ID: <20180607155000.34jtyw25ss6e4baj@NUC.doronbehar.com> Mail-Followup-To: zsh-workers@zsh.org References: <20180602152651.16904-1-doron.behar@gmail.com> <20180603214350.a247lk4n6lbbz56l@tarpaulin.shahaf.local2> <20180605154751.6jx27re6d3pgdgxd@NUC.doronbehar.com> <1528353614.2427328.1399370296.413C61E3@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1528353614.2427328.1399370296.413C61E3@webmail.messagingengine.com> User-Agent: NeoMutt/20180512 Very weirdly, from some reason, when I tried to test both with `env` and with `eval`, sometimes it worked and sometimes not, no idea why it wasn't even consistent. Therefor, after reading the documentation, I've created a better and probably truly deterministic to do it. Here it is including the quoted `words[1]` and `needed`: local public_keys=(${(@s.:.)${(f)"$(_call_program public-keys ${(q)words[1]} ${(q)needed} --list-public-keys --list-options no-show-photos --with-colons)"}}) I hope you'll find it better. I'm sending a final patch after this message, tell me if there is anything more to improve. On Thu, Jun 07, 2018 at 06:40:14AM +0000, Daniel Shahaf wrote: > 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@gmail.com wrote on Sat, Jun 02, 2018 at 18:26:51 +0300: > > > > From: Doron Behar > > > > > > > > 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.