4 # Copyright 2016-2025 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
18 # limit so don't run it by default.
20 .
"${srcdir=.}/init.sh"; path_prepend_ ..
26 # On platforms supporting timestamps outside gzip's range,
27 # test that gzip warns when converting them to gzip format.
29 '190101010000~Jan 1 1901' \
30 '196912312359.59~Dec 31 1969' \
31 '197001010000~Jan 1 1970' \
32 '210602070628.16~Feb 7 2106'
39 if touch -t $time in; then
42 *"$date"*) returns_
2 gzip in || fail
=1;;
48 # Test that timestamps in range for gzip do not generate warnings.
50 '197001010000.01~Jan 1 1970' \
51 '203801190314.07~Jan 19 2038' \
52 '203801190314.08~Jan 19 2038' \
53 '210602070628.15~Feb 7 2106'
60 if touch -t $time in; then
63 *"$date"*) gzip in || fail
=1;;
69 # Test that gzip succeeds when converting timestamps from gzip format,
70 # or warns that the timestamp is out of time_t range.
71 printf '\037\213\10\0\377\377\377\377\0\377\3\0\0\0\0\0\0\0\0\0' >y2106.gz ||
75 test $status -eq 0 ||
test $status -eq 2 || fail
=1
77 # Ensure that --no-name does not provoke a timestamp warning.
78 : |
gzip --no-name > k || fail
=1