From: Nathan Stratton Treadway Date: Sat, 5 Oct 2013 05:53:08 +0000 (+0300) Subject: Provide comprehensive testcases for various file removal modes. X-Git-Tag: release_1_27~6 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=3125d311e17c91da85de3bca326cf485523d78a0;p=debian%2Ftar 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. --- 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 . +# 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/remfiles04.at b/tests/remfiles04.at deleted file mode 100644 index 04df45bf..00000000 --- a/tests/remfiles04.at +++ /dev/null @@ -1,53 +0,0 @@ -# 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 . - -# Description: Tar 1.26 would remove wrong files when called with -# --remove-files and -C -# Reported by: Jörgen Strand -# 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_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 -echo foobar > foo/bar -tar -rf foo.tar --remove-files -C foo bar -echo B -find . | sort -], -[0], -[A -. -./bar -./foo -./foo.tar -B -. -./bar -./foo -./foo.tar -],[],[],[],[gnu]) - -AT_CLEANUP 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 . + +# 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/remfiles04b.at b/tests/remfiles04b.at new file mode 100644 index 00000000..32085573 --- /dev/null +++ b/tests/remfiles04b.at @@ -0,0 +1,53 @@ +# 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 . + +# 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 +# References: <20130921171234.GG32256@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2013-09/msg00028.html +# ) + +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 foobar > foo/bar +tar -cf foo.tar --incremental --remove-files -C foo bar +echo A +find . | sort +], +[0], +[A +. +./bar +./foo +./foo.tar +],[],[],[],[gnu]) + +AT_CLEANUP diff --git a/tests/remfiles04c.at b/tests/remfiles04c.at new file mode 100644 index 00000000..a1b6d561 --- /dev/null +++ b/tests/remfiles04c.at @@ -0,0 +1,62 @@ +# 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 . + +# 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 +# References: <9FC79E5CB90CEC47B9647DCAB7BD327A01AD83B452EE@seldmbx02.corpusers.net> +# http://lists.gnu.org/archive/html/bug-tar/2013-09/msg00024.html +# ) + +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 -C foo bar +echo A +find . | sort +tar -rf foo.tar --remove-files -C foo bar +echo B +find . | sort +], +[0], +[A +. +./bar +./foo +./foo.tar +./foo/bar +B +. +./bar +./foo +./foo.tar +],[],[],[],[gnu]) + +AT_CLEANUP diff --git a/tests/remfiles05.at b/tests/remfiles05.at deleted file mode 100644 index 04425a7d..00000000 --- a/tests/remfiles05.at +++ /dev/null @@ -1,60 +0,0 @@ -# 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 . - -# Description: Tar 1.26 would remove wrong files when invoked with -# --listed-incremental and -C -# Reported by: Nathan Stratton Treadway -# 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_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 -find . | sort -], -[0], -[A -. -./bar -./foo -./foo/bar -B -bar -C -. -./bar -./foo -./foo.snar -./foo.tar -], -[A -B -C -],[],[],[gnu]) - -AT_CLEANUP 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 . + +# 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 +# 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 . + +# 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/remfiles05c.at b/tests/remfiles05c.at new file mode 100644 index 00000000..a01b0920 --- /dev/null +++ b/tests/remfiles05c.at @@ -0,0 +1,67 @@ +# 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 . + +# 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-files with -C:rel,rel in -r mode]) +AT_KEYWORDS([create append remove-files remfiles05 remfiles05c]) + +AT_TAR_CHECK([ +AT_SORT_PREREQ +mkdir foo +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 +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/remfiles06.at b/tests/remfiles06.at deleted file mode 100644 index 3c3dbf4e..00000000 --- a/tests/remfiles06.at +++ /dev/null @@ -1,65 +0,0 @@ -# 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 . - -# 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 -# References: <20130924145657.GM32256@shire.ontko.com>, -# http://lists.gnu.org/archive/html/bug-tar/2013-09/msg00045.html - -AT_SETUP([remove with two -C]) -AT_KEYWORDS([remove-files remfiles06]) - -AT_TAR_CHECK([ -AT_SORT_PREREQ -mkdir tartest -cd tartest -mkdir foo -echo foo/file > foo/file -mkdir bar -echo bar/file > bar/file -decho A -find|sort - -decho B -tar -cvf ../foo.tar --remove-files -C foo file -C ../bar file - -decho C -find|sort -], -[0], -[A -. -./bar -./bar/file -./foo -./foo/file -B -file -file -C -. -./bar -./foo -], -[A -B -C -],[],[],[gnu]) - -AT_CLEANUP 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 . + +# 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 . + +# 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 . + +# 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/remfiles07.at b/tests/remfiles07.at deleted file mode 100644 index 742e0a10..00000000 --- a/tests/remfiles07.at +++ /dev/null @@ -1,63 +0,0 @@ -# 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 . - -# Description: See remfiles06.at -# Reported by: Nathan Stratton Treadway -# References: <20130924185129.GO32256@shire.ontko.com> - -AT_SETUP([remove with -C to absolute path]) -AT_KEYWORDS([create remove-files remfiles07]) - -AT_TAR_CHECK([ -AT_SORT_PREREQ -mkdir tartest -cd tartest -mkdir foo -echo foo/file > foo/file -mkdir bar -echo bar/file > bar/file -decho A -find|sort - -DIR=`pwd` -decho B -tar -cvf ../foo.tar --remove-files -C foo file -C $DIR/bar file - -decho C -find|sort -], -[0], -[A -. -./bar -./bar/file -./foo -./foo/file -B -file -file -C -. -./bar -./foo -], -[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 . + +# 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 . + +# 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 . + +# 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/remfiles08.at b/tests/remfiles08.at deleted file mode 100644 index 0649e85c..00000000 --- a/tests/remfiles08.at +++ /dev/null @@ -1,49 +0,0 @@ -# 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 . - -# Description: See remfiles06.at -# Reported by: Nathan Stratton Treadway -# References: <20130926050634.GW32256@shire.ontko.com> - -AT_SETUP([remove with -C to absolute and relative paths]) -AT_KEYWORDS([incremental create remove-files remfiles08]) - -AT_TAR_CHECK([ -mkdir foo -mkdir bar -echo foo/foo_file > foo/foo_file -echo bar/bar_file > bar/bar_file -decho A -tar -cvf foo.tar --remove-files -C `pwd`/foo . -C ../bar . -decho B -find -], -[0], -[A -./ -./foo_file -./ -./bar_file -B -. -./foo.tar -], -[A -B -],[],[],[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 . + +# 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 . + +# 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 . + +# 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/remfiles09a.at b/tests/remfiles09a.at new file mode 100644 index 00000000..fd28b4f1 --- /dev/null +++ b/tests/remfiles09a.at @@ -0,0 +1,48 @@ +# 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 . + +# Description: check --remove-files operation when archiving/deleting +# directory trees. +# +# This case checks the operation +# in --create/non-incremental mode. +# + +AT_SETUP([remove-files on full directory in -c/non-incr. mode]) +AT_KEYWORDS([create remove-files remfiles09 remfiles09a]) + +AT_TAR_CHECK([ +mkdir foo +echo foo/file > foo/file +decho A +tar -cvf foo.tar --remove-files foo +decho B +find . +], +[0], +[A +foo/ +foo/file +B +. +./foo.tar +], +[A +B +],[],[],[gnu]) + +AT_CLEANUP 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 . + +# 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/remfiles09c.at b/tests/remfiles09c.at new file mode 100644 index 00000000..72416084 --- /dev/null +++ b/tests/remfiles09c.at @@ -0,0 +1,58 @@ +# 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 . + +# Description: check --remove-files operation when archiving/deleting +# directory trees. +# +# This case checks the operation +# in --append mode. +# + +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 foo +echo foo/file > foo/file +tar -cf foo.tar foo +decho A +find . | sort +decho B +tar -rvf foo.tar --remove-files foo +decho C +find . | sort +], +[0], +[A +. +./foo +./foo.tar +./foo/file +B +foo/ +foo/file +C +. +./foo.tar +], +[A +B +C +],[],[],[gnu]) + +AT_CLEANUP 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])