listed05.at 2.3 KB

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