Subject: Re: bug#66532: 29.1; dired-guess-default command for tar.zst file fails

From: Eli Zaretskii <[email-masked]>
Date: Wed, 25 Oct 2023 16:33:17 +0300

> From: Michael Eliachevitch <[email-masked]>
> Cc: [email-masked]
> 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.