From f70e892baf1e5c527dc7ec41ec98cd3fb6e46f5a Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Feb 16 2011 16:46:04 +0000 Subject: Let --posix cause --no-backup-if-mismatch (bug #678016). --- diff --git a/patch-backup-if-mismatch.patch b/patch-backup-if-mismatch.patch new file mode 100644 index 0000000..0ad0986 --- /dev/null +++ b/patch-backup-if-mismatch.patch @@ -0,0 +1,31 @@ +diff -up patch-2.6.1/src/patch.c.backup-if-mismatch patch-2.6.1/src/patch.c +--- patch-2.6.1/src/patch.c.backup-if-mismatch 2011-02-16 16:43:54.575850844 +0000 ++++ patch-2.6.1/src/patch.c 2011-02-16 16:44:56.907995789 +0000 +@@ -106,6 +106,7 @@ main (int argc, char **argv) + char numbuf[LINENUM_LENGTH_BOUND + 1]; + bool written_to_rejname = false; + bool apply_empty_patch = false; ++ bool posixly_correct_set; + + exit_failure = 2; + program_name = argv[0]; +@@ -125,7 +126,7 @@ main (int argc, char **argv) + i < 0 ? shell_quoting_style : (enum quoting_style) i); + } + +- posixly_correct = getenv ("POSIXLY_CORRECT") != 0; ++ posixly_correct_set = posixly_correct = getenv ("POSIXLY_CORRECT") != 0; + backup_if_mismatch = ! posixly_correct; + patch_get = ((val = getenv ("PATCH_GET")) + ? numeric_string (val, true, "PATCH_GET value") +@@ -151,6 +152,10 @@ main (int argc, char **argv) + Argv = argv; + get_some_switches(); + ++ /* Let --posix cause --no-backup-if-mismatch. */ ++ if (! posixly_correct_set && posixly_correct && backup_if_mismatch) ++ backup_if_mismatch = false; ++ + if (make_backups | backup_if_mismatch) + backup_type = get_version (version_control_context, version_control); + diff --git a/patch.spec b/patch.spec index d8a85a9..8bbb30a 100644 --- a/patch.spec +++ b/patch.spec @@ -1,7 +1,7 @@ Summary: Utility for modifying/upgrading files Name: patch Version: 2.6.1 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2+ URL: http://www.gnu.org/software/patch/patch.html Group: Development/Tools @@ -9,6 +9,7 @@ Source: ftp://ftp.gnu.org/gnu/patch/patch-%{version}.tar.xz Patch1: patch-2.5.4-sigsegv.patch Patch2: patch-get-arg.patch Patch3: patch-CVE-2010-4651.patch +Patch4: patch-backup-if-mismatch.patch Patch100: patch-selinux.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -39,6 +40,9 @@ applications. # (bug #667529). %patch3 -p1 -b .CVE-2010-4651 +# Let --posix cause --no-backup-if-mismatch (bug #678016). +%patch4 -p1 -b .backup-if-mismatch + # SELinux support. %patch100 -p1 -b .selinux @@ -67,6 +71,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/*/* %changelog +* Wed Feb 16 2011 Tim Waugh 2.6.1-9 +- Let --posix cause --no-backup-if-mismatch (bug #678016). + * Thu Feb 10 2011 Tim Waugh 2.6.1-8 - Incorporate upstream fix for CVE-2010-4651 patch so that a target name given on the command line is not validated (bug #667529).