From 3125d311e17c91da85de3bca326cf485523d78a0 Mon Sep 17 00:00:00 2001 From: Nathan Stratton Treadway Date: Sat, 5 Oct 2013 08:53:08 +0300 Subject: [PATCH] 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. --- tests/Makefile.am | 23 +++++++-- tests/incr09.at | 8 +++ tests/remfiles04a.at | 45 ++++++++++++++++ tests/{remfiles05.at => remfiles04b.at} | 41 +++++++-------- tests/{remfiles04.at => remfiles04c.at} | 21 +++++--- tests/remfiles05a.at | 64 +++++++++++++++++++++++ tests/remfiles05b.at | 55 ++++++++++++++++++++ tests/{remfiles06.at => remfiles05c.at} | 34 +++++++------ tests/remfiles06a.at | 56 ++++++++++++++++++++ tests/remfiles06b.at | 56 ++++++++++++++++++++ tests/remfiles06c.at | 68 +++++++++++++++++++++++++ tests/remfiles07a.at | 56 ++++++++++++++++++++ tests/remfiles07b.at | 56 ++++++++++++++++++++ tests/remfiles07c.at | 68 +++++++++++++++++++++++++ tests/remfiles08a.at | 56 ++++++++++++++++++++ tests/remfiles08b.at | 56 ++++++++++++++++++++ tests/remfiles08c.at | 68 +++++++++++++++++++++++++ tests/{remfiles08.at => remfiles09a.at} | 27 +++++----- tests/remfiles09b.at | 57 +++++++++++++++++++++ tests/{remfiles07.at => remfiles09c.at} | 37 ++++++-------- tests/testsuite.at | 23 +++++++-- 21 files changed, 884 insertions(+), 91 deletions(-) create mode 100644 tests/remfiles04a.at rename tests/{remfiles05.at => remfiles04b.at} (63%) rename tests/{remfiles04.at => remfiles04c.at} (69%) create mode 100644 tests/remfiles05a.at create mode 100644 tests/remfiles05b.at rename tests/{remfiles06.at => remfiles05c.at} (65%) create mode 100644 tests/remfiles06a.at create mode 100644 tests/remfiles06b.at create mode 100644 tests/remfiles06c.at create mode 100644 tests/remfiles07a.at create mode 100644 tests/remfiles07b.at create mode 100644 tests/remfiles07c.at create mode 100644 tests/remfiles08a.at create mode 100644 tests/remfiles08b.at create mode 100644 tests/remfiles08c.at rename tests/{remfiles08.at => remfiles09a.at} (66%) create mode 100644 tests/remfiles09b.at rename tests/{remfiles07.at => remfiles09c.at} (68%) diff --git a/tests/Makefile.am b/tests/Makefile.am index 940c94f..fc72c51 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 b6130a6..e91fb5a 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/remfiles04a.at b/tests/remfiles04a.at new file mode 100644 index 0000000..d1e4614 --- /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/remfiles05.at b/tests/remfiles04b.at similarity index 63% rename from tests/remfiles05.at rename to tests/remfiles04b.at index 04425a7..3208557 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 . -# 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 # 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 similarity index 69% rename from tests/remfiles04.at rename to tests/remfiles04c.at index 04df45b..a1b6d56 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 . -# 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 # 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 0000000..4ceec37 --- /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 0000000..d120efd --- /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/remfiles06.at b/tests/remfiles05c.at similarity index 65% rename from tests/remfiles06.at rename to tests/remfiles05c.at index 3c3dbf4..a01b092 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 . -# 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 +# 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 0000000..fe762c1 --- /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 0000000..3b867fb --- /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 0000000..ad9164d --- /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/remfiles07a.at b/tests/remfiles07a.at new file mode 100644 index 0000000..95f645c --- /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 0000000..ca67e5d --- /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 0000000..6a5c870 --- /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/remfiles08a.at b/tests/remfiles08a.at new file mode 100644 index 0000000..eadf149 --- /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 0000000..9faf2bb --- /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 0000000..a220f4c --- /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/remfiles08.at b/tests/remfiles09a.at similarity index 66% rename from tests/remfiles08.at rename to tests/remfiles09a.at index 0649e85..fd28b4f 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 . -# Description: See remfiles06.at -# Reported by: Nathan Stratton Treadway -# 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 0000000..30cc3ee --- /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/remfiles07.at b/tests/remfiles09c.at similarity index 68% rename from tests/remfiles07.at rename to tests/remfiles09c.at index 742e0a1..7241608 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 . -# Description: See remfiles06.at -# Reported by: Nathan Stratton Treadway -# 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 7856287..b481302 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]) -- 2.45.2