GNU bug report logs - #66532
29.1; dired-guess-default command for tar.zst file fails

Previous Next

Package: emacs;

Reported by: Michael Eliachevitch <m.eliachevitch <at> posteo.de>

Date: Fri, 13 Oct 2023 17:05:01 UTC

Severity: normal

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66532 in the body.
You can then email your comments to 66532 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#66532; Package emacs. (Fri, 13 Oct 2023 17:05:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Eliachevitch <m.eliachevitch <at> posteo.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 13 Oct 2023 17:05:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Eliachevitch <m.eliachevitch <at> posteo.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.1; dired-guess-default command for tar.zst file fails
Date: Fri, 13 Oct 2023 11:54:00 +0000
[Message part 1 (text/plain, inline)]
I tried to extract the attached zstandard-compressed tar archive
`testdir.tar.zst' using the dired-guess-default suggested shell command,
which is

   unzstd -c %i | tar -xf -

It fails with the message

   zstd: can't stat %i : No such file or directory -- ignored
   tar: This does not look like a tar archive
   tar: testdir.tar.zst: Not found in archive

What instead works is using the command

 tar --use-compress-program=unzstd -xvf

My GNU tar version also is able to automatically detect zstandard files,
so basically just "tar -xvf" is suffisient, but the version with
"--use-compress-program=unzstd" is backwards-compatible to older tar
versions.

I suggest fixing that in `dired-guess-shell-alist-default'. Though there
might be tar versions out there which don't support
`--use-compress-program' (I don't know), then maybe a piping solution
might be better, but that should be done in a way that avoid the above
error (not sure what actually causes it).

I use GNU tar version 1.35 and unzstd version v1.5.5.
---

In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
cairo version 1.17.8)
System Description: Arch Linux

Configured using:
'configure --with-pgtk --with-native-compilation=aot --sysconfdir=/etc
--prefix=/usr --libexecdir=/usr/lib --with-tree-sitter
--localstatedir=/var --with-cairo --disable-build-details
--with-harfbuzz --with-libsystemd --with-modules 'CFLAGS=-march=x86-64
-mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2
-Wformat -Werror=format-security -fstack-clash-protection
-fcf-protection -g
-ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto'
'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto'
'CXXFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
-fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g
-ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
 value of $LC_COLLATE: C.UTF-8
 value of $LC_CTYPE: en_GB.UTF-8
 value of $LC_MESSAGES: en_US.UTF-8
 value of $LC_MONETARY: de_DE.UTF-8
 value of $LC_NUMERIC: en_US.UTF-8
 value of $LC_TIME: de_DE.UTF-8
 value of $LANG: C
 value of $XMODIFIERS: \@im=fcitx
 locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
 shell-dirtrack-mode: t
 tooltip-mode: t
 global-eldoc-mode: t
 show-paren-mode: t
 electric-indent-mode: t
 mouse-wheel-mode: t
 tool-bar-mode: t
 menu-bar-mode: t
 file-name-shadow-mode: t
 global-font-lock-mode: t
 font-lock-mode: t
 blink-cursor-mode: t
 buffer-read-only: t
 line-number-mode: t
 indent-tabs-mode: t
 transient-mark-mode: t
 auto-composition-mode: t
 auto-encryption-mode: t
 auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny rfc822
mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils shell pcomplete comint ansi-osc
ansi-color ring dired-aux cl-loaddefs comp comp-cstr warnings icons
subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile
cl-lib dired dired-loaddefs rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 88176 12534)
(symbols 48 7814 1)
(strings 32 22832 2092)
(string-bytes 1 699474)
(vectors 16 17190)
(vector-slots 8 350551 18772)
(floats 8 30 40)
(intervals 56 440 0)
(buffers 984 15))
[testdir.tar.zst (application/zstd, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66532; Package emacs. (Sat, 14 Oct 2023 06:26:02 GMT) Full text and rfc822 format available.

Message #8 received at 66532 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Eliachevitch <m.eliachevitch <at> posteo.de>
Cc: 66532 <at> debbugs.gnu.org
Subject: Re: bug#66532: 29.1;
 dired-guess-default command for tar.zst file fails
Date: Sat, 14 Oct 2023 09:24:40 +0300
> From: Michael Eliachevitch <m.eliachevitch <at> posteo.de>
> Date: Fri, 13 Oct 2023 11:54:00 +0000
> 
> I tried to extract the attached zstandard-compressed tar archive
> `testdir.tar.zst' using the dired-guess-default suggested shell command,
> which is
> 
>     unzstd -c %i | tar -xf -
> 
> It fails with the message
> 
>     zstd: can't stat %i : No such file or directory -- ignored
>     tar: This does not look like a tar archive
>     tar: testdir.tar.zst: Not found in archive

Does the patch below fix this?

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index fc3f6f4..458acad 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1172,7 +1172,7 @@ dired-guess-shell-alist-default
          "unxz")
 
    ;; zstandard archives
