# 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
C
.
./bar
+./file
./foo
+./foo.tar
],
[A
B