Bug 196753

Summary: gzip needs cli option to keep original file
Product: [Fedora] Fedora Reporter: Don Russell <fedora>
Component: gzipAssignee: Ivana Varekova <varekova>
Status: CLOSED UPSTREAM QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: matt
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-06-29 05:41:02 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Don Russell 2006-06-26 17:35:52 EDT
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 05:41:02 EDT
Thank you for your bug report.
I have sent a patch upstream. 
Comment 2 Don Russell 2006-07-18 17:36:38 EDT
Where is "upstream"? I'd like to track this.

Comment 3 Ivana Varekova 2006-07-19 04:42:25 EDT
The upstream homepage is 
Gzip upstream maintainer is jloup@gzip.org.
Comment 4 Matt McCutchen 2010-07-18 21:23:53 EDT
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.