From a40e565719314287a3c4abcf5909d77bfb19797d Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sun, 10 Mar 2013 11:29:04 +0200 Subject: [PATCH] Fix interaction of various --exclude-tag options with --listed-incremental. * src/incremen.c (procdir): Set directory->tagfile in the exclusion_tag_contents case. (makedumpdir): Mark all entries as ignored if directory->tagfile is set. Free new_dump before returning. (maketagdumpdir): New function. (scan_directory): If directory->children is set to NO_CHILDREN and directory->tagfile is set, create a dumpdir consisting of the tagfile only. * tests/exclude08.at: New testcase. * tests/exclude09.at: New testcase. * tests/exclude10.at: New testcase. * tests/exclude11.at: New testcase. * tests/exclude12.at: New testcase. * tests/exclude13.at: New testcase. * tests/exclude14.at: New testcase. * tests/exclude15.at: New testcase. * tests/exclude16.at: New testcase. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Include new tests. * tests/atlocal.in (mkexcltest): New function. * tests/chtype.at: Update keywords. * tests/filerem01.at: Likewise. * tests/filerem02.at: Likewise. * tests/incremental.at: Likewise. * tests/multiv04.at: Likewise. --- src/incremen.c | 170 ++++++++++++++++++++++++------------------- tests/Makefile.am | 9 +++ tests/atlocal.in | 8 ++ tests/chtype.at | 2 +- tests/exclude08.at | 53 ++++++++++++++ tests/exclude09.at | 56 ++++++++++++++ tests/exclude10.at | 72 ++++++++++++++++++ tests/exclude11.at | 52 +++++++++++++ tests/exclude12.at | 55 ++++++++++++++ tests/exclude13.at | 72 ++++++++++++++++++ tests/exclude14.at | 51 +++++++++++++ tests/exclude15.at | 53 ++++++++++++++ tests/exclude16.at | 70 ++++++++++++++++++ tests/filerem01.at | 2 +- tests/filerem02.at | 2 +- tests/incremental.at | 2 +- tests/multiv04.at | 2 +- tests/testsuite.at | 9 +++ 18 files changed, 662 insertions(+), 78 deletions(-) create mode 100644 tests/exclude08.at create mode 100644 tests/exclude09.at create mode 100644 tests/exclude10.at create mode 100644 tests/exclude11.at create mode 100644 tests/exclude12.at create mode 100644 tests/exclude13.at create mode 100644 tests/exclude14.at create mode 100644 tests/exclude15.at create mode 100644 tests/exclude16.at diff --git a/src/incremen.c b/src/incremen.c index 1d20c44..557df30 100644 --- a/src/incremen.c +++ b/src/incremen.c @@ -609,6 +609,7 @@ procdir (const char *name_buffer, struct tar_stat_info *st, exclusion_tag_warning (name_buffer, tag_file_name, _("contents not dumped")); directory->children = NO_CHILDREN; + directory->tagfile = tag_file_name; break; case exclusion_tag_under: @@ -680,15 +681,13 @@ makedumpdir (struct directory *directory, const char *dir) if (loc) { if (directory->tagfile) - *new_dump_ptr = strcmp (directory->tagfile, array[i]) == 0 ? - ' ' : 'I'; + *new_dump_ptr = 'I'; else *new_dump_ptr = ' '; new_dump_ptr++; } else if (directory->tagfile) - *new_dump_ptr++ = strcmp (directory->tagfile, array[i]) == 0 ? - ' ' : 'I'; + *new_dump_ptr++ = 'I'; else *new_dump_ptr++ = 'Y'; /* New entry */ @@ -699,9 +698,26 @@ makedumpdir (struct directory *directory, const char *dir) *new_dump_ptr = 0; directory->idump = directory->dump; directory->dump = dumpdir_create0 (new_dump, NULL); + free (new_dump); free (array); } +/* Create a dumpdir containing only one entry: that for the + tagfile. */ +static void +maketagdumpdir (struct directory *directory) +{ + size_t len = strlen (directory->tagfile) + 1; + char *new_dump = xmalloc (len + 2); + new_dump[0] = 'Y'; + memcpy (new_dump + 1, directory->tagfile, len); + new_dump[len + 1] = 0; + + directory->idump = directory->dump; + directory->dump = dumpdir_create0 (new_dump, NULL); + free (new_dump); +} + /* Recursively scan the directory identified by ST. */ struct directory * scan_directory (struct tar_stat_info *st) @@ -729,86 +745,94 @@ scan_directory (struct tar_stat_info *st) nbuf = namebuf_create (dir); - if (dirp && directory->children != NO_CHILDREN) + if (dirp) { - char *entry; /* directory entry being scanned */ - struct dumpdir_iter *itr; - - makedumpdir (directory, dirp); - - for (entry = dumpdir_first (directory->dump, 1, &itr); - entry; - entry = dumpdir_next (itr)) + if (directory->children != NO_CHILDREN) { - char *full_name = namebuf_name (nbuf, entry + 1); - - if (*entry == 'I') /* Ignored entry */ - *entry = 'N'; - else if (excluded_name (full_name)) - *entry = 'N'; - else - { - int fd = st->fd; - void (*diag) (char const *) = 0; - struct tar_stat_info stsub; - tar_stat_init (&stsub); + char *entry; /* directory entry being scanned */ + struct dumpdir_iter *itr; - if (fd < 0) - { - errno = - fd; - diag = open_diag; - } - else if (fstatat (fd, entry + 1, &stsub.stat, fstatat_flags) != 0) - diag = stat_diag; - else if (S_ISDIR (stsub.stat.st_mode)) - { - int subfd = subfile_open (st, entry + 1, open_read_flags); - if (subfd < 0) - diag = open_diag; - else - { - stsub.fd = subfd; - if (fstat (subfd, &stsub.stat) != 0) - diag = stat_diag; - } - } + makedumpdir (directory, dirp); - if (diag) - { - file_removed_diag (full_name, false, diag); - *entry = 'N'; - } - else if (S_ISDIR (stsub.stat.st_mode)) - { - int pd_flag = 0; - if (!recursion_option) - pd_flag |= PD_FORCE_CHILDREN | NO_CHILDREN; - else if (directory->children == ALL_CHILDREN) - pd_flag |= PD_FORCE_CHILDREN | ALL_CHILDREN; - *entry = 'D'; - - stsub.parent = st; - procdir (full_name, &stsub, pd_flag, entry); - restore_parent_fd (&stsub); - } - else if (one_file_system_option && device != stsub.stat.st_dev) + for (entry = dumpdir_first (directory->dump, 1, &itr); + entry; + entry = dumpdir_next (itr)) + { + char *full_name = namebuf_name (nbuf, entry + 1); + + if (*entry == 'I') /* Ignored entry */ *entry = 'N'; - else if (*entry == 'Y') - /* New entry, skip further checks */; - /* FIXME: if (S_ISHIDDEN (stat_data.st_mode))?? */ - else if (OLDER_STAT_TIME (stsub.stat, m) - && (!after_date_option - || OLDER_STAT_TIME (stsub.stat, c))) + else if (excluded_name (full_name)) *entry = 'N'; else - *entry = 'Y'; + { + int fd = st->fd; + void (*diag) (char const *) = 0; + struct tar_stat_info stsub; + tar_stat_init (&stsub); - tar_stat_destroy (&stsub); + if (fd < 0) + { + errno = - fd; + diag = open_diag; + } + else if (fstatat (fd, entry + 1, &stsub.stat, + fstatat_flags) != 0) + diag = stat_diag; + else if (S_ISDIR (stsub.stat.st_mode)) + { + int subfd = subfile_open (st, entry + 1, + open_read_flags); + if (subfd < 0) + diag = open_diag; + else + { + stsub.fd = subfd; + if (fstat (subfd, &stsub.stat) != 0) + diag = stat_diag; + } + } + + if (diag) + { + file_removed_diag (full_name, false, diag); + *entry = 'N'; + } + else if (S_ISDIR (stsub.stat.st_mode)) + { + int pd_flag = 0; + if (!recursion_option) + pd_flag |= PD_FORCE_CHILDREN | NO_CHILDREN; + else if (directory->children == ALL_CHILDREN) + pd_flag |= PD_FORCE_CHILDREN | ALL_CHILDREN; + *entry = 'D'; + + stsub.parent = st; + procdir (full_name, &stsub, pd_flag, entry); + restore_parent_fd (&stsub); + } + else if (one_file_system_option && + device != stsub.stat.st_dev) + *entry = 'N'; + else if (*entry == 'Y') + /* New entry, skip further checks */; + /* FIXME: if (S_ISHIDDEN (stat_data.st_mode))?? */ + else if (OLDER_STAT_TIME (stsub.stat, m) + && (!after_date_option + || OLDER_STAT_TIME (stsub.stat, c))) + *entry = 'N'; + else + *entry = 'Y'; + + tar_stat_destroy (&stsub); + } } + free (itr); } - free (itr); + else if (directory->tagfile) + maketagdumpdir (directory); } - + namebuf_free (nbuf); free (dirp); diff --git a/tests/Makefile.am b/tests/Makefile.am index 320d78f..500de89 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -65,6 +65,15 @@ TESTSUITE_AT = \ exclude05.at\ exclude06.at\ exclude07.at\ + exclude08.at\ + exclude09.at\ + exclude10.at\ + exclude11.at\ + exclude12.at\ + exclude13.at\ + exclude14.at\ + exclude15.at\ + exclude16.at\ extrac01.at\ extrac02.at\ extrac03.at\ diff --git a/tests/atlocal.in b/tests/atlocal.in index b10397a..2bef145 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -49,3 +49,11 @@ decho() { echo $* echo >&2 $* } + +mkexcltest() { + mkdir $1 $1/subdir + genfile --file=$1/top-level-file + genfile --file=$1/subdir/excludeme + genfile --file=$1/subdir/subdir-file +} + \ No newline at end of file diff --git a/tests/chtype.at b/tests/chtype.at index cebd6cf..e5b5876 100644 --- a/tests/chtype.at +++ b/tests/chtype.at @@ -25,7 +25,7 @@ # References: <200605101232.25031.bugreport@wkleff.intergenia.de> AT_SETUP([changed file types in incrementals]) -AT_KEYWORDS([incremental chtype]) +AT_KEYWORDS([incremental listed chtype]) AT_TAR_CHECK([ AT_SORT_PREREQ diff --git a/tests/exclude08.at b/tests/exclude08.at new file mode 100644 index 0000000..ccd26c9 --- /dev/null +++ b/tests/exclude08.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. + +# This file is part of GNU tar. + +# 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 . + +# The --exclude-tag options interacted incorrectly with --listed-incremental +# since their very inception. The testcases exclude08 through exclude16 +# verify that --exclude-tag operates consistently whether or not +# --listed-incremental option is given. +# +# This testcase verifies whether the --exclude-tag option alone works +# as expected, i.e. excludes the contents of the directory containing +# the tag, but preserves the directory and the tag itself. +# +# Reported-by: Nathan Stratton Treadway +# Last-Affected-Version: 1.26 +# References: <20120528140419.GT2654@shire.ontko.com>, +# <20130311210006.GA3732@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2012-06/msg00013.html + +AT_SETUP([--exclude-tag option]) +AT_KEYWORDS([exclude exclude-tag exclude08]) + +AT_TAR_CHECK([ +mkexcltest etest +tar -c -f etest.tar --exclude-tag=excludeme -v etest +], +[0], +[etest/ +etest/subdir/ +etest/subdir/excludeme +etest/top-level-file +], +[tar: etest/subdir/: contains a cache directory tag excludeme; contents not dumped +]) + +AT_CLEANUP + diff --git a/tests/exclude09.at b/tests/exclude09.at new file mode 100644 index 0000000..6ccfb18 --- /dev/null +++ b/tests/exclude09.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. + +# This file is part of GNU tar. + +# 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 . + +# The --exclude-tag options interacted incorrectly with --listed-incremental +# since their very inception. The testcases exclude08 through exclude16 +# verify that --exclude-tag operates consistently whether or not +# --listed-incremental option is given. +# +# This testcase verifies whether the --exclude-tag option works +# as expected whe used together with --listed-incremental, i.e. excludes +# the contents of the directory containing the tag, but preserves the +# directory and the tag itself. +# +# Reported-by: Nathan Stratton Treadway +# Last-Affected-Version: 1.26 +# References: <20120528140419.GT2654@shire.ontko.com>, +# <20130311210006.GA3732@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2012-06/msg00013.html + +AT_SETUP([--exclude-tag option and --listed-incremental]) +AT_KEYWORDS([exclude exclude-tag listed incremental exclude09]) + +AT_TAR_CHECK([ +mkexcltest etest +tar -c -f etest.tar --exclude-tag=excludeme --listed=snar -v etest +], +[0], +[etest/ +etest/subdir/ +etest/top-level-file +etest/subdir/excludeme +], +[tar: etest: Directory is new +tar: etest/subdir: Directory is new +tar: etest/subdir: contains a cache directory tag excludeme; contents not dumped +],[],[],[gnu]) + +AT_CLEANUP + diff --git a/tests/exclude10.at b/tests/exclude10.at new file mode 100644 index 0000000..c95cb53 --- /dev/null +++ b/tests/exclude10.at @@ -0,0 +1,72 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- +# +# Test suite for GNU tar. +# Copyright 2013 Free Software Foundation, Inc. + +# This file is part of GNU tar. + +# 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 . + +# The --exclude-tag options interacted incorrectly with --listed-incremental +# since their very inception. The testcases exclude08 through exclude16 +# verify that --exclude-tag operates consistently whether or not +# --listed-incremental option is given. +# +# This testcase verifies whether the --exclude-tag option works +# as expected when used in conjunction with --listed-incremental. +# If the exclusion tag is created after the level 0 dump, the level +# 1 dump must skip the affected subdirectory and any previously-included +# files within it, but preserve the directory and the tag itself. +# +# Reported-by: Nathan Stratton Treadway +# Last-Affected-Version: 1.26 +# References: <20120528140419.GT2654@shire.ontko.com>, +# <20130311210006.GA3732@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2012-06/msg00013.html + +AT_SETUP([--exclude-tag option in incremental pass]) +AT_KEYWORDS([exclude exclude-tag listed incremental exclude10]) + +AT_TAR_CHECK([ +mkexcltest etest +rm etest/subdir/excludeme +decho "# Level 0" +tar -c -f etest-0.tar --exclude-tag=excludeme --listed=snar-0 -v etest +touch etest/subdir/excludeme +touch etest/subdir/otherfile + +decho "# Level 1" +cp snar-0 snar-1 +tar -c -f etest-1.tar --exclude-tag=excludeme --listed=snar-1 -v etest +], +[0], +[# Level 0 +etest/ +etest/subdir/ +etest/top-level-file +etest/subdir/subdir-file +# Level 1 +etest/ +etest/subdir/ +etest/subdir/excludeme +], +[# Level 0 +tar: etest: Directory is new +tar: etest/subdir: Directory is new +# Level 1 +tar: etest/subdir: contains a cache directory tag excludeme; contents not dumped +],[],[],[gnu]) + +AT_CLEANUP + diff --git a/tests/exclude11.at b/tests/exclude11.at new file mode 100644 index 0000000..6b5ef51 --- /dev/null +++ b/tests/exclude11.at @@ -0,0 +1,52 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- +# +# Test suite for GNU tar. +# Copyright 2013 Free Software Foundation, Inc. + +# This file is part of GNU tar. + +# 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 . + +# The --exclude-tag options interacted incorrectly with --listed-incremental +# since their very inception. The testcases exclude08 through exclude16 +# verify that --exclude-tag operates consistently whether or not +# --listed-incremental option is given. +# +# This testcase verifies that the --exclude-tag-under option alone works +# as expected, i.e. excludes the contents of the directory containing +# the tag and the tag itself, but preserves the directory. +# +# Reported-by: Nathan Stratton Treadway +# Last-Affected-Version: 1.26 +# References: <20120528140419.GT2654@shire.ontko.com>, +# <20130311210006.GA3732@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2012-06/msg00013.html + +AT_SETUP([--exclude-tag-under option]) +AT_KEYWORDS([exclude exclude-tag exclude-tag-under exclude11]) + +AT_TAR_CHECK([ +mkexcltest etest +tar -c -f etest.tar --exclude-tag-under=excludeme -v etest +], +[0], +[etest/ +etest/subdir/ +etest/top-level-file +], +[tar: etest/subdir/: contains a cache directory tag excludeme; contents not dumped +]) + +AT_CLEANUP + diff --git a/tests/exclude12.at b/tests/exclude12.at new file mode 100644 index 0000000..7121f07 --- /dev/null +++ b/tests/exclude12.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. + +# This file is part of GNU tar. + +# 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 . + +# The --exclude-tag options interacted incorrectly with --listed-incremental +# since their very inception. The testcases exclude08 through exclude16 +# verify that --exclude-tag operates consistently whether or not +# --listed-incremental option is given. +# +# This testcase verifies whether the --exclude-tag-under option works +# as expected whe used together with --listed-incremental, i.e. excludes +# the contents of the directory containing the tag and the tag file, but +# preserves the directory itself. +# +# Reported-by: Nathan Stratton Treadway +# Last-Affected-Version: 1.26 +# References: <20120528140419.GT2654@shire.ontko.com>, +# <20130311210006.GA3732@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2012-06/msg00013.html + +AT_SETUP([--exclude-tag-under and --listed-incremental]) +AT_KEYWORDS([exclude exclude-tag exclude-tag-under listed incremental exclude12]) + +AT_TAR_CHECK([ +mkexcltest etest +tar -c -f etest.tar --exclude-tag-under=excludeme --listed=snar -v etest +], +[0], +[etest/ +etest/subdir/ +etest/top-level-file +], +[tar: etest: Directory is new +tar: etest/subdir: Directory is new +tar: etest/subdir: contains a cache directory tag excludeme; contents not dumped +],[],[],[gnu]) + +AT_CLEANUP + diff --git a/tests/exclude13.at b/tests/exclude13.at new file mode 100644 index 0000000..4a36076 --- /dev/null +++ b/tests/exclude13.at @@ -0,0 +1,72 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- +# +# Test suite for GNU tar. +# Copyright 2013 Free Software Foundation, Inc. + +# This file is part of GNU tar. + +# 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 . + +# The --exclude-tag options interacted incorrectly with --listed-incremental +# since their very inception. The testcases exclude08 through exclude16 +# verify that --exclude-tag operates consistently whether or not +# --listed-incremental option is given. +# +# This testcase verifies whether the --exclude-tag-under option works +# as expected when used in conjunction with --listed-incremental. +# If the exclusion tag is created after the level 0 dump, the level +# 1 dump must skip the affected subdirectory and any previously-included +# files within it, including the tag file, but preserve the directory +# itself. +# +# Reported-by: Nathan Stratton Treadway +# Last-Affected-Version: 1.26 +# References: <20120528140419.GT2654@shire.ontko.com>, +# <20130311210006.GA3732@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2012-06/msg00013.html + +AT_SETUP([--exclude-tag-under option in incremental pass]) +AT_KEYWORDS([exclude exclude-tag exclude-tag-under listed incremental exclude13]) + +AT_TAR_CHECK([ +mkexcltest etest +rm etest/subdir/excludeme +decho "# Level 0" +tar -c -f etest-0.tar --exclude-tag-under=excludeme --listed=snar-0 -v etest +touch etest/subdir/excludeme +touch etest/subdir/otherfile + +decho "# Level 1" +cp snar-0 snar-1 +tar -c -f etest-1.tar --exclude-tag-under=excludeme --listed=snar-1 -v etest +], +[0], +[# Level 0 +etest/ +etest/subdir/ +etest/top-level-file +etest/subdir/subdir-file +# Level 1 +etest/ +etest/subdir/ +], +[# Level 0 +tar: etest: Directory is new +tar: etest/subdir: Directory is new +# Level 1 +tar: etest/subdir: contains a cache directory tag excludeme; contents not dumped +],[],[],[gnu]) + +AT_CLEANUP + diff --git a/tests/exclude14.at b/tests/exclude14.at new file mode 100644 index 0000000..9032366 --- /dev/null +++ b/tests/exclude14.at @@ -0,0 +1,51 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- +# +# Test suite for GNU tar. +# Copyright 2013 Free Software Foundation, Inc. + +# This file is part of GNU tar. + +# 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 . + +# The --exclude-tag options interacted incorrectly with --listed-incremental +# since their very inception. The testcases exclude08 through exclude16 +# verify that --exclude-tag operates consistently whether or not +# --listed-incremental option is given. +# +# This testcase verifies whether the --exclude-tag-all option alone works +# as expected, i.e. excludes entire directory containing the tag, including +# any files located under it. +# +# Reported-by: Nathan Stratton Treadway +# Last-Affected-Version: 1.26 +# References: <20120528140419.GT2654@shire.ontko.com>, +# <20130311210006.GA3732@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2012-06/msg00013.html + +AT_SETUP([--exclude-tag-all option]) +AT_KEYWORDS([exclude exclude-tag exclude-tag-all exclude14]) + +AT_TAR_CHECK([ +mkexcltest etest +tar -c -f etest.tar --exclude-tag-all=excludeme -v etest +], +[0], +[etest/ +etest/top-level-file +], +[tar: etest/subdir/: contains a cache directory tag excludeme; directory not dumped +]) + +AT_CLEANUP + diff --git a/tests/exclude15.at b/tests/exclude15.at new file mode 100644 index 0000000..2c98c35 --- /dev/null +++ b/tests/exclude15.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. + +# This file is part of GNU tar. + +# 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 . + +# The --exclude-tag options interacted incorrectly with --listed-incremental +# since their very inception. The testcases exclude08 through exclude16 +# verify that --exclude-tag operates consistently whether or not +# --listed-incremental option is given. +# +# This testcase verifies whether the --exclude-tag-all option works +# as expected whe used together with --listed-incremental, i.e. excludes +# excludes entire directory containing the tag. +# +# Reported-by: Nathan Stratton Treadway +# Last-Affected-Version: 1.26 +# References: <20120528140419.GT2654@shire.ontko.com>, +# <20130311210006.GA3732@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2012-06/msg00013.html + +AT_SETUP([--exclude-tag-all and --listed-incremental]) +AT_KEYWORDS([exclude exclude-tag exclude-tag-all listed incremental exclude15]) + +AT_TAR_CHECK([ +mkexcltest etest +tar -c -f etest.tar --exclude-tag-all=excludeme --listed=snar -v etest +], +[0], +[etest/ +etest/top-level-file +], +[tar: etest: Directory is new +tar: etest/subdir: Directory is new +tar: etest/subdir: contains a cache directory tag excludeme; directory not dumped +],[],[],[gnu]) + +AT_CLEANUP + diff --git a/tests/exclude16.at b/tests/exclude16.at new file mode 100644 index 0000000..5254ef8 --- /dev/null +++ b/tests/exclude16.at @@ -0,0 +1,70 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- +# +# Test suite for GNU tar. +# Copyright 2013 Free Software Foundation, Inc. + +# This file is part of GNU tar. + +# 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 . + +# The --exclude-tag options interacted incorrectly with --listed-incremental +# since their very inception. The testcases exclude08 through exclude16 +# verify that --exclude-tag operates consistently whether or not +# --listed-incremental option is given. +# +# This testcase verifies whether the --exclude-tag-all option works +# as expected whe used together with --listed-incremental. If the +# exclusion tag is created after the level 0 dump, the level 1 dump +# must skip the entire affected subdirectory and any previously-included +# files within it. +# +# Reported-by: Nathan Stratton Treadway +# Last-Affected-Version: 1.26 +# References: <20120528140419.GT2654@shire.ontko.com>, +# <20130311210006.GA3732@shire.ontko.com>, +# http://lists.gnu.org/archive/html/bug-tar/2012-06/msg00013.html + +AT_SETUP([--exclude-tag-all option in incremental pass]) +AT_KEYWORDS([exclude exclude-tag exclude-tag-all listed incremental exclude16]) + +AT_TAR_CHECK([ +mkexcltest etest +rm etest/subdir/excludeme +decho "# Level 0" +tar -c -f etest-0.tar --exclude-tag-all=excludeme --listed=snar-0 -v etest +touch etest/subdir/excludeme +touch etest/subdir/otherfile + +decho "# Level 1" +cp snar-0 snar-1 +tar -c -f etest-1.tar --exclude-tag-all=excludeme --listed=snar-1 -v etest +], +[0], +[# Level 0 +etest/ +etest/subdir/ +etest/top-level-file +etest/subdir/subdir-file +# Level 1 +etest/ +], +[# Level 0 +tar: etest: Directory is new +tar: etest/subdir: Directory is new +# Level 1 +tar: etest/subdir: contains a cache directory tag excludeme; directory not dumped +],[],[],[gnu]) + +AT_CLEANUP + diff --git a/tests/filerem01.at b/tests/filerem01.at index 56628f0..1c2c519 100644 --- a/tests/filerem01.at +++ b/tests/filerem01.at @@ -34,7 +34,7 @@ # AT_SETUP([file removed as we read it (ca. 22 seconds)]) -AT_KEYWORDS([create incremental filechange filerem filerem01]) +AT_KEYWORDS([create incremental listed filechange filerem filerem01]) AT_TAR_CHECK([ mkdir dir diff --git a/tests/filerem02.at b/tests/filerem02.at index 37b9bee..60f5558 100644 --- a/tests/filerem02.at +++ b/tests/filerem02.at @@ -24,7 +24,7 @@ # in the command line. AT_SETUP([toplevel file removed (ca. 24 seconds)]) -AT_KEYWORDS([create incremental filechange filerem filerem02]) +AT_KEYWORDS([create incremental listed filechange filerem filerem02]) AT_TAR_CHECK([ mkdir dir diff --git a/tests/incremental.at b/tests/incremental.at index bd7dcd8..19e376b 100644 --- a/tests/incremental.at +++ b/tests/incremental.at @@ -21,7 +21,7 @@ # A directory older than the listed entry was skipped completely. AT_SETUP([incremental]) -AT_KEYWORDS([incremental incr00]) +AT_KEYWORDS([incremental listed incr00]) AT_TAR_CHECK([ mkdir structure diff --git a/tests/multiv04.at b/tests/multiv04.at index 6d552fd..e781d85 100644 --- a/tests/multiv04.at +++ b/tests/multiv04.at @@ -34,7 +34,7 @@ # 3. Test the created multi-volume archive. AT_SETUP([split directory members in a MV archive]) -AT_KEYWORDS([multivolume multiv incremental multiv04]) +AT_KEYWORDS([multivolume multiv incremental listed multiv04]) AT_TAR_CHECK([ diff --git a/tests/testsuite.at b/tests/testsuite.at index 37a4bd6..1de7d30 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -210,6 +210,15 @@ m4_include([exclude04.at]) m4_include([exclude05.at]) m4_include([exclude06.at]) m4_include([exclude07.at]) +m4_include([exclude08.at]) +m4_include([exclude09.at]) +m4_include([exclude10.at]) +m4_include([exclude11.at]) +m4_include([exclude12.at]) +m4_include([exclude13.at]) +m4_include([exclude14.at]) +m4_include([exclude15.at]) +m4_include([exclude16.at]) m4_include([delete01.at]) m4_include([delete02.at]) -- 2.45.2