link01.at 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2004-2023 Free Software Foundation, Inc.
  4. # This file is part of GNU tar.
  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. # GNU tar is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. # Problem: If a member with link count > 2 was stored in the archive twice,
  16. # previous versions of tar were not able to extract it, since they
  17. # were trying to link the file to itself, which always failed and
  18. # lead to removing the already extracted copy. This script tests
  19. # the workaround by Paul Eggert that leaves the extracted copy
  20. # untouched.
  21. #
  22. # Reported by: Toby Peterson <[email protected]>
  23. #
  24. # References: <[email protected]>
  25. # http://lists.gnu.org/archive/html/bug-tar/2004-07/msg00009.html
  26. AT_SETUP([link count gt 2])
  27. AT_KEYWORDS([hardlinks link01])
  28. AT_TAR_CHECK([
  29. mkdir directory
  30. mkdir directory/test1
  31. mkdir directory/test2
  32. echo TEST > directory/test1/test.txt
  33. ln directory/test1/test.txt directory/test2/test.txt || AT_SKIP_TEST
  34. tar cf archive directory/test1/test.txt directory/test1/test.txt
  35. rm -r directory
  36. tar xf archive --warning=no-timestamp
  37. ls directory/test1
  38. ],
  39. [0],
  40. [test.txt
  41. ])
  42. AT_CLEANUP