zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Mikhail Gusarov <misha@ridge.co>
Cc: zsh-workers@zsh.org
Subject: Re: tar completion fails on tar files with colon in names
Date: Sat, 24 Dec 2022 11:17:16 +0000	[thread overview]
Message-ID: <20221224111716.GI8411@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAF6qZWxqUyd98+p_Q-EaO05DnRaDSkCFihuRGYJUtL2mmL+Cfg@mail.gmail.com>

Mikhail Gusarov wrote on Fri, Dec 23, 2022 at 13:17:26 +0100:
> However zsh completion for tar does not take it into account:
> 
> % zsh -f
> % autoload -U compinit
> % compinit
> % tar --force-local -tf x:foo <TAB>tar: Cannot connect to x: resolve failed

The reproduction recipe requires ./x:foo to exist and be a valid tar
archive.

Can you try this?

diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar
index f9901c0c9..1cabd9713 100644
--- a/Completion/Unix/Command/_tar
+++ b/Completion/Unix/Command/_tar
@@ -158,7 +158,7 @@ elif [[ ( "$_tar_cmd" = *[xt]* || -n $del ) && -n "$tf" ]]; then
   fi
 
   if [[ $tf != $_tar_cache_name && -f $tf ]]; then
-    _tar_cache_list=("${(@f)$($words[1] $largs $tf)}")
+    _tar_cache_list=("${(@f)$($words[1] ${words[(r)--force-local]} $largs $tf)}")
     _tar_cache_name=$tf
   fi
 

It doesn't account for possible quoting on the command line.

If it's right, might I ask for someone to commit/push this, please?
Trying not to stretch myself too thin.  Thanks.

Cheers,

Daniel


  reply	other threads:[~2022-12-24 11:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 12:17 Mikhail Gusarov
2022-12-24 11:17 ` Daniel Shahaf [this message]
2022-12-24 14:44   ` Mikhail Gusarov
2022-12-30 20:50     ` Peter Stephenson

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=20221224111716.GI8411@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=misha@ridge.co \
    --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).