listed05.at 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. #
  3. # Test suite for GNU tar.
  4. # Copyright 2010-2023 Free Software Foundation, Inc.
  5. # This file is part of GNU tar.
  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. # GNU tar 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. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Tar up to 1.26 was unable to cope with directories that had once
  17. # been part of the dumped system and became separate mount points
  18. # afterwards. The bug has been reported by Nathan Stratton Treadway,
  19. # who also proposed a fix and a testcase, on which the present one is
  20. # built.
  21. # Reported-by: Nathan Stratton Treadway <[email protected]>
  22. # Last-Affected-Version: 1.26
  23. # References: <[email protected]>
  24. # http://lists.gnu.org/archive/html/bug-tar/2012-05/msg00022.html
  25. # This testcase is Linux-specific and requires root privileges.
  26. AT_SETUP([--listed-incremental and remounted directories])
  27. AT_KEYWORDS([listed incremental listed05 chdir])
  28. AT_TAR_CHECK([
  29. AT_CHECK_TIMESTAMP
  30. AT_PRIVILEGED_PREREQ
  31. options="-C tartest --create --one-file-system --verbose"
  32. rm -rf archive-[01].snar archive-[01].tar tartest subdir
  33. # Create initial structure
  34. mkdir tartest
  35. echo "hi" > tartest/top-level-file
  36. mkdir tartest/subdir
  37. echo "hi" > tartest/subdir/subdir-file
  38. echo "# Level 0"
  39. tar $options --file archive-0.tar --listed-incremental=archive-0.snar .
  40. echo "# Remount"
  41. mv tartest/subdir .
  42. mkdir tartest/subdir
  43. mount -t ramfs none tartest/subdir || AT_SKIP_TEST
  44. tar -C subdir -c -f - . | tar -C tartest/subdir -x -f -
  45. echo "# Level 1"
  46. cp archive-0.snar archive-1.snar
  47. tar $options --file archive-1.tar --listed-incremental=archive-1.snar .
  48. umount tartest/subdir
  49. ],
  50. [0],
  51. [# Level 0
  52. ./
  53. ./subdir/
  54. ./top-level-file
  55. ./subdir/subdir-file
  56. # Remount
  57. # Level 1
  58. ./
  59. ./subdir/
  60. ],
  61. [tar: .: Directory is new
  62. tar: ./subdir: Directory is new
  63. tar: ./subdir: directory is on a different filesystem; not dumped
  64. ],[],[],[gnu])
  65. AT_CLEANUP