zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Doron Behar <doron.behar@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH 1/1] _gpg: Use explicit UIDs for state = public keys.
Date: Wed, 30 May 2018 19:04:14 +0000	[thread overview]
Message-ID: <20180530190414.e7khdn2hk5wj4t2s@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20180529141034.m45lzzjpjrmo4wjg@NUC.doronbehar.com>

Doron Behar wrote on Tue, May 29, 2018 at 17:11:23 +0300:
> I've successfully managed to solve address all the comments you've had
> for my patch. Yet, I'm having trouble with `_call_program`. The line I'm
> trying to put is this:
> 
>     local public_keys=(${(@s.:.)$(_call_program public-keys $words[1] $needed --list-public-keys --list-options no-show-photos --with-colons)})
> 
> I debugged this a little bit and the variable `$public_keys` is empty
> but if I remove the words: `_call_program public-keys` it works good.
> 
> I've had a glimpse at `htop` when this function was called when I tested
> the completion function and I saw these commands running there:
> 
> 	pkgfile -b -v -- --list-public-keys
> 	pkgfile -b -v -- --list-options
> 	pkgfile -b -v -- no-show-photos
> 	pkgfile -b -v -- --with-colons
> 
> What is _call_program supposed to be doing?
> 

_call_program (doc'd in zshcompsys(1)) is supposed to run the command
"$words[1] $needed --list-public-keys --list-options no-show-photos
--with-colons".  The purpose of using _call_program is to allow the user to
override the command to use by setting a zstyle.

I can't explain the multiple commands you glimpsed in htop.

Try changing «$words[1] $needed» to «${(q)words[1]} ${(q)needed}».  That adds
an additional level of quoting, since one of the differences between «foo bar
baz…» and «_call_program x foo bar baz…» is that in the latter case, the «foo
bar baz» are eval'd.  I'm not sure whether that would fix the failure mode
you're seeing, but it's a correct change regardless.

I would recommend debugging that line inside out, e.g., start by ensuring the
_call_program by itself gets the expected arguments and produced the expected
values on its stdout.  Enabling tracing («set -x» or «functions -T _call_program»)
might help.

> Besides that, the revised patch is ready. I've also included similar
> improvements for the other states - `secret-keys` and `public-keyids`.

I look forward to the revised patch.  However, I'll be busy in the next few
days so I hope another developer would beat me to reviewing/applying it ;-).

Cheers,

Daniel


  reply	other threads:[~2018-05-30 19:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 15:16 [PATCH 0/1] *** Small improvement for gpg completion *** doron.behar
2018-05-26 15:16 ` [PATCH 1/1] _gpg: Use explicit UIDs for state = public keys doron.behar
2018-05-26 16:25   ` Daniel Shahaf
2018-05-29 14:11     ` Doron Behar
2018-05-30 19:04       ` Daniel Shahaf [this message]
2018-06-02 15:08         ` 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=20180530190414.e7khdn2hk5wj4t2s@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=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).