extrac22.at 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Test suite for GNU tar. -*- Autotest -*-
  2. # Copyright 2017-2023 Free Software Foundation, Inc.
  3. #
  4. # This file is part of GNU tar.
  5. #
  6. # GNU tar 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.
  10. #
  11. # GNU tar 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.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. AT_SETUP([delay-directory-restore on reversed ordering])
  19. # The --delay-directory-resore option worked incorrectly on archives with
  20. # reversed member ordering (which was documented, anyway). This is illustrated
  21. # in
  22. # http://lists.gnu.org/archive/html/bug-tar/2019-03/msg00022.html
  23. # which was taken as a base for this testcase.
  24. # The bug affected tar versions <= 1.32.
  25. AT_KEYWORDS([extract extrac22 delay delay-reversed])
  26. AT_TAR_CHECK([
  27. AT_UNPRIVILEGED_PREREQ
  28. AT_SORT_PREREQ
  29. mkdir t
  30. (cd t
  31. genfile --length 100 --file data1
  32. mkdir dir1
  33. cp data1 dir1
  34. mkdir dir2
  35. cd dir2
  36. ln -s ../dir1/data1 data2
  37. cd ..
  38. chmod -w dir2)
  39. AT_DATA([filelist],
  40. [./dir2/data2
  41. ./dir2
  42. ./dir1/data1
  43. ./dir1
  44. ./data1
  45. ])
  46. tar -C t -c -f a.tar --no-recursion -T filelist
  47. mkdir restore
  48. tar -x -p --delay-directory-restore -C restore -f a.tar
  49. # Previous versions of tar would fail here with the following diagnostics:
  50. # tar: ./dir2/data2: Cannot unlink: Permission denied
  51. ],
  52. [0],
  53. [])
  54. AT_CLEANUP