-   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c %i | tar -xf -")
+   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c * | tar -xf -")
    `(,(rx ".zst" eos)                  "unzstd --rm")
 
    '("\\.shar\\.Z\\'" "zcat * | unshar")




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66532; Package emacs. (Sat, 14 Oct 2023 19:21:01 GMT) Full text and rfc822 format available.

Message #11 received at 66532 <at> debbugs.gnu.org (full text, mbox):

From: Michael Eliachevitch <m.eliachevitch <at> posteo.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 66532 <at> debbugs.gnu.org
Subject: Re: bug#66532: 29.1; dired-guess-default command for tar.zst file
 fails
Date: Sat, 14 Oct 2023 18:41:52 +0000

> Does the patch below fix this?
>
> diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
> index fc3f6f4..458acad 100644
> --- a/lisp/dired-aux.el
> +++ b/lisp/dired-aux.el
> @@ -1172,7 +1172,7 @@ dired-guess-shell-alist-default
>           "unxz")
>
>     ;; zstandard archives
> -   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c %i | tar -xf -")
> +   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c * | tar -xf -")
>     `(,(rx ".zst" eos)                  "unzstd --rm")
>
>     '("\\.shar\\.Z\\'" "zcat * | unshar")


Yes, this patch works for me for a single tar.zst archive.

However, when I mark multiple tar.zst archives and then run the
suggested shell command (with *) on all of them, only the first archive
gets extracted.. I just opened the Emacs manual dired section and found
the `?' is a placeholder for which the command gets executed separately
for each marked file. So with

   unzstd -c ? | tar -xf -

each marked archive gets successfully extracted. Here also formatted as a patch;

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 2ff620065a5..e0bcae6b005 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1176,7 +1176,7 @@ dired-guess-shell-alist-default
         "unxz")

   ;; zstandard archives
-   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c %i | tar -xf -")
+   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c ? | tar -xf -")
   `(,(rx ".zst" eos)                  "unzstd --rm")

   '("\\.shar\\.Z\\'" "zcat * | unshar")

I am just wondering that I didn't find the questionmark placeholder in
any of the other suggested commands for compressed tar files, not sure
if they work fur multiple marked files, I didn't test that.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Wed, 25 Oct 2023 13:35:01 GMT) Full text and rfc822 format available.

Notification sent to Michael Eliachevitch <m.eliachevitch <at> posteo.de>:
bug acknowledged by developer. (Wed, 25 Oct 2023 13:35:02 GMT) Full text and rfc822 format available.

Message #16 received at 66532-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Eliachevitch <m.eliachevitch <at> posteo.de>
Cc: 66532-done <at> debbugs.gnu.org
Subject: Re: bug#66532: 29.1; dired-guess-default command for tar.zst file
 fails
Date: Wed, 25 Oct 2023 16:33:17 +0300
> From: Michael Eliachevitch <m.eliachevitch <at> posteo.de>
> Cc: 66532 <at> debbugs.gnu.org
> Date: Sat, 14 Oct 2023 18:41:52 +0000
> 
> 
> 
> > Does the patch below fix this?
> >
> > diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
> > index fc3f6f4..458acad 100644
> > --- a/lisp/dired-aux.el
> > +++ b/lisp/dired-aux.el
> > @@ -1172,7 +1172,7 @@ dired-guess-shell-alist-default
> >           "unxz")
> >
> >     ;; zstandard archives
> > -   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c %i | tar -xf -")
> > +   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c * | tar -xf -")
> >     `(,(rx ".zst" eos)                  "unzstd --rm")
> >
> >     '("\\.shar\\.Z\\'" "zcat * | unshar")
> 
> 
> Yes, this patch works for me for a single tar.zst archive.
> 
> However, when I mark multiple tar.zst archives and then run the
> suggested shell command (with *) on all of them, only the first archive
> gets extracted.. I just opened the Emacs manual dired section and found
> the `?' is a placeholder for which the command gets executed separately
> for each marked file. So with
> 
>     unzstd -c ? | tar -xf -
> 
> each marked archive gets successfully extracted. Here also formatted as a patch;
> 
> diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
> index 2ff620065a5..e0bcae6b005 100644
> --- a/lisp/dired-aux.el
> +++ b/lisp/dired-aux.el
> @@ -1176,7 +1176,7 @@ dired-guess-shell-alist-default
>           "unxz")
> 
>     ;; zstandard archives
> -   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c %i | tar -xf -")
> +   `(,(rx (or ".tar.zst" ".tzst") eos) "unzstd -c ? | tar -xf -")
>     `(,(rx ".zst" eos)                  "unzstd --rm")
> 
>     '("\\.shar\\.Z\\'" "zcat * | unshar")
> 
> I am just wondering that I didn't find the questionmark placeholder in
> any of the other suggested commands for compressed tar files, not sure
> if they work fur multiple marked files, I didn't test that.

Thanks, I installed your variant on the emacs-29 branch, and I'm
therefore closing this bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 23 Nov 2023 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 204 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.