incr08.at 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2013-2014 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. # Description: In tar 1.26 listed-incremental with -C and absolute path
  18. # would malfunction under certain conditions due to buggy filename
  19. # normalization.
  20. #
  21. # The value returned by normalize_filename() is used to populate the "caname"
  22. # field in both the "directory" structure in incremen.c and the "name"
  23. # structure in names.c, and in both cases that field is then used in the
  24. # "hash" and "compare" functions for the related hash tables. Thus, the
  25. # fact that the returned value doesn't reflect the operation of previous
  26. # "-C" options means that it's possible for two different directories to
  27. # be given the same "caname" value in the hashed structure and thus end up
  28. # being confused with each other.
  29. #
  30. # The bug is triggered when dumping both relative paths after -C and
  31. # absolute paths that match the process' current working directory.
  32. #
  33. # Reported by: Nathan Stratton Treadway <[email protected]>
  34. # References: <[email protected]>,
  35. # http://lists.gnu.org/archive/html/bug-tar/2013-09/msg00034.html
  36. AT_SETUP([filename normalization])
  37. AT_KEYWORDS([incremental create incr08])
  38. AT_TAR_CHECK([
  39. AT_SORT_PREREQ
  40. mkdir tartest
  41. cd tartest
  42. mkdir foo
  43. mkdir foo/subdir
  44. mkdir foo/subdir/dir1
  45. mkdir subdir
  46. mkdir subdir/dir2
  47. decho A
  48. find .|sort
  49. decho B
  50. DIR=`pwd`
  51. tar -cvf ../foo.tar --listed-incremental=../foo.snar -C foo . $DIR 2>../err |\
  52. sed "s|$DIR|ABSPATH|"
  53. sed "s|$DIR|ABSPATH|" ../err >&2
  54. ],
  55. [0],
  56. [A
  57. .
  58. ./foo
  59. ./foo/subdir
  60. ./foo/subdir/dir1
  61. ./subdir
  62. ./subdir/dir2
  63. B
  64. ./
  65. ./subdir/
  66. ./subdir/dir1/
  67. ABSPATH/
  68. ABSPATH/subdir/
  69. ABSPATH/subdir/dir2/
  70. ],
  71. [A
  72. B
  73. tar: .: Directory is new
  74. tar: ./subdir: Directory is new
  75. tar: ./subdir/dir1: Directory is new
  76. tar: ABSPATH: Directory is new
  77. tar: ABSPATH/subdir: Directory is new
  78. tar: ABSPATH/subdir/dir2: Directory is new
  79. tar: Removing leading `/' from member names
  80. ],[],[],[gnu])
  81. AT_CLEANUP