| 1 |
# Test clamping mtime GNU tar. -*- Autotest -*- |
| 2 |
# |
| 3 |
# Copyright 2016-2023 Free Software Foundation, Inc. |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3, or (at your option) |
| 8 |
# any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
# written by Daniel Kahn Gillmor |
| 19 |
|
| 20 |
AT_SETUP([time: clamping mtime]) |
| 21 |
AT_KEYWORDS([time time02]) |
| 22 |
|
| 23 |
AT_TAR_CHECK([ |
| 24 |
AT_SORT_PREREQ |
| 25 |
export TZ=UTC0 |
| 26 |
mkdir dir |
| 27 |
|
| 28 |
touch -d 2015-12-01T00:00:00 dir/a >/dev/null 2>&1 || AT_SKIP_TEST |
| 29 |
touch -d 2016-01-01T00:00:00 dir/b >/dev/null 2>&1 || AT_SKIP_TEST |
| 30 |
touch -d 2016-02-01T00:00:00 dir/c >/dev/null 2>&1 || AT_SKIP_TEST |
| 31 |
touch -d 2038-01-01T00:00:00 dir/d >/dev/null 2>&1 || AT_SKIP_TEST |
| 32 |
|
| 33 |
tar -c --mtime 2016-01-15T00:00:00 --clamp-mtime -f archive.tar dir |
| 34 |
tar -d -f archive.tar dir|sort |
| 35 |
], |
| 36 |
[0], |
| 37 |
[ |
| 38 |
dir/c: Mod time differs |
| 39 |
dir/d: Mod time differs |
| 40 |
], [], [], [], |
| 41 |
[pax]) |
| 42 |
|
| 43 |
AT_CLEANUP |