blob: 35f3645dcfe9b73a385beace12b2367c0fcb221b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/sh
# Exercise timestamps.
# Copyright 2016-2023 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# limit so don't run it by default.
. "${srcdir=.}/init.sh"; path_prepend_ ..
TZ=UTC0
export TZ
oldIFS=$IFS
# On platforms supporting timestamps outside gzip's range,
# test that gzip warns when converting them to gzip format.
for time_date in \
'190101010000~Jan 1 1901' \
'196912312359.59~Dec 31 1969' \
'197001010000~Jan 1 1970' \
'210602070628.16~Feb 7 2106'
do
IFS='~'
set $time_date
time=$1
date=$2
IFS=$oldIFS
if touch -t $time in; then
ls_l=$(ls -l in)
case $ls_l in
*"$date"*) returns_ 2 gzip in || fail=1;;
esac
fi
rm -f in.gz in
done
# Test that timestamps in range for gzip do not generate warnings.
for time_date in \
'197001010000.01~Jan 1 1970' \
'203801190314.07~Jan 19 2038' \
'203801190314.08~Jan 19 2038' \
'210602070628.15~Feb 7 2106'
do
IFS='~'
set $time_date
time=$1
date=$2
IFS=$oldIFS
if touch -t $time in; then
ls_l=$(ls -l in)
case $ls_l in
*"$date"*) gzip in || fail=1;;
esac
fi
rm -f in.gz in
done
# Test that gzip succeeds when converting timestamps from gzip format,
# or warns that the timestamp is out of time_t range.
printf '\037\213\10\0\377\377\377\377\0\377\3\0\0\0\0\0\0\0\0\0' >y2106.gz ||
framework_failure_
gzip -Nlv <y2106.gz
status=$?
test $status -eq 0 || test $status -eq 2 || fail=1
# Ensure that --no-name does not provoke a timestamp warning.
: | gzip --no-name > k || fail=1
Exit $fail
|