zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] Completion: audit 'compset -P' calls to use shortest match where applicable, plus random drive-by tweaks.
Date: Thu, 29 Sep 2016 06:51:54 +0000	[thread overview]
Message-ID: <20160929065154.GB4351@fujitsu.shahaf.local2> (raw)
In-Reply-To: <160928122817.ZM32377@torch.brasslantern.com>

Bart Schaefer wrote on Wed, Sep 28, 2016 at 12:28:17 -0700:
> On Sep 28,  5:46pm, Daniel Shahaf wrote:
> } I'm not sure what to do about the handling of "_path_files -P foo": that -P
> } option documents its argument as a string but interprets it as a pattern.
> } Should we update the documentation to match the implementation, or vice-versa?
> 
> }  if (( $#pfx )); then
> } +  # ### Is it correct to interpret -P as a (greedy) pattern here?
> }    compset -P "$pfx[2]" || pfxsfx=( "$pfx[@]" "$pfxsfx[@]" )
> }  fi
> 
> I think it would be OK / correct to use ${(b)pfx[2]} there.  Presumably if
> $pfx[2] doesn't literally match the filename, we're falling back to the
> pfxsfx assignment to resolve it later.
> 

I'll make the change then.

> Here in _cpio:
> 
> } -  if compset -P '*:'; then
> } -    # TODO: doesn't need to be rsh.
> 
> The TODO comment may have been meant to indicate there should be a zstyle
> to choose what remote shell program to use?  Dumping the comment and
> forcing ssh might not be what was intended, but maybe it's OK, as it's
> consistent with what we do for remote shell pretty much everywhere else.
> 

I note that this block is for GNU cpio which has a --rsh-command flag.
Perhaps the correctest thing to do would be to use that.  I don't intend
to pursue this, though.

> In _rdesktop:
> 
> }      redir="${PREFIX%%:*}"
> } -    if compset -P '*='; then
> } +    if compset -P 1 '*='; then
> }        curcontext="${curcontext%:*}:$redir"
> } -      compset -P '*='
> }        case $redir in
> 
> The old code does look suspicious, but does anyone know if it was doing
> two "compset"s intentionally?

The second compset would have been a no-op on all inputs, wouldn't it?
Even its exit code was discarded.

Thanks for the review.

Daniel


  reply	other threads:[~2016-09-29  6:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 17:46 Daniel Shahaf
2016-09-28 18:18 ` Daniel Shahaf
2016-09-28 19:28 ` Bart Schaefer
2016-09-29  6:51   ` Daniel Shahaf [this message]
2016-10-27  5:58 ` Jun T.
2016-10-27 12:48   ` Daniel Shahaf
2016-10-27 15:00     ` Jun T.

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=20160929065154.GB4351@fujitsu.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --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).