Bug 196753 - gzip needs cli option to keep original file
Summary: gzip needs cli option to keep original file
Alias: None
Product: Fedora
Classification: Fedora
Component: gzip
Version: 5
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2006-06-26 21:35 UTC by Don Russell
Modified: 2010-07-19 01:23 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2006-06-29 09:41:02 UTC

Attachments (Terms of Use)

Description Don Russell 2006-06-26 21:35:52 UTC
Description of problem:
When gzip compresses a file, the original file is replaced and there is no
option to create the .gz file AND keep the original. There are many instances
where it is desireable to have BOTH files. A typical example is to take
advantage of web servers ability to serve different files based on browser
capability. (Apache +MultiViews)

A simple -k --keep option to keep the original file would solve the problem very

Version-Release number of selected component (if applicable):
gzip 1.3.5 (gzip -V)
gzip-1.3.5.-6.2.1 (rpm)

How reproducible:
Always.. this is an RFE (

Steps to Reproduce:
Actual results:

Expected results:

Additional info:
I have an automated process to receive files and do the following:

find *[^.gz] -print0 | while read -d $'\0' fn;
   gzip -c --best "$fn" > "$fn.gz";
   touch -r "$fn" "$fn.gz";

but that is a lot of code just to (effectively) force gzip to keep the original
file. ANd it does not take into account any errors encountered by gzip...

find *[^.gz] -print0 | xargs -r0I {fn} gzip -k --best "{fn}"

is much simpler to read/maintain/understand.

The current -c option has two meanings: 
1 - keep original file
2 - write output to stdout

Those are two very different things and never should have been tied to the same
option flag. However, the behavior of -c should not change.

Comment 1 Ivana Varekova 2006-06-29 09:41:02 UTC
Thank you for your bug report.
I have sent a patch upstream. 

Comment 2 Don Russell 2006-07-18 21:36:38 UTC
Where is "upstream"? I'd like to track this.


Comment 3 Ivana Varekova 2006-07-19 08:42:25 UTC
The upstream homepage is 
Gzip upstream maintainer is jloup@gzip.org.

Comment 4 Matt McCutchen 2010-07-19 01:23:53 UTC
Me too.  The command-line tools for the newer compression formats (bzip2, xz) have this feature.  Please just add the patch to the Fedora package.

Note You need to log in before you can comment on or make changes to this bug.