bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50097: gzip: add "--keep" option to keep original files unchanged


From: Paul Eggert
Subject: bug#50097: gzip: add "--keep" option to keep original files unchanged
Date: Thu, 19 Aug 2021 14:32:44 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 8/19/21 1:43 PM, Krzysztof Żelechowski wrote:
The command { gzip b; } fails because it would compress [a] without renaming
it.
The command { gzip -k b; } would not compress [a], so there is no reason to
fail.

There is a safety reason to fail. A naive user might do this:

gzip -k b && gzip -cd b.gz >b

which would trash the hard-linked file as well.

There's a similar safety issue with symbolic links:

$ ln -s a b
$ touch a
$ gzip -k b && gzip -cd b.gz >b
gzip: b: Too many levels of symbolic links

where gzip's failure prevents the naive user from trashing the linked-to file.

Of course one can use -f to go ahead and compress anyway.

Similar diagnostics say "file ignored" or "ignored", and that is clearer than saying "unchanged", so I installed the attached patch.

Attachment: 0001-gzip-clarify-other-links-diagnostic.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]