Let --posix cause --no-backup-if-mismatch (bug #678016).

This commit is contained in:
Tim Waugh 2011-02-16 16:46:04 +00:00
parent eecf840792
commit f70e892baf
2 changed files with 39 additions and 1 deletions

View File

@ -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);

View File

@ -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 <twaugh@redhat.com> 2.6.1-9
- Let --posix cause --no-backup-if-mismatch (bug #678016).
* Thu Feb 10 2011 Tim Waugh <twaugh@redhat.com> 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).