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   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-06-29 09:41:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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
nicely.


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:
1.
2.
3.
  
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;
do
   gzip -c --best "$fn" > "$fn.gz";
   touch -r "$fn" "$fn.gz";
done; 

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.

Thanks.

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

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.