Blame SOURCES/tar-1.26-update-with-change-directory.patch

a4d85a
From 207b445ca7018a95f2f96d9514b8d87c80e8e11e Mon Sep 17 00:00:00 2001
a4d85a
From: Pavel Raiskup <praiskup@redhat.com>
a4d85a
Date: Wed, 4 Apr 2012 18:04:53 +0200
a4d85a
Subject: [PATCH] Bad cooperation of -C and -u options
a4d85a
a4d85a
Previously, tar did not update archive with newly created files in archived
a4d85a
directory --  it failed instead  with "file not found" error (because it looked
a4d85a
in bad directory in filesystem).
a4d85a
---
a4d85a
 src/update.c       |    4 +-
a4d85a
 tests/Makefile.am  |    3 +-
a4d85a
 tests/testsuite.at |    3 +-
a4d85a
 tests/update03.at  |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
a4d85a
 4 files changed, 65 insertions(+), 4 deletions(-)
a4d85a
 create mode 100644 tests/update03.at
a4d85a
a4d85a
diff --git a/src/update.c b/src/update.c
a4d85a
index e3228d4..4739e0d 100644
a4d85a
--- a/src/update.c
a4d85a
+++ b/src/update.c
a4d85a
@@ -1,7 +1,7 @@
a4d85a
 /* Update a tar archive.
a4d85a
 
a4d85a
    Copyright (C) 1988, 1992, 1994, 1996, 1997, 1999, 2000, 2001, 2003,
a4d85a
-   2004, 2005, 2007, 2010 Free Software Foundation, Inc.
a4d85a
+   2004, 2005, 2007, 2010, 2011, 2012 Free Software Foundation, Inc.
a4d85a
 
a4d85a
    This program is free software; you can redistribute it and/or modify it
a4d85a
    under the terms of the GNU General Public License as published by the
a4d85a
@@ -159,7 +159,7 @@ update_archive (void)
a4d85a
 
a4d85a
 			    for (p = dirp; *p; p += strlen (p) + 1)
a4d85a
 			      addname (namebuf_name (nbuf, p),
a4d85a
-				       0, false, NULL);
a4d85a
+				       name->change_dir, false, NULL);
a4d85a
 
a4d85a
 			    namebuf_free (nbuf);
a4d85a
 			    free (dirp);
a4d85a
diff --git a/tests/Makefile.am b/tests/Makefile.am
a4d85a
index ab7d104..119f1f3 100644
a4d85a
--- a/tests/Makefile.am
a4d85a
+++ b/tests/Makefile.am
a4d85a
@@ -1,7 +1,7 @@
a4d85a
 # Makefile for GNU tar regression tests.
a4d85a
 
a4d85a
 # Copyright (C) 1996, 1997, 1999, 2000, 2001, 2003, 2004, 2005,
a4d85a
-# 2006, 2007, 2009 Free Software Foundation, Inc.
a4d85a
+# 2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
a4d85a
 
a4d85a
 # François Pinard <pinard@iro.umontreal.ca>, 1988.
a4d85a
 # Sergey Poznyakoff <gray@mirddin.farlep.net>, 2004.
a4d85a
@@ -156,6 +156,7 @@ TESTSUITE_AT = \
a4d85a
  update.at\
a4d85a
  update01.at\
a4d85a
  update02.at\
a4d85a
+ update03.at\
a4d85a
  volsize.at\
a4d85a
  volume.at\
a4d85a
  verbose.at\
a4d85a
diff --git a/tests/testsuite.at b/tests/testsuite.at
a4d85a
index 8366ef0..13f7506 100644
a4d85a
--- a/tests/testsuite.at
a4d85a
+++ b/tests/testsuite.at
a4d85a
@@ -1,7 +1,7 @@
a4d85a
 # Process this file with autom4te to create testsuite. -*- Autotest -*-
a4d85a
 
a4d85a
 # Test suite for GNU tar.
a4d85a
-# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Free Software
a4d85a
+# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 Free Software
a4d85a
 # Foundation, Inc.
a4d85a
 
a4d85a
 # This program is free software; you can redistribute it and/or modify
a4d85a
@@ -241,6 +241,7 @@ m4_include([spmvp10.at])
a4d85a
 m4_include([update.at])
a4d85a
 m4_include([update01.at])
a4d85a
 m4_include([update02.at])
a4d85a
+m4_include([update03.at])
a4d85a
 
a4d85a
 m4_include([verify.at])
a4d85a
 
a4d85a
diff --git a/tests/update03.at b/tests/update03.at
a4d85a
new file mode 100644
a4d85a
index 0000000..185f9eb
a4d85a
--- /dev/null
a4d85a
+++ b/tests/update03.at
a4d85a
@@ -0,0 +1,59 @@
a4d85a
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
a4d85a
+
a4d85a
+# Test suite for GNU tar.
a4d85a
+# Copyright (C) 2012 Free Software Foundation, Inc.
a4d85a
+
a4d85a
+# This program is free software; you can redistribute it and/or modify it under
a4d85a
+# the terms of the GNU General Public License as published by the Free Software
a4d85a
+# Foundation; either version 3, or (at your option) any later version.
a4d85a
+
a4d85a
+# This program is distributed in the hope that it will be useful, but WITHOUT
a4d85a
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
a4d85a
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
a4d85a
+# details.
a4d85a
+
a4d85a
+# You should have received a copy of the GNU General Public License along with
a4d85a
+# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
a4d85a
+# Street, Fifth Floor, Boston, MA 02110-1301, USA.
a4d85a
+
a4d85a
+# Description:
a4d85a
+#   Test if the '--update' option works with the '--directory DIR' option
a4d85a
+#   properly.  In version <= 1.26 tar this combination caused problems.
a4d85a
+#
a4d85a
+# References:
a4d85a
+#   https://bugzilla.redhat.com/show_bug.cgi?id=688567
a4d85a
+#
a4d85a
+# Last-Affected-Version:  1.26.90
a4d85a
+
a4d85a
+AT_SETUP([update & change directory (-C)])
a4d85a
+AT_KEYWORDS([update update03])
a4d85a
+
a4d85a
+AT_TAR_CHECK([
a4d85a
+AT_SORT_PREREQ
a4d85a
+
a4d85a
+# prepare filesystem
a4d85a
+mkdir dir
a4d85a
+mkdir dir/subdir
a4d85a
+genfile --file dir/subdir/a
a4d85a
+
a4d85a
+# crate archive of subdir
a4d85a
+tar -C dir -cf file.tar subdir
a4d85a
+
a4d85a
+# update filesystem
a4d85a
+mkdir dir/subdir/b
a4d85a
+genfile --file dir/subdir/b/c
a4d85a
+
a4d85a
+# sync the 'file.tar' archive
a4d85a
+tar -C dir -uf file.tar subdir
a4d85a
+
a4d85a
+# print contents
a4d85a
+tar -tf file.tar | sort || exit 1
a4d85a
+],
a4d85a
+[0],
a4d85a
+[subdir/
a4d85a
+subdir/a
a4d85a
+subdir/b/
a4d85a
+subdir/b/c
a4d85a
+])
a4d85a
+
a4d85a
+AT_CLEANUP
a4d85a
-- 
a4d85a
1.7.7.6
a4d85a