Subject: Re: bug#29094: dired-do-compress creates empty archives

From: Noam Postavsky <[email-masked]>
Date: Mon, 04 Dec 2017 20:46:07 -0500

tags 29094 + patch
quit

Max <[email-masked]> writes:

> When Z is pressed on a directory, dired (according to
> dired-compress-file-suffixes variable) runs the following command:
>
> tar -c directory | gzip -c9 > directory.tar.gz
>
> On my system running this command results in an error:
>
> tar: Failed open to write on /dev/rst0: Permission denied
>
> as tar(1) defaults -f to /dev/rst0.
>
> Argument '-f-' should be used to write to stdout.

Right, the GNU tar manual says [1]

    By default, tar uses an archive file name that was compiled when it was
    built on the system; usually this name refers to some physical tape
    drive on the machine. However, the person who installed tar on the
    system may not have set the default to a meaningful value as far as most
    users are concerned.

So it's actually a bit surprising that the current values apparently
work for most people.  I guess most GNU/Linux distros set the default to
stdin?

As far as I can tell, dropping the 'f' option was just an oversight (see
[2] and other messages in that thread).

> Also '-v' is probably not needed here, since the output is not used
> anywhere.

Makes sense.

> Here is a patch to correct this behaviour:

I think it's good for emacs-26.  I assume you haven't assigned copyright
to Emacs (so it should be marked as a tiny change)?

[1]: https://www.gnu.org/software/tar/manual/html_node/file.html
[2]: https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg01282.html