4
0

link01.at 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2004, 2007, 2009, 2013-2014, 2016 Free Software Foundation,
  4. # 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. # Problem: If a member with link count > 2 was stored in the archive twice,
  17. # previous versions of tar were not able to extract it, since they
  18. # were trying to link the file to itself, which always failed and
  19. # lead to removing the already extracted copy. This script tests
  20. # the workaround by Paul Eggert that leaves the extracted copy
  21. # untouched.
  22. #
  23. # Reported by: Toby Peterson <[email protected]>
  24. #
  25. # References: <[email protected]>
  26. # http://lists.gnu.org/archive/html/bug-tar/2004-07/msg00009.html
  27. AT_SETUP([link count gt 2])
  28. AT_KEYWORDS([hardlinks link01])
  29. AT_TAR_CHECK([
  30. mkdir directory
  31. mkdir directory/test1
  32. mkdir directory/test2
  33. echo TEST > directory/test1/test.txt
  34. ln directory/test1/test.txt directory/test2/test.txt || AT_SKIP_TEST
  35. tar cf archive directory/test1/test.txt directory/test1/test.txt
  36. rm -r directory
  37. tar xf archive --warning=no-timestamp
  38. ls directory/test1
  39. ],
  40. [0],
  41. [test.txt
  42. ])
  43. AT_CLEANUP