time02.at 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. # written by Daniel Kahn Gillmor
  18. AT_SETUP([time: clamping mtime])
  19. AT_KEYWORDS([time time02])
  20. AT_TAR_CHECK([
  21. AT_SORT_PREREQ
  22. export TZ=UTC0
  23. mkdir dir
  24. touch -d 2015-12-01T00:00:00 dir/a >/dev/null 2>&1 || AT_SKIP_TEST
  25. touch -d 2016-01-01T00:00:00 dir/b >/dev/null 2>&1 || AT_SKIP_TEST
  26. touch -d 2016-02-01T00:00:00 dir/c >/dev/null 2>&1 || AT_SKIP_TEST
  27. touch -d 2038-01-01T00:00:00 dir/d >/dev/null 2>&1 || AT_SKIP_TEST
  28. tar -c --mtime 2016-01-15T00:00:00 --clamp-mtime -f archive.tar dir
  29. tar -d -f archive.tar dir|sort
  30. ],
  31. [0],
  32. [
  33. dir/c: Mod time differs
  34. dir/d: Mod time differs
  35. ], [], [], [],
  36. [pax])
  37. AT_CLEANUP