bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] gnu tar incremental backup saves unchanged directories


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] gnu tar incremental backup saves unchanged directories
Date: Mon, 26 Sep 2016 14:11:45 +0300

Ivan Kalvachev <address@hidden> ha escrit:
> http://lists.gnu.org/archive/html/bug-tar/2016-08/msg00003.html ), but
> so far I haven't gotten any reply.

I've pushed the attached patch.  Thanks for the report.

Regards,
Sergey

>From e1b7e40ff08c2493d2256f0ce6c682afc0c453f3 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <address@hidden>
Date: Mon, 26 Sep 2016 13:17:26 +0300
Subject: [PATCH] Fix interaction of -u with -C

* src/update.c (update_archive): Pass correct change_dir
value for addname
* tests/update03.at: New file.
* tests/Makefile.am: Add update03.at
* tests/testsuite.at: Include update03.at
---
 src/update.c       |  2 +-
 tests/Makefile.am  |  1 +
 tests/testsuite.at |  1 +
 tests/update03.at  | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 tests/update03.at

diff --git a/src/update.c b/src/update.c
index ad7a6bf..d54cbdb 100644
--- a/src/update.c
+++ b/src/update.c
@@ -152,7 +152,7 @@ update_archive (void)

                            for (p = dirp; *p; p += strlen (p) + 1)
                              addname (namebuf_name (nbuf, p),
-                                      0, false, NULL);
+                                      name->change_dir, false, NULL);

                            namebuf_free (nbuf);
                            free (dirp);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3e638e3..5376180 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -226,6 +226,7 @@ TESTSUITE_AT = \
  update.at\
  update01.at\
  update02.at\
+ update03.at\
  volsize.at\
  volume.at\
  verbose.at\
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 6fe5f89..1f1897b 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -396,6 +396,7 @@ AT_BANNER([Updates])
 m4_include([update.at])
 m4_include([update01.at])
 m4_include([update02.at])
+m4_include([update03.at])

 AT_BANNER([Verifying the archive])
 m4_include([verify.at])
diff --git a/tests/update03.at b/tests/update03.at
new file mode 100644
index 0000000..0a38e27
--- /dev/null
+++ b/tests/update03.at
@@ -0,0 +1,51 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2016 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/>.
+
+AT_SETUP([update with chdir])
+AT_KEYWORDS([update update03 chdir])
+
+# Tar <=1.29 failed to chdir when -u was used with -C
+# Reported by: Ivan Kalvachev <address@hidden>
+# References: <address@hidden>,
+#             http://lists.gnu.org/archive/html/bug-tar/2016-08/msg00003.html
+AT_TAR_CHECK([
+mkdir dir1
+mkdir dir2
+mkdir dir1/subdir1 dir2/subdir2
+genfile --file dir1/subdir1/a
+genfile --file dir2/subdir2/a
+echo Create
+tar -vcf arc.tar -C dir1 subdir1 -C ../dir2 subdir2
+genfile --file dir1/subdir1/b
+genfile --file dir2/subdir2/c
+echo Update
+tar -vuf arc.tar -C dir1 subdir1 -C ../dir2 subdir2
+],
+[0],
+[Create
+subdir1/
+subdir1/a
+subdir2/
+subdir2/a
+Update
+subdir1/b
+subdir2/c
+])
+
+AT_CLEANUP
\ No newline at end of file
--
1.7.12.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]