From: Doron Behar <doron.behar@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] _gpg: Use explicit UIDs for public / secret keys.
Date: Tue, 12 Jun 2018 13:54:57 +0300 [thread overview]
Message-ID: <20180612105457.wnuoenlfzapgosmf@NUC.doronbehar.com> (raw)
In-Reply-To: <20180609203932.x3s4hbmbl6rtba76@tarpaulin.shahaf.local2>
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
next prev parent reply other threads:[~2018-06-12 10:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-09 20:09 doron.behar
2018-06-09 20:39 ` Daniel Shahaf
2018-06-12 10:54 ` Doron Behar [this message]
2018-06-12 19:22 ` Matthew Martin
2018-06-12 22:14 ` Phil Pennock
2018-06-13 15:17 ` Doron Behar
2018-06-14 10:06 ` Daniel Shahaf
-- strict thread matches above, loose matches on Subject: below --
2018-06-02 15:26 doron.behar
2018-06-03 21:43 ` Daniel Shahaf
2018-06-05 15:47 ` Doron Behar
2018-06-07 6:40 ` Daniel Shahaf
2018-06-07 15:50 ` Doron Behar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180612105457.wnuoenlfzapgosmf@NUC.doronbehar.com \
--to=doron.behar@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).