[tar/f17] Fix for bad cooperation of -C & -u options
Pavel Raiskup
praiskup at fedoraproject.org
Thu Apr 5 12:50:48 UTC 2012
commit c075bd40d6f643583464d711110386bcb771eae3
Author: Pavel Raiskup <praiskup at redhat.com>
Date: Thu Apr 5 10:54:44 2012 +0200
Fix for bad cooperation of -C & -u options
More info:
- BZ #688567
- http://lists.gnu.org/archive/html/bug-tar/2012-02/msg00007.html
tar-1.26-update-with-change-directory.patch | 148 +++++++++++++++++++++++++++
tar.spec | 9 ++-
2 files changed, 156 insertions(+), 1 deletions(-)
---
diff --git a/tar-1.26-update-with-change-directory.patch b/tar-1.26-update-with-change-directory.patch
new file mode 100644
index 0000000..6a9a0cf
--- /dev/null
+++ b/tar-1.26-update-with-change-directory.patch
@@ -0,0 +1,148 @@
+From 207b445ca7018a95f2f96d9514b8d87c80e8e11e Mon Sep 17 00:00:00 2001
+From: Pavel Raiskup <praiskup at redhat.com>
+Date: Wed, 4 Apr 2012 18:04:53 +0200
+Subject: [PATCH] Bad cooperation of -C and -u options
+
+Previously, tar did not update archive with newly created files in archived
+directory -- it failed instead with "file not found" error (because it looked
+in bad directory in filesystem).
+---
+ src/update.c | 4 +-
+ tests/Makefile.am | 3 +-
+ tests/testsuite.at | 3 +-
+ tests/update03.at | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 65 insertions(+), 4 deletions(-)
+ create mode 100644 tests/update03.at
+
+diff --git a/src/update.c b/src/update.c
+index e3228d4..4739e0d 100644
+--- a/src/update.c
++++ b/src/update.c
+@@ -1,7 +1,7 @@
+ /* Update a tar archive.
+
+ Copyright (C) 1988, 1992, 1994, 1996, 1997, 1999, 2000, 2001, 2003,
+- 2004, 2005, 2007, 2010 Free Software Foundation, Inc.
++ 2004, 2005, 2007, 2010, 2011, 2012 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
+@@ -159,7 +159,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 ab7d104..119f1f3 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -1,7 +1,7 @@
+ # Makefile for GNU tar regression tests.
+
+ # Copyright (C) 1996, 1997, 1999, 2000, 2001, 2003, 2004, 2005,
+-# 2006, 2007, 2009 Free Software Foundation, Inc.
++# 2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+
+ # François Pinard <pinard at iro.umontreal.ca>, 1988.
+ # Sergey Poznyakoff <gray at mirddin.farlep.net>, 2004.
+@@ -156,6 +156,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 8366ef0..13f7506 100644
+--- a/tests/testsuite.at
++++ b/tests/testsuite.at
+@@ -1,7 +1,7 @@
+ # Process this file with autom4te to create testsuite. -*- Autotest -*-
+
+ # Test suite for GNU tar.
+-# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Free Software
++# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 Free Software
+ # Foundation, Inc.
+
+ # This program is free software; you can redistribute it and/or modify
+@@ -241,6 +241,7 @@ m4_include([spmvp10.at])
+ m4_include([update.at])
+ m4_include([update01.at])
+ m4_include([update02.at])
++m4_include([update03.at])
+
+ m4_include([verify.at])
+
+diff --git a/tests/update03.at b/tests/update03.at
+new file mode 100644
+index 0000000..185f9eb
+--- /dev/null
++++ b/tests/update03.at
+@@ -0,0 +1,59 @@
++# Process this file with autom4te to create testsuite. -*- Autotest -*-
++
++# Test suite for GNU tar.
++# Copyright (C) 2012 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, write to the Free Software Foundation, Inc., 51 Franklin
++# Street, Fifth Floor, Boston, MA 02110-1301, USA.
++
++# Description:
++# Test if the '--update' option works with the '--directory DIR' option
++# properly. In version <= 1.26 tar this combination caused problems.
++#
++# References:
++# https://bugzilla.redhat.com/show_bug.cgi?id=688567
++#
++# Last-Affected-Version: 1.26.90
++
++AT_SETUP([update & change directory (-C)])
++AT_KEYWORDS([update update03])
++
++AT_TAR_CHECK([
++AT_SORT_PREREQ
++
++# prepare filesystem
++mkdir dir
++mkdir dir/subdir
++genfile --file dir/subdir/a
++
++# crate archive of subdir
++tar -C dir -cf file.tar subdir
++
++# update filesystem
++mkdir dir/subdir/b
++genfile --file dir/subdir/b/c
++
++# sync the 'file.tar' archive
++tar -C dir -uf file.tar subdir
++
++# print contents
++tar -tf file.tar | sort || exit 1
++],
++[0],
++[subdir/
++subdir/a
++subdir/b/
++subdir/b/c
++])
++
++AT_CLEANUP
+--
+1.7.7.6
+
diff --git a/tar.spec b/tar.spec
index 2de5966..417464e 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: 4%{?dist}
+Release: 5%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
@@ -32,6 +32,8 @@ Patch6: tar-1.23-oldarchive.patch
Patch7: tar-sigpipe.patch
#partially revert upstream commit 4bde4f3 (#717684)
Patch8: tar-1.24-openat-partial-revert.patch
+# fix for bad cooperation of -C and -u options (#688567)
+Patch9: tar-1.26-update-with-change-directory.patch
BuildRequires: autoconf automake gzip texinfo gettext libacl-devel gawk rsh
%if %{WITH_SELINUX}
BuildRequires: libselinux-devel
@@ -62,6 +64,7 @@ the rmt package.
%patch6 -p1 -b .oldarchive
%patch7 -p1 -b .fail
%patch8 -p1 -b .openat
+%patch9 -p1 -b .update_and_changedir
autoreconf
@@ -123,6 +126,10 @@ fi
%{_infodir}/tar.info*
%changelog
+* Thu Apr 04 2012 Pavel Raiskup <praiskup at redhat.com> 2:1.26-5
+- fix for bad cooperation of the '-C' (change directory) and '-u' (update
+ package) options (#688567)
+
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2:1.26-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list