incr07.at 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2009-2023 Free Software Foundation, Inc.
  4. #
  5. # GNU tar 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 of the License, or
  8. # (at your option) any later version.
  9. #
  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. #
  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. AT_SETUP([incremental restores with -C])
  18. AT_KEYWORDS([incremental extract incr07 chdir])
  19. # Tar 1.26 had problems extracting from incremental restores when given
  20. # the -C option. The code in incremen.c:try_purge_directory and
  21. # misc.c:remove_any_file was using savedir(), which ignored eventual changes
  22. # in the current working directory and caused the malfunctioning.
  23. #
  24. # The problem was reported by Piotr Rotter on 2013-03-22.
  25. #
  26. # This testcase is based on scripts provided by Piotr Rotter and Nathan
  27. # Stratton Treadway.
  28. #
  29. # References: <[email protected]>,
  30. # http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00036.html,
  31. # <[email protected]>,
  32. # http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00042.html,
  33. # <[email protected]>,
  34. # http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00043.html,
  35. # <[email protected]>,
  36. # http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00044.html
  37. AT_TAR_CHECK([
  38. AT_CHECK_TIMESTAMP
  39. mkdir dirA
  40. echo 'a' > dirA/a
  41. echo 'a' > dirA/b
  42. decho C0
  43. tar -g test.snar -vcf test.0.tar dirA
  44. echo 'a' > dirA/c
  45. decho C1
  46. tar -g test.snar -vcf test.1.tar dirA
  47. rm -f dirA/a
  48. decho C2
  49. tar -g test.snar -vcf test.2.tar dirA
  50. mkdir ext
  51. rm -rf dirA
  52. decho E0
  53. tar -g test.snar -vxf test.0.tar -C ext/
  54. decho E1
  55. tar -g test.snar -vxf test.1.tar -C ext/
  56. decho E2
  57. tar -g test.snar -vxf test.2.tar -C ext/
  58. mkdir ext/dirA/dirB
  59. touch ext/dirA/dirB/file
  60. decho E3
  61. tar -g test.snar -vxf test.2.tar -C ext/
  62. echo FIN
  63. test -d dirA && echo >&2 "toplevel dirA exists"
  64. exit 0
  65. ],
  66. [0],
  67. [C0
  68. dirA/
  69. dirA/a
  70. dirA/b
  71. C1
  72. dirA/
  73. dirA/c
  74. C2
  75. dirA/
  76. E0
  77. dirA/
  78. dirA/a
  79. dirA/b
  80. E1
  81. dirA/
  82. dirA/c
  83. E2
  84. dirA/
  85. tar: Deleting 'dirA/a'
  86. E3
  87. dirA/
  88. tar: Deleting 'dirA/dirB'
  89. FIN
  90. ],
  91. [C0
  92. tar: dirA: Directory is new
  93. C1
  94. C2
  95. E0
  96. E1
  97. E2
  98. E3
  99. ],[],[],[gnu, oldgnu, posix])
  100. AT_CLEANUP