link01.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #! /bin/sh
  2. # This file is part of GNU tar testsuite.
  3. # Copyright (C) 2004 Free Software Foundation, Inc.
  4. #
  5. # This program 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 2, or (at your option)
  8. # any later version.
  9. #
  10. # This program 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, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  18. # 02111-1307, USA.
  19. # Problem: If a member with link count > 2 was stored in the archive twice,
  20. # previous versions of tar were not able to extract it, since they
  21. # were trying to link the file to itself, which always failed and
  22. # lead to removing the already extracted copy. This script tests
  23. # the workaround by Paul Eggert that leaves the extracted copy
  24. # untouched.
  25. #
  26. # Reported by: Toby Peterson <toby@apple.com>
  27. #
  28. # References: <2330D503-D20A-11D8-A0CF-00039391EECE@apple.com>
  29. # http://lists.gnu.org/archive/html/bug-tar/2004-07/msg00009.html
  30. . ./preset
  31. . $srcdir/before
  32. mkdir directory
  33. mkdir directory/test1
  34. mkdir directory/test2
  35. echo TEST > directory/test1/test.txt
  36. ln directory/test1/test.txt directory/test2/test.txt
  37. tar cf archive directory/test1/test.txt directory/test1/test.txt
  38. rm -r directory
  39. tar xf archive
  40. ls directory/test1
  41. out="test.txt
  42. "
  43. . $srcdir/after
  44. # End of link01.sh