From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7133 invoked by alias); 5 Apr 2018 03:56:00 -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: 42585 Received: (qmail 18532 invoked by uid 1010); 5 Apr 2018 03:56:00 -0000 X-Qmail-Scanner-Diagnostics: from rcpt-mqugw.biglobe.ne.jp 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(133.208.100.3):SA:0(-2.6/5.0):. Processed in 1.834615 secs); 05 Apr 2018 03:56:00 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: takimoto-j@kba.biglobe.ne.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Biglobe-Sender: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Teach 'tar' to support more file types From: Jun T In-Reply-To: Date: Thu, 5 Apr 2018 12:55:21 +0900 Cc: Eitan Adler Content-Transfer-Encoding: quoted-printable Message-Id: <7060C6C4-6721-4878-B8BC-224346633816@kba.biglobe.ne.jp> References: To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.3273) X-Biglobe-Spnum: 56588 > 2018/04/02 7:10, Eitan Adler wrote: >=20 > In libarchive based (BSD) tar implementations, all file types can = be > uncompressed, even without a filetype letter. In GNU tar's case > "recent" versions (for over 10 years) can do the same. > As such, remove the check for tar type and just assume it works. We can't assume it works since there are many systems where tar requires explicit compression flags. Even on some BSDs (OpenBSD and NetBSD) tar is not based on libarchive. If the tar command is based on libarchive, we can detect it by using 'tar --version'. diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index cff50562e..3e44b98f7 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -21,7 +21,7 @@ local _tar_cmd tf tmp tmpb del index # from some of the possible long options, and from the second word if # that does not start with a hyphen. =20 -if _pick_variant gnu=3DGNU unix --version; then +if _pick_variant gnu=3DGNU libarchive=3Dlibarchive unix --version; then case "$($service --version)" in ("tar (GNU tar) "(#b)([0-9.-]##)*) autoload -z is-at-least diff --git a/Completion/Unix/Type/_tar_archive = b/Completion/Unix/Type/_tar_archive index 28df77638..e8ddb1e59 100644 --- a/Completion/Unix/Type/_tar_archive +++ b/Completion/Unix/Type/_tar_archive @@ -20,7 +20,7 @@ if [[ "$1" =3D *[urtx]* ]]; then _files "$expl[@]" -g '*.(tar|TAR).bz2(-.)' elif [[ "$1" =3D *J* ]]; then _files "$expl[@]" -g '*.(tar|TAR).(lzma|xz)(-.)' - elif [[ "$_cmd_variant[$service]" =3D=3D gnu ]]; then + elif [[ "$_cmd_variant[$service]" =3D=3D (gnu|libarchive) ]]; then _files "$expl[@]" -g = '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)' else _files "$expl[@]" -g '*.(tar|TAR)(-.)'