From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18525 invoked by alias); 12 Jun 2018 10:55:04 -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: 42987 Received: (qmail 1452 invoked by uid 1010); 12 Jun 2018 10:55:04 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr0-f196.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(209.85.128.196):SA:0(-1.9/5.0):. Processed in 0.580351 secs); 12 Jun 2018 10:55:04 -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_H2,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:in-reply-to:user-agent; bh=tFuzQcJxhEakttzc1YADSuk5Itw7KIWrzvQK9cS7S1Y=; b=dvmxN22NcLHTD7XFwXcKKW1AJNqZ8aVy+Mf83Y5NYHrhcHNY3ktV8Uqhi50/SkgjQV hXJcfwTJp+wfJiISKauvqe4v7LpXT0CbvzJQ2lxmmYNfv4lMTjR+s42/7l2Rj+fh199L 5SLQBa7wPtQWuFcYSSIyOoZXI33x4YTU20T1jIWwoAQFTJ/S8o4wixsC+5vTFDaduTrt tocOnidLlg9TSfIaY8P5ZXITOJ2ct4GaPbAa7PYiDFazeTFq7b5GgkgIil/ds/+r3V20 wxUj1MHGPdg961YTMIY3qTxRjDrd/gSD3ViW9fXTTgqG4BND18pf7p91UawAg9Zu3QYT 1oew== 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:in-reply-to:user-agent; bh=tFuzQcJxhEakttzc1YADSuk5Itw7KIWrzvQK9cS7S1Y=; b=ivY3O01BaiaKPJWFI383YnELpnHRwstDcJcLBIto86z4fgHVpYSCHY4PAi/Wl6dtEK 8SGCVeVIxHi08jZmdZ05JbMpUBwrztRHOfeHV0+kXKlgydX8ogm76OX1q2tq1abgW2rS aUkwAdOMRseYM/X7BKsJE/7dz2g955SYkdRpN4YvKBHhWYJZVpE1Fo/5eQLTCLj17P6n a+JIxJ9hte14HVHnrTZK1dTs6tzVYbB3bv1MmZB/0swrJ++7Ro2Bd45dS/bAuMxVf/h6 goEFxLt5ITxKKC8iQ3Nll6o99z4N9TLyN+c2UJ84g3Luxpsku3pNoWk335p3Jrgp38p+ Qxkg== X-Gm-Message-State: APt69E2NhIjsLhXiHiARxvnb3yiQLlC8LJ2wuGweFbZZVikA0VlquobS kj0hWDKIqnvHDKAve91SJh2vNTNg X-Google-Smtp-Source: ADUXVKLIREg15FkwLjyugV3aS7DFCrqr8r5CF6dMMgwHFanIZfcC+O5nDWufkLBKP4Ih6JnOSYJZvA== X-Received: by 2002:adf:e6d0:: with SMTP id y16-v6mr2470245wrm.35.1528800900228; Tue, 12 Jun 2018 03:55:00 -0700 (PDT) Date: Tue, 12 Jun 2018 13:54:57 +0300 From: Doron Behar To: zsh-workers@zsh.org Subject: Re: [PATCH] _gpg: Use explicit UIDs for public / secret keys. Message-ID: <20180612105457.wnuoenlfzapgosmf@NUC.doronbehar.com> Mail-Followup-To: zsh-workers@zsh.org References: <20180609200940.17041-1-doron.behar@gmail.com> <20180609203932.x3s4hbmbl6rtba76@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180609203932.x3s4hbmbl6rtba76@tarpaulin.shahaf.local2> User-Agent: NeoMutt/20180512 Daniel, I would like you to tell me how can I solve better the `fpr` thing. To tell you the truth, I have no idea what `fpr` means. I just know, by comparing the output of `gpg --list-public-keys` with and without `--with-colons`, that the hexadecimal number afterwards is the actual key that needs to be used as an argument for these options. The way I understand it, only if there is an email address / description coming somewhere after the array element `fpr` (without another `fpr` in between), then this field is the description. Please tell me, how can this algorithm get better? I've had one idea in mind: Perhaps we can perform a more strict pattern matchings test before adding a uid for example? On Sat, Jun 09, 2018 at 08:39:32PM +0000, Daniel Shahaf wrote: > Good morning Doron, > > Thanks for revising the patch, however, I'm afraid I do have a few more > comments: > > doron.behar@gmail.com wrote on Sat, Jun 09, 2018 at 23:09:40 +0300: > > secret-keys) > > - _wanted secret-keys expl 'secret key' compadd \ > > - ${${(Mo)$(_call_program secret-keys $words[1] $needed --list-secret-keys --list-options no-show-photos):%<*>}//(<|>)/} && return > > + local secret_keys=(${(@s.:.)${(f)"$(_call_program secret-keys ${(q)words[1]} ${(q)needed} --list-secret-keys --list-options no-show-photos --with-colons)"}}) > > + local -a uids emails > > + local i > > + for i in {1..${#secret_keys[@]}}; do > > + if [[ ${secret_keys[$i]} == "fpr" ]]; then > > I'd like to see the 'fpr' thing (which I have pointed out twice by now) fixed > before merging. _gpg isn't a function I'm comfortable adding > relaxed/inaccurate parsing to, and doing the parsing correctly isn't onerous. > > > + i=$((i + 1)) > > + local j=$i > > + while [[ ${secret_keys[$j]} != "fpr" ]] && [ $j -lt ${#secret_keys[@]} ]; do > > + if [[ ${secret_keys[$j]} =~ "@" ]]; then > > This condition false negatives for me, probably because I used a test secret > key that didn't have an email address attached. > > > + emails+="${secret_keys[$j]}" > > + uids+="${secret_keys[$i]}" > > + break > > + fi > > + j=$((j + 1)) > > + done > > + i=$j > > + fi > > + done > > + _describe -t secret-keys 'secret key' uids_and_emails > > s/uids_and_emails/emails uids/ > > > ;; > > ciphers) > > _wanted ciphers expl cipher compadd \ > > - ${${(s.,.)${(M)${(f)${"$(_call_program ciphers $words[1] $needed --version)"}//,$'\n' #/, }:#Cipher*}#*:}# } && return > > + ${${(s.,.)${(M)${(f)${"$(_call_program ciphers ${(q)words[1]} ${(q)needed} --version)"}//,$'\n' #/, }:#Cipher*}#*:}# } && return > > ;; > > (public-keyids) > > + _describe -t public-keyids 'public keyids' uids_and_emails > > Ditto. > > Thanks for hanging in there. > > Daniel