Provide comprehensive testcases for various file removal modes.

* tests/Makefile.am: Add new testcases.
* tests/testsuite.at: Likewise.
* tests/incr09.at: Add description.
* tests/remfiles04a.at: New file.
* tests/remfiles05.at: Rename to ...
* tests/remfiles04b.at: ... this.
* tests/remfiles04.at: Rename to ...
* tests/remfiles04c.at: ... this.
* tests/remfiles05a.at: New file.
* tests/remfiles05b.at: New file.
* tests/remfiles06.at: Rename to ...
* tests/remfiles05c.at: ... this.
* tests/remfiles06a.at: New file.
* tests/remfiles06b.at: New file.
* tests/remfiles06c.at: New file.
* tests/remfiles07a.at: New file.
* tests/remfiles07b.at: New file.
* tests/remfiles07c.at: New file.
* tests/remfiles08a.at: New file.
* tests/remfiles08b.at: New file.
* tests/remfiles08c.at: New file.
* tests/remfiles08.at: Rename to ...
* tests/remfiles09a.at: ... this.
* tests/remfiles09b.at: New file.
* tests/remfiles07.at: Rename to ...
* tests/remfiles09c.at: ... this.
This commit is contained in:
Nathan Stratton Treadway
2013-10-05 08:53:08 +03:00
committed by Sergey Poznyakoff
parent 74ce228f6d
commit 3125d311e1
21 changed files with 884 additions and 91 deletions

View File

@@ -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\

View File

@@ -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])

45
tests/remfiles04a.at Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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

64
tests/remfiles05a.at Normal file
View File

@@ -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

55
tests/remfiles05b.at Normal file
View File

@@ -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

View File

@@ -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

56
tests/remfiles06a.at Normal file
View File

@@ -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

56
tests/remfiles06b.at Normal file
View File

@@ -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

68
tests/remfiles06c.at Normal file
View File

@@ -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

56
tests/remfiles07a.at Normal file
View File

@@ -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

56
tests/remfiles07b.at Normal file
View File

@@ -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

68
tests/remfiles07c.at Normal file
View File

@@ -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

56
tests/remfiles08a.at Normal file
View File

@@ -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

56
tests/remfiles08b.at Normal file
View File

@@ -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

68
tests/remfiles08c.at Normal file
View File

@@ -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

View File

@@ -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

57
tests/remfiles09b.at Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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])