summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am23
-rw-r--r--tests/incr09.at8
-rw-r--r--tests/remfiles04a.at45
-rw-r--r--tests/remfiles04b.at (renamed from tests/remfiles05.at)41
-rw-r--r--tests/remfiles04c.at (renamed from tests/remfiles04.at)21
-rw-r--r--tests/remfiles05a.at64
-rw-r--r--tests/remfiles05b.at55
-rw-r--r--tests/remfiles05c.at (renamed from tests/remfiles06.at)34
-rw-r--r--tests/remfiles06a.at56
-rw-r--r--tests/remfiles06b.at56
-rw-r--r--tests/remfiles06c.at68
-rw-r--r--tests/remfiles07a.at56
-rw-r--r--tests/remfiles07b.at56
-rw-r--r--tests/remfiles07c.at68
-rw-r--r--tests/remfiles08a.at56
-rw-r--r--tests/remfiles08b.at56
-rw-r--r--tests/remfiles08c.at68
-rw-r--r--tests/remfiles09a.at (renamed from tests/remfiles08.at)27
-rw-r--r--tests/remfiles09b.at57
-rw-r--r--tests/remfiles09c.at (renamed from tests/remfiles07.at)37
-rw-r--r--tests/testsuite.at23
21 files changed, 884 insertions, 91 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 940c94f3..fc72c519 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -163,11 +163,24 @@ TESTSUITE_AT = \
remfiles01.at\
remfiles02.at\
remfiles03.at\
- remfiles04.at\
- remfiles05.at\
- remfiles06.at\
- remfiles07.at\
- remfiles08.at\
+ remfiles04a.at\
+ remfiles04b.at\
+ remfiles04c.at\
+ remfiles05a.at\
+ remfiles05b.at\
+ remfiles05c.at\
+ remfiles06a.at\
+ remfiles06b.at\
+ remfiles06c.at\
+ remfiles07a.at\
+ remfiles07b.at\
+ remfiles07c.at\
+ remfiles08a.at\
+ remfiles08b.at\
+ remfiles08c.at\
+ remfiles09a.at\
+ remfiles09b.at\
+ remfiles09c.at\
same-order01.at\
same-order02.at\
shortfile.at\
diff --git a/tests/incr09.at b/tests/incr09.at
index b6130a61..e91fb5a1 100644
--- a/tests/incr09.at
+++ b/tests/incr09.at
@@ -15,6 +15,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Description: For some intermediate versions of tar 1.26.90,
+# tar would fail to correctly cannonicalize archive member names
+# in incremental mode if there was a -C options with an absolute path
+# on the command line without any archive members specified within that
+# directory. (In that case, the canonical name generated for
+# members specified after later -C options wouldn't correctly reflect the
+# previous absolute path.)
+
AT_SETUP([incremental with alternating -C])
AT_KEYWORDS([incremental create incr09])
diff --git a/tests/remfiles04a.at b/tests/remfiles04a.at
new file mode 100644
index 00000000..d1e46148
--- /dev/null
+++ b/tests/remfiles04a.at
@@ -0,0 +1,45 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of a single relative-path -C option,
+# in --create/non-incremental mode.
+#
+
+AT_SETUP([remove-files with -C:rel in -c/non-incr. mode])
+AT_KEYWORDS([create remove-files remfiles04 remfiles04a])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+echo bar > bar
+echo foobar > foo/bar
+tar -cf foo.tar --remove-files -C foo bar
+echo A
+find . | sort
+],
+[0],
+[A
+.
+./bar
+./foo
+./foo.tar
+],[],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles05.at b/tests/remfiles04b.at
index 04425a7d..32085573 100644
--- a/tests/remfiles05.at
+++ b/tests/remfiles04b.at
@@ -15,26 +15,31 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Description: Tar 1.26 would remove wrong files when invoked with
-# --listed-incremental and -C
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of a single relative-path -C option,
+# in --create/incremental mode.
+#
+# (Tar 1.26 would remove files in original working directory when called in
+# this manner. [It would follow the -C for archiving the files, but ignore it
+# for removing them afterwards.]
+#
# Reported by: Nathan Stratton Treadway <nathanst@ontko.com>
# References: <20130921171234.GG32256@shire.ontko.com>,
# http://lists.gnu.org/archive/html/bug-tar/2013-09/msg00028.html
+# )
-AT_SETUP([incremental and -C])
-AT_KEYWORDS([incremental create remove-files remfiles05])
+AT_SETUP([remove-files with -C:rel in -c/incr. mode])
+AT_KEYWORDS([create incremental remove-files remfiles04 remfiles04b])
AT_TAR_CHECK([
AT_SORT_PREREQ
mkdir foo
echo bar > bar
-echo foo/bar > foo/bar
-decho A
-find . | sort
-
-decho B
-tar -cvf foo.tar --listed-incremental=foo.snar --remove-files -C foo bar
-decho C
+echo foobar > foo/bar
+tar -cf foo.tar --incremental --remove-files -C foo bar
+echo A
find . | sort
],
[0],
@@ -42,19 +47,7 @@ find . | sort
.
./bar
./foo
-./foo/bar
-B
-bar
-C
-.
-./bar
-./foo
-./foo.snar
./foo.tar
-],
-[A
-B
-C
-],[],[],[gnu])
+],[],[],[],[gnu])
AT_CLEANUP
diff --git a/tests/remfiles04.at b/tests/remfiles04c.at
index 04df45bf..a1b6d561 100644
--- a/tests/remfiles04.at
+++ b/tests/remfiles04c.at
@@ -15,24 +15,32 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Description: Tar 1.26 would remove wrong files when called with
-# --remove-files and -C
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of a single relative-path -C option,
+# in --append mode.
+#
+# (Tar 1.26 would remove files in original working directory when called in
+# this manner. [It would follow the -C for archiving the files, but ignore it
+# for removing them afterwards.]
+#
# Reported by: Jörgen Strand <Jorgen.Strand@sonymobile.com>
# References: <9FC79E5CB90CEC47B9647DCAB7BD327A01AD83B452EE@seldmbx02.corpusers.net>
# http://lists.gnu.org/archive/html/bug-tar/2013-09/msg00024.html
+# )
-AT_SETUP([remove-files with -C])
-AT_KEYWORDS([create remove-files remfiles04])
+AT_SETUP([remove-files with -C:rel in -r mode])
+AT_KEYWORDS([create append remove-files remfiles04 remfiles04c])
AT_TAR_CHECK([
AT_SORT_PREREQ
mkdir foo
echo bar > bar
echo foobar > foo/bar
-tar -cf foo.tar --remove-files -C foo bar
+tar -cf foo.tar -C foo bar
echo A
find . | sort
-echo foobar > foo/bar
tar -rf foo.tar --remove-files -C foo bar
echo B
find . | sort
@@ -43,6 +51,7 @@ find . | sort
./bar
./foo
./foo.tar
+./foo/bar
B
.
./bar
diff --git a/tests/remfiles05a.at b/tests/remfiles05a.at
new file mode 100644
index 00000000..4ceec37e
--- /dev/null
+++ b/tests/remfiles05a.at
@@ -0,0 +1,64 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of two relative-path -C options,
+# in --create/non-incremental mode.
+#
+# (This specific case failed during development of tar 1.26.90:
+# There was a leftover call to chdir in name_next_elt() in
+# tar 1.26. After commit e3d28d84 this call would confuse the
+# tar_getcwd function.
+#
+# Reported by: Nathan Stratton Treadway <nathanst@ontko.com>
+# References: <20130924145657.GM32256@shire.ontko.com>,
+# http://lists.gnu.org/archive/html/bug-tar/2013-09/msg00045.html
+# )
+
+AT_SETUP([remove-files with -C:rel,rel in -c/non-incr. mode])
+AT_KEYWORDS([create remove-files remfiles05 remfiles05a])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+decho A
+tar -cvf foo.tar --remove-files -C foo file -C ../bar file
+decho B
+find . | sort
+],
+[0],
+[A
+file
+file
+B
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles05b.at b/tests/remfiles05b.at
new file mode 100644
index 00000000..d120efd2
--- /dev/null
+++ b/tests/remfiles05b.at
@@ -0,0 +1,55 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of two relative-path -C options,
+# in --create/incremental mode.
+#
+
+AT_SETUP([remove-files with -C:rel,rel in -c/incr. mode])
+AT_KEYWORDS([create incremental remove-files remfiles05 remfiles05b])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+decho A
+tar -cvf foo.tar --incremental --remove-files -C foo file -C ../bar file
+decho B
+find . | sort
+],
+[0],
+[A
+file
+file
+B
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles06.at b/tests/remfiles05c.at
index 3c3dbf4e..a01b0920 100644
--- a/tests/remfiles06.at
+++ b/tests/remfiles05c.at
@@ -15,39 +15,39 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Description: There was a leftover call to chdir in name_next_elt() in
-# tar 1.26. After commit e3d28d84 this call would confuse the tar_getcwd
-# function.
-# Reported by: Nathan Stratton Treadway <nathanst@ontko.com>
-# References: <20130924145657.GM32256@shire.ontko.com>,
-# http://lists.gnu.org/archive/html/bug-tar/2013-09/msg00045.html
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of two relative-path -C options,
+# in --append mode.
+#
-AT_SETUP([remove with two -C])
-AT_KEYWORDS([remove-files remfiles06])
+AT_SETUP([remove-files with -C:rel,rel in -r mode])
+AT_KEYWORDS([create append remove-files remfiles05 remfiles05c])
AT_TAR_CHECK([
AT_SORT_PREREQ
-mkdir tartest
-cd tartest
mkdir foo
-echo foo/file > foo/file
mkdir bar
+echo file > file
+echo foo/file > foo/file
echo bar/file > bar/file
+tar -cf foo.tar -C foo file -C ../bar file
decho A
-find|sort
-
+find . | sort
decho B
-tar -cvf ../foo.tar --remove-files -C foo file -C ../bar file
-
+tar -rvf foo.tar --remove-files -C foo file -C ../bar file
decho C
-find|sort
+find . | sort
],
[0],
[A
.
./bar
./bar/file
+./file
./foo
+./foo.tar
./foo/file
B
file
@@ -55,7 +55,9 @@ file
C
.
./bar
+./file
./foo
+./foo.tar
],
[A
B
diff --git a/tests/remfiles06a.at b/tests/remfiles06a.at
new file mode 100644
index 00000000..fe762c1e
--- /dev/null
+++ b/tests/remfiles06a.at
@@ -0,0 +1,56 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of a relative -C option followed by an absolute -C,
+# in --create/non-incremental mode.
+#
+
+AT_SETUP([remove-files with -C:rel,abs in -c/non-incr. mode])
+AT_KEYWORDS([create remove-files remfiles06 remfiles06a])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+DIR=`pwd`
+decho A
+tar -cvf foo.tar --remove-files -C foo file -C $DIR/bar file
+decho B
+find . | sort
+],
+[0],
+[A
+file
+file
+B
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles06b.at b/tests/remfiles06b.at
new file mode 100644
index 00000000..3b867fbc
--- /dev/null
+++ b/tests/remfiles06b.at
@@ -0,0 +1,56 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of a relative -C option followed by an absolute -C,
+# in --create/incremental mode.
+#
+
+AT_SETUP([remove-files with -C:rel,abs in -c/incr. mode])
+AT_KEYWORDS([create incremental remove-files remfiles06 remfiles06b])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+DIR=`pwd`
+decho A
+tar -cvf foo.tar --incremental --remove-files -C foo file -C $DIR/bar file
+decho B
+find . | sort
+],
+[0],
+[A
+file
+file
+B
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles06c.at b/tests/remfiles06c.at
new file mode 100644
index 00000000..ad9164d2
--- /dev/null
+++ b/tests/remfiles06c.at
@@ -0,0 +1,68 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of a relative -C option followed by an absolute -C,
+# in --append mode.
+#
+
+AT_SETUP([remove-files with -C:rel,abs in -r mode])
+AT_KEYWORDS([create append remove-files remfiles06 remfiles06c])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+DIR=`pwd`
+tar -cf foo.tar -C foo file -C $DIR/bar file
+decho A
+find . | sort
+decho B
+tar -rvf foo.tar --remove-files -C foo file -C ../bar file
+decho C
+find . | sort
+],
+[0],
+[A
+.
+./bar
+./bar/file
+./file
+./foo
+./foo.tar
+./foo/file
+B
+file
+file
+C
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+C
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles07a.at b/tests/remfiles07a.at
new file mode 100644
index 00000000..95f645ce
--- /dev/null
+++ b/tests/remfiles07a.at
@@ -0,0 +1,56 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of a relative -C option followed by an absolute -C,
+# in --create/non-incremental mode.
+#
+
+AT_SETUP([remove-files with -C:rel,abs in -c/non-incr. mode])
+AT_KEYWORDS([create remove-files remfiles07 remfiles07a])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+DIR=`pwd`
+decho A
+tar -cvf foo.tar --remove-files -C foo file -C $DIR/bar file
+decho B
+find . | sort
+],
+[0],
+[A
+file
+file
+B
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles07b.at b/tests/remfiles07b.at
new file mode 100644
index 00000000..ca67e5da
--- /dev/null
+++ b/tests/remfiles07b.at
@@ -0,0 +1,56 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of a relative -C option followed by an absolute -C,
+# in --create/incremental mode.
+#
+
+AT_SETUP([remove-files with -C:rel,abs in -c/incr. mode])
+AT_KEYWORDS([create incremental remove-files remfiles07 remfiles07b])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+DIR=`pwd`
+decho A
+tar -cvf foo.tar --incremental --remove-files -C foo file -C $DIR/bar file
+decho B
+find . | sort
+],
+[0],
+[A
+file
+file
+B
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles07c.at b/tests/remfiles07c.at
new file mode 100644
index 00000000..6a5c8708
--- /dev/null
+++ b/tests/remfiles07c.at
@@ -0,0 +1,68 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of a relative -C option followed by an absolute -C,
+# in --append mode.
+#
+
+AT_SETUP([remove-files with -C:rel,abs in -r mode])
+AT_KEYWORDS([create append remove-files remfiles07 remfiles07c])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+DIR=`pwd`
+tar -cf foo.tar -C foo file -C $DIR/bar file
+decho A
+find . | sort
+decho B
+tar -rvf foo.tar --remove-files -C foo file -C $DIR/bar file
+decho C
+find . | sort
+],
+[0],
+[A
+.
+./bar
+./bar/file
+./file
+./foo
+./foo.tar
+./foo/file
+B
+file
+file
+C
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+C
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles08a.at b/tests/remfiles08a.at
new file mode 100644
index 00000000..eadf1491
--- /dev/null
+++ b/tests/remfiles08a.at
@@ -0,0 +1,56 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of an absolute -C option followed by a relative -C,
+# in --create/non-incremental mode.
+#
+
+AT_SETUP([remove-files with -C:abs,rel in -c/non-incr. mode])
+AT_KEYWORDS([create remove-files remfiles08 remfiles08a])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+DIR=`pwd`
+decho A
+tar -cvf foo.tar --remove-files -C $DIR/foo file -C ../bar file
+decho B
+find . | sort
+],
+[0],
+[A
+file
+file
+B
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles08b.at b/tests/remfiles08b.at
new file mode 100644
index 00000000..9faf2bba
--- /dev/null
+++ b/tests/remfiles08b.at
@@ -0,0 +1,56 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of an absolute -C option followed by a relative -C,
+# in --create/incremental mode.
+#
+
+AT_SETUP([remove-files with -C:abs,rel in -c/incr. mode])
+AT_KEYWORDS([create incremental remove-files remfiles08 remfiles08b])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+DIR=`pwd`
+decho A
+tar -cvf foo.tar --incremental --remove-files -C $DIR/foo file -C ../bar file
+decho B
+find . | sort
+],
+[0],
+[A
+file
+file
+B
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles08c.at b/tests/remfiles08c.at
new file mode 100644
index 00000000..a220f4ca
--- /dev/null
+++ b/tests/remfiles08c.at
@@ -0,0 +1,68 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar correctly respects -C option when deleting
+# files due to the --remove-files option.
+#
+# This case checks the use of an absolute -C option followed by a relative -C,
+# in --append mode.
+#
+
+AT_SETUP([remove-files with -C:abs,rel in -r mode])
+AT_KEYWORDS([create append remove-files remfiles08 remfiles08c])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+mkdir bar
+echo file > file
+echo foo/file > foo/file
+echo bar/file > bar/file
+DIR=`pwd`
+tar -cf foo.tar -C $DIR/foo file -C ../bar file
+decho A
+find . | sort
+decho B
+tar -rvf foo.tar --remove-files -C $DIR/foo file -C ../bar file
+decho C
+find . | sort
+],
+[0],
+[A
+.
+./bar
+./bar/file
+./file
+./foo
+./foo.tar
+./foo/file
+B
+file
+file
+C
+.
+./bar
+./file
+./foo
+./foo.tar
+],
+[A
+B
+C
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles08.at b/tests/remfiles09a.at
index 0649e85c..fd28b4f1 100644
--- a/tests/remfiles08.at
+++ b/tests/remfiles09a.at
@@ -15,29 +15,28 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Description: See remfiles06.at
-# Reported by: Nathan Stratton Treadway <nathanst@ontko.com>
-# References: <20130926050634.GW32256@shire.ontko.com>
+# Description: check --remove-files operation when archiving/deleting
+# directory trees.
+#
+# This case checks the operation
+# in --create/non-incremental mode.
+#
-AT_SETUP([remove with -C to absolute and relative paths])
-AT_KEYWORDS([incremental create remove-files remfiles08])
+AT_SETUP([remove-files on full directory in -c/non-incr. mode])
+AT_KEYWORDS([create remove-files remfiles09 remfiles09a])
AT_TAR_CHECK([
mkdir foo
-mkdir bar
-echo foo/foo_file > foo/foo_file
-echo bar/bar_file > bar/bar_file
+echo foo/file > foo/file
decho A
-tar -cvf foo.tar --remove-files -C `pwd`/foo . -C ../bar .
+tar -cvf foo.tar --remove-files foo
decho B
-find
+find .
],
[0],
[A
-./
-./foo_file
-./
-./bar_file
+foo/
+foo/file
B
.
./foo.tar
diff --git a/tests/remfiles09b.at b/tests/remfiles09b.at
new file mode 100644
index 00000000..30cc3eeb
--- /dev/null
+++ b/tests/remfiles09b.at
@@ -0,0 +1,57 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# GNU tar 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 of the License, or
+# (at your option) any later version.
+#
+# GNU tar 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, see <http://www.gnu.org/licenses/>.
+
+# Description: check --remove-files operation when archiving/deleting
+# directory trees.
+#
+# This case checks the operation
+# in --create/incremental mode.
+#
+# Note: in tar 1.27, when run in incremental mode tar will attempt to remove
+# the directory before removing the files within that directory, and thus
+# the --remove-files operation will cause tar to abort with an error status.
+# This issue will be fixed in a later version of tar.
+
+AT_SETUP([remove-files on full directory in -c/incr. mode])
+AT_KEYWORDS([create incremental remove-files remfiles09 remfiles09b])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir foo
+echo foo/file > foo/file
+decho A
+tar -cvf foo.tar --incremental --remove-files foo
+TARSTAT=$?
+decho B
+find .
+test $TARSTAT -ne 0 && AT_SKIP_TEST # we expect to fail in tar 1.27
+],
+[0],
+[A
+foo/
+foo/file
+B
+.
+./foo
+./foo.tar
+],
+[A
+tar: foo: Directory is new
+B
+],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/remfiles07.at b/tests/remfiles09c.at
index 742e0a10..72416084 100644
--- a/tests/remfiles07.at
+++ b/tests/remfiles09c.at
@@ -15,45 +15,40 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Description: See remfiles06.at
-# Reported by: Nathan Stratton Treadway <nathanst@ontko.com>
-# References: <20130924185129.GO32256@shire.ontko.com>
+# Description: check --remove-files operation when archiving/deleting
+# directory trees.
+#
+# This case checks the operation
+# in --append mode.
+#
-AT_SETUP([remove with -C to absolute path])
-AT_KEYWORDS([create remove-files remfiles07])
+AT_SETUP([remove-files on full directory in -r mode])
+AT_KEYWORDS([create append remove-files remfiles09 remfiles09c])
AT_TAR_CHECK([
AT_SORT_PREREQ
-mkdir tartest
-cd tartest
mkdir foo
echo foo/file > foo/file
-mkdir bar
-echo bar/file > bar/file
+tar -cf foo.tar foo
decho A
-find|sort
-
-DIR=`pwd`
+find . | sort
decho B
-tar -cvf ../foo.tar --remove-files -C foo file -C $DIR/bar file
-
+tar -rvf foo.tar --remove-files foo
decho C
-find|sort
+find . | sort
],
[0],
[A
.
-./bar
-./bar/file
./foo
+./foo.tar
./foo/file
B
-file
-file
+foo/
+foo/file
C
.
-./bar
-./foo
+./foo.tar
],
[A
B
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 78562875..b4813021 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -379,11 +379,24 @@ AT_BANNER([Removing files after archiving])
m4_include([remfiles01.at])
m4_include([remfiles02.at])
m4_include([remfiles03.at])
-m4_include([remfiles04.at])
-m4_include([remfiles05.at])
-m4_include([remfiles06.at])
-m4_include([remfiles07.at])
-m4_include([remfiles08.at])
+m4_include([remfiles04a.at])
+m4_include([remfiles04b.at])
+m4_include([remfiles04c.at])
+m4_include([remfiles05a.at])
+m4_include([remfiles05b.at])
+m4_include([remfiles05c.at])
+m4_include([remfiles06a.at])
+m4_include([remfiles06b.at])
+m4_include([remfiles06c.at])
+m4_include([remfiles07a.at])
+m4_include([remfiles07b.at])
+m4_include([remfiles07c.at])
+m4_include([remfiles08a.at])
+m4_include([remfiles08b.at])
+m4_include([remfiles08c.at])
+m4_include([remfiles09a.at])
+m4_include([remfiles09b.at])
+m4_include([remfiles09c.at])
AT_BANNER([Extended attributes])
m4_include([xattr01.at])