[tar/f19] tar: cooperation of --compare and --listed-incremental
Pavel Raiskup
praiskup at fedoraproject.org
Thu Dec 12 16:33:28 UTC 2013
commit 30e4b6c8e794570001f9e826ea992885a96ac89e
Author: Pavel Raiskup <praiskup at redhat.com>
Date: Thu Dec 12 15:28:41 2013 +0100
tar: cooperation of --compare and --listed-incremental
Resolves: #1040702
Version: 1.26-28
tar-1.26-compare-incremental.patch | 138 ++++++++++++++++++++++++++++++++++++
tar-1.26-silence-gcc.patch | 18 +++---
tar-1.26-testsuite-diff-incr.patch | 68 ++++++++++++++++++
tar.spec | 17 ++++-
4 files changed, 231 insertions(+), 10 deletions(-)
---
diff --git a/tar-1.26-compare-incremental.patch b/tar-1.26-compare-incremental.patch
new file mode 100644
index 0000000..0f764c4
--- /dev/null
+++ b/tar-1.26-compare-incremental.patch
@@ -0,0 +1,138 @@
+diff --git a/src/common.h b/src/common.h
+index 16ba401..2defe02 100644
+--- a/src/common.h
++++ b/src/common.h
+@@ -537,6 +537,7 @@ void update_parent_directory (struct tar_stat_info *st);
+
+ size_t dumpdir_size (const char *p);
+ bool is_dumpdir (struct tar_stat_info *stat_info);
++void clear_directory_table (void);
+
+ /* Module list.c. */
+
+diff --git a/src/compare.c b/src/compare.c
+index 273269a..185a61a 100644
+--- a/src/compare.c
++++ b/src/compare.c
+@@ -359,31 +359,47 @@ dumpdir_cmp (const char *a, const char *b)
+ }
+
+ static void
+-diff_dumpdir (void)
++diff_dumpdir (struct tar_stat_info *dir)
+ {
+ const char *dumpdir_buffer;
+ dev_t dev = 0;
+ struct stat stat_data;
+
+- if (deref_stat (current_stat_info.file_name, &stat_data) != 0)
++ if (deref_stat (dir->file_name, &stat_data) != 0)
+ {
+ if (errno == ENOENT)
+- stat_warn (current_stat_info.file_name);
++ stat_warn (dir->file_name);
+ else
+- stat_error (current_stat_info.file_name);
++ stat_error (dir->file_name);
+ }
+ else
+ dev = stat_data.st_dev;
+
+- dumpdir_buffer = directory_contents (scan_directory (¤t_stat_info));
++ if (dir->fd == 0)
++ {
++ void (*diag) (char const *) = NULL;
++ int fd = subfile_open (dir->parent, dir->orig_file_name, open_read_flags);
++ if (fd < 0)
++ diag = open_diag;
++ else if (fstat (fd, &dir->stat))
++ diag = stat_diag;
++ else
++ dir->fd = fd;
++ if (diag)
++ {
++ file_removed_diag (dir->orig_file_name, false, diag);
++ return;
++ }
++ }
++ dumpdir_buffer = directory_contents (scan_directory (dir));
+
+ if (dumpdir_buffer)
+ {
+- if (dumpdir_cmp (current_stat_info.dumpdir, dumpdir_buffer))
+- report_difference (¤t_stat_info, _("Contents differ"));
++ if (dumpdir_cmp (dir->dumpdir, dumpdir_buffer))
++ report_difference (dir, _("Contents differ"));
+ }
+ else
+- read_and_process (¤t_stat_info, process_noop);
++ read_and_process (dir, process_noop);
+ }
+
+ static void
+@@ -446,7 +462,7 @@ diff_multivol (void)
+ void
+ diff_archive (void)
+ {
+-
++
+ set_next_block_after (current_header);
+
+ /* Print the block from current_header and current_stat_info. */
+@@ -498,7 +514,7 @@ diff_archive (void)
+ case GNUTYPE_DUMPDIR:
+ case DIRTYPE:
+ if (is_dumpdir (¤t_stat_info))
+- diff_dumpdir ();
++ diff_dumpdir (¤t_stat_info);
+ diff_dir ();
+ break;
+
+@@ -530,6 +546,8 @@ verify_volume (void)
+ WARN((0, 0,
+ _("Verification may fail to locate original files.")));
+
++ clear_directory_table ();
++
+ if (!diff_buffer)
+ diff_init ();
+
+diff --git a/src/incremen.c b/src/incremen.c
+index b2ab5bf..69cbd59 100644
+--- a/src/incremen.c
++++ b/src/incremen.c
+@@ -300,6 +300,24 @@ dirlist_replace_prefix (const char *pref, const char *repl)
+ replace_prefix (&dp->name, pref, pref_len, repl, repl_len);
+ }
+
++void
++clear_directory_table (void)
++{
++ struct directory *dp;
++
++ if (directory_table)
++ hash_clear (directory_table);
++ if (directory_meta_table)
++ hash_clear (directory_meta_table);
++ for (dp = dirhead; dp; )
++ {
++ struct directory *next = dp->next;
++ free_directory (dp);
++ dp = next;
++ }
++ dirhead = dirtail = NULL;
++}
++
+ /* Create and link a new directory entry for directory NAME, having a
+ device number DEV and an inode number INO, with NFS indicating
+ whether it is an NFS device and FOUND indicating whether we have
+@@ -327,7 +345,8 @@ note_directory (char const *name, struct timespec mtime,
+ if (! ((directory_table
+ || (directory_table = hash_initialize (0, 0,
+ hash_directory_canonical_name,
+- compare_directory_canonical_names, 0)))
++ compare_directory_canonical_names,
++ 0)))
+ && hash_insert (directory_table, directory)))
+ xalloc_die ();
+
diff --git a/tar-1.26-silence-gcc.patch b/tar-1.26-silence-gcc.patch
index a2a8f6b..8e0f167 100644
--- a/tar-1.26-silence-gcc.patch
+++ b/tar-1.26-silence-gcc.patch
@@ -59,10 +59,10 @@ index 3aee428..1cef0fc 100644
sys_reset_uid_gid ();
diff --git a/lib/system.h b/lib/system.h
-index 2deb585..599d4ba 100644
+index 23cd2ef..d666a7d 100644
--- a/lib/system.h
+++ b/lib/system.h
-@@ -471,8 +471,13 @@ char *getenv ();
+@@ -478,8 +478,13 @@ char *getenv ();
# define SET_BINARY_MODE(arc)
# define ERRNO_IS_EACCES 0
# define TTY_NAME "/dev/tty"
@@ -79,28 +79,28 @@ index 2deb585..599d4ba 100644
#if XENIX
diff --git a/src/compare.c b/src/compare.c
-index 273269a..796d7aa 100644
+index 185a61a..fefc528 100644
--- a/src/compare.c
+++ b/src/compare.c
@@ -362,7 +362,7 @@ static void
- diff_dumpdir (void)
+ diff_dumpdir (struct tar_stat_info *dir)
{
const char *dumpdir_buffer;
- dev_t dev = 0;
+ /* upstream fix 5bb04335079 */
struct stat stat_data;
- if (deref_stat (current_stat_info.file_name, &stat_data) != 0)
-@@ -372,8 +372,7 @@ diff_dumpdir (void)
+ if (deref_stat (dir->file_name, &stat_data) != 0)
+@@ -372,8 +372,7 @@ diff_dumpdir (struct tar_stat_info *dir)
else
- stat_error (current_stat_info.file_name);
+ stat_error (dir->file_name);
}
- else
- dev = stat_data.st_dev;
+ /* upstream fix 5bb04335079 */
- dumpdir_buffer = directory_contents (scan_directory (¤t_stat_info));
-
+ if (dir->fd == 0)
+ {
diff --git a/src/update.c b/src/update.c
index 4739e0d..3b28734 100644
--- a/src/update.c
diff --git a/tar-1.26-testsuite-diff-incr.patch b/tar-1.26-testsuite-diff-incr.patch
new file mode 100644
index 0000000..93498d0
--- /dev/null
+++ b/tar-1.26-testsuite-diff-incr.patch
@@ -0,0 +1,68 @@
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index b0da439..6702063 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -98,6 +98,7 @@ TESTSUITE_AT = \
+ incr04.at\
+ incr05.at\
+ incr06.at\
++ incr10.at\
+ indexfile.at\
+ ignfail.at\
+ label01.at\
+diff --git a/tests/incr10.at b/tests/incr10.at
+new file mode 100644
+index 0000000..b1cb0cb
+--- /dev/null
++++ b/tests/incr10.at
+@@ -0,0 +1,38 @@
++# Process this file with autom4te to create testsuite. -*- Autotest -*-
++
++# Test suite for GNU tar.
++# Copyright (C) 2013 Free Software Foundation, Inc.
++
++# This program 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, or (at your option)
++# any later version.
++
++# This program 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/>.
++
++AT_SETUP([incremental dumps and --compare option])
++AT_KEYWORDS([incremental incr10])
++
++AT_TAR_CHECK([
++mkdir dir
++mkdir dir/sub
++genfile --file dir/file1
++genfile --file dir/sub/file2
++
++tar -c -f archive-0.1.tar -g db.1 dir
++tar --diff -f archive-0.1.tar -G
++rm dir/file1
++cp db.1 db.2
++tar -c -f archive-0.2.tar -g db.2 dir
++tar --diff -f archive-0.2.tar -G
++],
++[0],
++[],[],[],[],[gnu, oldgnu, posix])
++
++AT_CLEANUP
+diff --git a/tests/testsuite.at b/tests/testsuite.at
+index d5925b3..676bc2e 100644
+--- a/tests/testsuite.at
++++ b/tests/testsuite.at
+@@ -259,6 +259,7 @@ m4_include([incr03.at])
+ m4_include([incr04.at])
+ m4_include([incr05.at])
+ m4_include([incr06.at])
++m4_include([incr10.at])
+
+ m4_include([filerem01.at])
+ m4_include([filerem02.at])
diff --git a/tar.spec b/tar.spec
index c9af86b..bb50b7d 100644
--- a/tar.spec
+++ b/tar.spec
@@ -5,7 +5,7 @@ Summary: A GNU file archiving program
Name: tar
Epoch: 2
Version: 1.26
-Release: 27%{?dist}
+Release: 28%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
@@ -119,6 +119,16 @@ Patch17: tar-1.26-xattrs-include-implies-xattrs.patch
# ~> #1024095
Patch18: tar-1.26-sparse-stat-detection.patch
+# Fix for --compare (or --verify) & --listed-incremental
+# ~> #1040702
+# ~> upstream (d88b2a61)
+Patch19: tar-1.26-compare-incremental.patch
+
+# Test case for ^^^
+# ~> downstream, proposed:
+# http://www.mail-archive.com/bug-tar@gnu.org/msg04294.html
+Patch20: tar-1.26-testsuite-diff-incr.patch
+
# Silence gcc warnings
# ~> upstream tar: 17f99bc6f, 5bb0433
# ~> upstream paxutils: 0b3d84a0
@@ -175,6 +185,8 @@ the rmt package on the remote box.
%patch16 -p1 -b .xattrs-documentation
%patch17 -p1 -b .xattrs-if-xattrs-include
%patch18 -p1 -b .sparse-stat-detection
+%patch19 -p1 -b .compare-and-incremental
+%patch20 -p1 -b .testsuite-diff-incr
%patch999 -p1 -b .silence-gcc
autoreconf -v
@@ -233,6 +245,9 @@ fi
%{_infodir}/tar.info*
%changelog
+* Thu Dec 12 2013 Pavel Raiskup <praiskup at redhat.com> - 1.26-28
+- fix --compare with --listed-incremental (#1040702)
+
* Tue Oct 29 2013 Pavel Raiskup <praiskup at redhat.com> - 1.26-27
- sparse file detection based on fstat() fix (#1024095)
More information about the scm-commits
mailing list