all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#66532: 29.1; dired-guess-default command for tar.zst file fails
@ 2023-10-13 11:54 Michael Eliachevitch
  2023-10-14  6:24 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Eliachevitch @ 2023-10-13 11:54 UTC (permalink / raw)
  To: 66532


[-- Attachment #1.1: Type: text/plain, Size: 4996 bytes --]

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))

[-- Attachment #1.2: testdir.tar.zst --]
[-- Type: application/zstd, Size: 116 bytes --]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#66532: 29.1; dired-guess-default command for tar.zst file fails
  2023-10-13 11:54 bug#66532: 29.1; dired-guess-default command for tar.zst file fails Michael Eliachevitch
@ 2023-10-14  6:24 ` Eli Zaretskii
  2023-10-14 18:41   ` Michael Eliachevitch
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2023-10-14  6:24 UTC (permalink / raw)
  To: Michael Eliachevitch; +Cc: 66532

> From: Michael Eliachevitch <m.eliachevitch@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")





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#66532: 29.1; dired-guess-default command for tar.zst file fails
  2023-10-14  6:24 ` Eli Zaretskii
@ 2023-10-14 18:41   ` Michael Eliachevitch
  2023-10-25 13:33     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Eliachevitch @ 2023-10-14 18:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 66532



> 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.





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#66532: 29.1; dired-guess-default command for tar.zst file fails
  2023-10-14 18:41   ` Michael Eliachevitch
@ 2023-10-25 13:33     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2023-10-25 13:33 UTC (permalink / raw)
  To: Michael Eliachevitch; +Cc: 66532-done

> From: Michael Eliachevitch <m.eliachevitch@posteo.de>
> Cc: 66532@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-25 13:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-13 11:54 bug#66532: 29.1; dired-guess-default command for tar.zst file fails Michael Eliachevitch
2023-10-14  6:24 ` Eli Zaretskii
2023-10-14 18:41   ` Michael Eliachevitch
2023-10-25 13:33     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.