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

Previous Next

Package: gzip;

Reported by: Krzysztof Żelechowski <giecrilj <at> stegny.2a.pl>

Date: Tue, 17 Aug 2021 17:45:01 UTC

Severity: wishlist

Full log


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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Krzysztof Żelechowski <giecrilj <at> stegny.2a.pl>
Cc: Rodrigo Campos <rodrigo <at> sdfg.com.ar>, 50097 <at> debbugs.gnu.org,
 Antonio Diaz Diaz <antonio <at> gnu.org>
Subject: Re: bug#50097: gzip: add "--keep" option to keep original files
 unchanged
Date: Thu, 19 Aug 2021 14:32:44 -0700
[Message part 1 (text/plain, inline)]
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.
[0001-gzip-clarify-other-links-diagnostic.patch (text/x-patch, attachment)]

This bug report was last modified 3 years and 78 days ago.

Previous Next


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