]> git.cworth.org Git - tar/commitdiff
Add hardlinks test (to ensure they are preserved with --remove-files)
authorCarl Worth <cworth@cworth.org>
Thu, 30 Jul 2009 04:26:23 +0000 (21:26 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 30 Jul 2009 11:42:22 +0000 (04:42 -0700)
The new hardlinks.at test case verifies the fix in the previous
commit, (without that change the test fails, and with the change
the test passes).

tests/hardlinks.at [new file with mode: 0644]
tests/testsuite.at

diff --git a/tests/hardlinks.at b/tests/hardlinks.at
new file mode 100644 (file)
index 0000000..9e01ec3
--- /dev/null
@@ -0,0 +1,50 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+
+# Test suite for GNU tar.
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# Problem: hard links not preserved with --remove-files
+# Reported by: "Theodore Y. Ts'o" <tytso@mit.edu>
+# References: <E194EAe-0001lE-00@think.thunk.org>
+# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=188663
+
+AT_SETUP([preserve hard links with --remove-files])
+AT_KEYWORDS([hardlinks])
+
+AT_TAR_CHECK([
+genfile -l 64 -f file1
+link file1 file2
+link file2 file3
+link file3 file4
+tar cf archive --remove-files file1 file2 file3 file4
+tar xf archive
+rm archive
+genfile --stat=st_nlink file1
+genfile --stat=st_nlink file2
+genfile --stat=st_nlink file3
+genfile --stat=st_nlink file4
+],
+[0],
+[4
+4
+4
+4
+])
+
+AT_CLEANUP
+
index a12477d97fb4519edd72371618458e613e9c9ea7..34325d7339a40c8afa206a922a26915ba9dae78e 100644 (file)
@@ -140,6 +140,8 @@ m4_include([extrac07.at])
 
 m4_include([gzip.at])
 
+m4_include([hardlinks.at])
+
 m4_include([incremental.at])
 m4_include([incr01.at])
 m4_include([incr02.at])