listed05.at 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. #
  3. # Test suite for GNU tar.
  4. # Copyright 2010, 2013-2014, 2016 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])
  28. AT_TAR_CHECK([
  29. AT_PRIVILEGED_PREREQ
  30. options="-C tartest --create --one-file-system --verbose"
  31. rm -rf archive-[01].snar archive-[01].tar tartest subdir
  32. # Create initial structure
  33. mkdir tartest
  34. echo "hi" > tartest/top-level-file
  35. mkdir tartest/subdir
  36. echo "hi" > tartest/subdir/subdir-file
  37. echo "# Level 0"
  38. tar $options --file archive-0.tar --listed-incremental=archive-0.snar .
  39. echo "# Remount"
  40. mv tartest/subdir .
  41. mkdir tartest/subdir
  42. mount -t ramfs none tartest/subdir || AT_SKIP_TEST
  43. tar -C subdir -c -f - . | tar -C tartest/subdir -x -f -
  44. echo "# Level 1"
  45. cp archive-0.snar archive-1.snar
  46. tar $options --file archive-1.tar --listed-incremental=archive-1.snar .
  47. umount tartest/subdir
  48. ],
  49. [0],
  50. [# Level 0
  51. ./
  52. ./subdir/
  53. ./top-level-file
  54. ./subdir/subdir-file
  55. # Remount
  56. # Level 1
  57. ./
  58. ./subdir/
  59. ],
  60. [tar: .: Directory is new
  61. tar: ./subdir: Directory is new
  62. tar: ./subdir: directory is on a different filesystem; not dumped
  63. ],[],[],[gnu])
  64. AT_CLEANUP