Ver Fonte

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.
Sergey Poznyakoff há 12 anos atrás
pai
commit
a40e565719

+ 97 - 73
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);

+ 9 - 0
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\

+ 8 - 0
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
+}
+  

+ 1 - 1
tests/chtype.at

@@ -25,7 +25,7 @@
 # References: <[email protected]>
 
 AT_SETUP([changed file types in incrementals])
-AT_KEYWORDS([incremental chtype])
+AT_KEYWORDS([incremental listed chtype])
 
 AT_TAR_CHECK([
 AT_SORT_PREREQ

+ 53 - 0
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 <http://www.gnu.org/licenses/>.
+
+# 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 <[email protected]>
+# Last-Affected-Version: 1.26
+# References: <[email protected]>,
+#   <[email protected]>,
+#   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
+

+ 56 - 0
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 <http://www.gnu.org/licenses/>.
+
+# 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 <[email protected]>
+# Last-Affected-Version: 1.26
+# References: <[email protected]>,
+#   <[email protected]>,
+#   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
+

+ 72 - 0
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 <http://www.gnu.org/licenses/>.
+
+# 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 <[email protected]>
+# Last-Affected-Version: 1.26
+# References: <[email protected]>,
+#   <[email protected]>,
+#   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
+

+ 52 - 0
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 <http://www.gnu.org/licenses/>.
+
+# 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 <[email protected]>
+# Last-Affected-Version: 1.26
+# References: <[email protected]>,
+#   <[email protected]>,
+#   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
+

+ 55 - 0
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 <http://www.gnu.org/licenses/>.
+
+# 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 <[email protected]>
+# Last-Affected-Version: 1.26
+# References: <[email protected]>,
+#   <[email protected]>,
+#   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
+

+ 72 - 0
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 <http://www.gnu.org/licenses/>.
+
+# 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 <[email protected]>
+# Last-Affected-Version: 1.26
+# References: <[email protected]>,
+#   <[email protected]>,
+#   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
+

+ 51 - 0
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 <http://www.gnu.org/licenses/>.
+
+# 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 <[email protected]>
+# Last-Affected-Version: 1.26
+# References: <[email protected]>,
+#   <[email protected]>,
+#   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
+

+ 53 - 0
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 <http://www.gnu.org/licenses/>.
+
+# 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 <[email protected]>
+# Last-Affected-Version: 1.26
+# References: <[email protected]>,
+#   <[email protected]>,
+#   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
+

+ 70 - 0
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 <http://www.gnu.org/licenses/>.
+
+# 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 <[email protected]>
+# Last-Affected-Version: 1.26
+# References: <[email protected]>,
+#   <[email protected]>,
+#   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
+

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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([
 

+ 9 - 0
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])