bin/147275: gzip -c <file> does not save original time stamp
Thomas Quinot
thomas at cuivre.fr.eu.org
Tue Jun 1 10:10:03 UTC 2010
>Number: 147275
>Category: bin
>Synopsis: gzip -c <file> does not save original time stamp
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Jun 01 10:10:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Thomas Quinot
>Release: FreeBSD 8.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD melamine.cuivre.fr.eu.org 8.0-STABLE FreeBSD 8.0-STABLE #0: Sun Mar 28 14:46:11 CEST 2010 thomas at melamine.cuivre.fr.eu.org:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
When a file name is provided on the command line, gzip -c does not
save its timestamp in the output compressed stream.
>How-To-Repeat:
cd /tmp
touch foo
gzip -c foo > foo1.gz
gzip foo
file foo1.gz foo.gz
foo1.gz: gzip compressed data, was "foo", from Unix
foo.gz: gzip compressed data, was "foo", from Unix, last modified: Tue Jun 1 11:55:30 2010
>Fix:
Index: gzip.c
===================================================================
--- gzip.c (révision 208689)
+++ gzip.c (copie de travail)
@@ -1212,6 +1212,7 @@
{
int in;
int out;
+ int rc;
off_t size, insize;
#ifndef SMALL
struct stat isb, osb;
@@ -1224,9 +1225,16 @@
return -1;
}
+ /* Stat input file even in stdout (-c) mode so that the
+ * correct time stamp is inserted in the compressed
+ * output stream.
+ */
+
+ rc = fstat (in, &isb);
+
if (cflag == 0) {
#ifndef SMALL
- if (fstat(in, &isb) == 0) {
+ if (rc == 0) {
if (isb.st_nlink > 1 && fflag == 0) {
maybe_warnx("%s has %d other link%s -- "
"skipping", file, isb.st_nlink - 1,
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list