GNU bug report logs -
#24826
[PATCH 1/2] gzip --no-name: avoid spurious warning
Previous Next
Reported by: Jim Meyering <jim <at> meyering.net>
Date: Sun, 30 Oct 2016 14:56:01 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24826 in the body.
You can then email your comments to 24826 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gzip <at> gnu.org
:
bug#24826
; Package
gzip
.
(Sun, 30 Oct 2016 14:56:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jim Meyering <jim <at> meyering.net>
:
New bug report received and forwarded. Copy sent to
bug-gzip <at> gnu.org
.
(Sun, 30 Oct 2016 14:56:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The first one is a clear bug fix.
For the second, since --no-time (-T) never worked (-m does),
I could also just remove its entry from longopts. We've
done without it for so long, there's little point to adding
an undocumented --no-time, now.
From ed37ad2fe34cb37a1dc1687fb6c441e2ebd2e86b Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering <at> fb.com>
Date: Mon, 24 Oct 2016 10:10:04 -0700
Subject: [PATCH 1/2] gzip --no-name: avoid spurious warning
I noticed that while attempting to create gzip's own gzip-compressed
release tarball, gzip would emit this warning and exit with status 2:
gzip: stdin: warning: file time stamp out of range for gzip format
Here is a minimal reproducer: : | gzip --no-name > k
* zip.c (zip): Skip validity check when no_time is set.
* gzip.c (no_time): Make this variable global.
* gzip.h (no_time): Declare it extern.
* tests/timestamp: Add a test to exercise the fix.
Introduced by commit v1.8-6-g51dee92
---
gzip.c | 2 +-
gzip.h | 1 +
tests/timestamp | 3 +++
zip.c | 4 +++-
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gzip.c b/gzip.c
index 0fca5a3..f990fa2 100644
--- a/gzip.c
+++ b/gzip.c
@@ -173,7 +173,7 @@ static int decompress = 0; /* decompress (-d) */
static int force = 0; /* don't ask questions, compress links (-f) */
static int keep = 0; /* keep (don't delete) input files */
static int no_name = -1; /* don't save or restore the original file name */
-static int no_time = -1; /* don't save or restore the original file time */
+ int no_time = -1; /* don't save or restore the original file time */
static int recursive = 0; /* recurse through directories (-r) */
static int list = 0; /* list the file contents (-l) */
int verbose = 0; /* be verbose (-v) */
diff --git a/gzip.h b/gzip.h
index f298b47..4117306 100644
--- a/gzip.h
+++ b/gzip.h
@@ -199,6 +199,7 @@ typedef int file_t; /* Do not use stdio */
extern int exit_code; /* program exit code */
extern int verbose; /* be verbose (-v) */
+extern int no_time; /* --no-time (-T) */
extern int quiet; /* be quiet (-q) */
extern int level; /* compression level */
extern int test; /* check .z file integrity */
diff --git a/tests/timestamp b/tests/timestamp
index 7acfe5d..141c1d4 100755
--- a/tests/timestamp
+++ b/tests/timestamp
@@ -49,4 +49,7 @@ touch -t 210602070628.15 in || {
test $? = 2 || fail=1
}
+# Ensure that --no-name does not provoke a time stamp warning.
+: | gzip --no-name > k || fail=1
+
Exit $fail
diff --git a/zip.c b/zip.c
index eb60409..cebd719 100644
--- a/zip.c
+++ b/zip.c
@@ -54,7 +54,9 @@ int zip(in, out)
flags |= ORIG_NAME;
}
put_byte(flags); /* general flags */
- if (0 < time_stamp.tv_sec && time_stamp.tv_sec <= 0xffffffff)
+ if (no_time)
+ stamp = 0;
+ else if (0 < time_stamp.tv_sec && time_stamp.tv_sec <= 0xffffffff)
stamp = time_stamp.tv_sec;
else
{
--
2.7.4
From 6d0eabd745de16616beda963e0bee662a1664478 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering <at> fb.com>
Date: Mon, 24 Oct 2016 09:58:22 -0700
Subject: [PATCH 2/2] gzip: accept --no-time option (undocumented, like -m)
The undocumented -m option has been accepted since the beginning,
but its associated --no-time option has never been accepted, due
to the use of 'T' (not mentioned in shortopts) instead of 'm' in
the definition of longopts. This made it so an attempt to use
this long option would elicit only a bare "Try `gzip --help' for
more information."
* gzip.c (longopts): Specify 'm' with --no-time, not 'T'.
---
gzip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gzip.c b/gzip.c
index f990fa2..9e34c80 100644
--- a/gzip.c
+++ b/gzip.c
@@ -285,7 +285,7 @@ static const struct option longopts[] =
{"recursive", 0, 0, 'r'}, /* recurse through directories */
{"suffix", 1, 0, 'S'}, /* use given suffix instead of .gz */
{"test", 0, 0, 't'}, /* test compressed file integrity */
- {"no-time", 0, 0, 'T'}, /* don't save or restore the time stamp */
+ {"no-time", 0, 0, 'm'}, /* don't save or restore the time stamp */
{"verbose", 0, 0, 'v'}, /* verbose mode */
{"version", 0, 0, 'V'}, /* display version number */
{"fast", 0, 0, '1'}, /* compress faster */
--
2.7.4
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Sat, 05 Nov 2016 03:37:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jim Meyering <jim <at> meyering.net>
:
bug acknowledged by developer.
(Sat, 05 Nov 2016 03:37:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 24826-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Jim Meyering wrote:
> The first one is a clear bug fix.
Oops, my bad. Thanks for catching that. I installed a simpler fix (first
attached patch).
> For the second, since --no-time (-T) never worked (-m does),
> I could also just remove its entry from longopts. We've
> done without it for so long, there's little point to adding
> an undocumented --no-time, now.
Thanks, I like that idea and installed the 2nd attached patch.
In rereading the code I noticed other problems likely to bite after the year
2038 (3rd attached patch, also installed). This stuff is a pain, as it won't see
realistic testing for another 20 years or so and I don't see easy test cases for
it, partly because GNU/Linux seems to mishandles these time stamps now on my
platform (Fedora 24 x86-64; I'll try to file a bug report about this to Fedora).
Boldly marking the bug as done.
[0001-gzip-no-name-avoid-spurious-warning.patch (text/x-diff, attachment)]
[0002-gzip-no-time-cleanup.patch (text/x-diff, attachment)]
[0003-gzip-minor-time-stamp-cleanups.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gzip <at> gnu.org
:
bug#24826
; Package
gzip
.
(Sat, 05 Nov 2016 14:08:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 24826-done <at> debbugs.gnu.org (full text, mbox):
On Fri, Nov 4, 2016 at 10:36 PM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> Jim Meyering wrote:
>>
>> The first one is a clear bug fix.
>
>
> Oops, my bad. Thanks for catching that. I installed a simpler fix (first
> attached patch).
>
>> For the second, since --no-time (-T) never worked (-m does),
>> I could also just remove its entry from longopts. We've
>> done without it for so long, there's little point to adding
>> an undocumented --no-time, now.
>
>
> Thanks, I like that idea and installed the 2nd attached patch.
>
> In rereading the code I noticed other problems likely to bite after the year
> 2038 (3rd attached patch, also installed). This stuff is a pain, as it won't
> see realistic testing for another 20 years or so and I don't see easy test
> cases for it, partly because GNU/Linux seems to mishandles these time stamps
> now on my platform (Fedora 24 x86-64; I'll try to file a bug report about
> this to Fedora).
>
> Boldly marking the bug as done.
All good. Thank you.
Information forwarded
to
bug-gzip <at> gnu.org
:
bug#24826
; Package
gzip
.
(Sat, 05 Nov 2016 15:13:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 24826-done <at> debbugs.gnu.org (full text, mbox):
FYI, pigz implements -T and --no-time.
> On Nov 5, 2016, at 7:07 AM, Jim Meyering <jim <at> meyering.net> wrote:
>
> On Fri, Nov 4, 2016 at 10:36 PM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
>> Jim Meyering wrote:
>>>
>>> The first one is a clear bug fix.
>>
>>
>> Oops, my bad. Thanks for catching that. I installed a simpler fix (first
>> attached patch).
>>
>>> For the second, since --no-time (-T) never worked (-m does),
>>> I could also just remove its entry from longopts. We've
>>> done without it for so long, there's little point to adding
>>> an undocumented --no-time, now.
>>
>>
>> Thanks, I like that idea and installed the 2nd attached patch.
>>
>> In rereading the code I noticed other problems likely to bite after the year
>> 2038 (3rd attached patch, also installed). This stuff is a pain, as it won't
>> see realistic testing for another 20 years or so and I don't see easy test
>> cases for it, partly because GNU/Linux seems to mishandles these time stamps
>> now on my platform (Fedora 24 x86-64; I'll try to file a bug report about
>> this to Fedora).
>>
>> Boldly marking the bug as done.
>
> All good. Thank you.
>
>
>
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 04 Dec 2016 12:24:04 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Mark Adler <madler <at> alumni.caltech.edu>
to
control <at> debbugs.gnu.org
.
(Mon, 12 Dec 2016 06:47:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 09 Jan 2017 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 219 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.