From 3599bdb84d32958bc1915db32c34cbf3b3b70323 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Dec 24 2009 14:06:35 +0000 Subject: - Applied upstream patch to prevent incorrect filename being chosen when adding a new file (bug #549122). --- diff --git a/patch-best-name.patch b/patch-best-name.patch new file mode 100644 index 0000000..810e403 --- /dev/null +++ b/patch-best-name.patch @@ -0,0 +1,72 @@ +--- patch-2.6/src/pch.c 2009-11-02 19:09:57.000000000 +0000 ++++ patch-2.6-4-ge2218ac/src/pch.c 2009-12-22 23:03:27.000000000 +0000 +@@ -195,23 +195,22 @@ + } + + static bool +-maybe_reverse (char const *name, bool nonexistent, bool empty) ++maybe_reverse (char const *name, bool nonexistent, bool is_empty) + { +- bool is_empty = nonexistent || empty; +- bool r; ++ bool looks_reversed = (! is_empty) < p_says_nonexistent[reverse ^ is_empty]; + +- r = (! is_empty) < p_says_nonexistent[reverse ^ is_empty] +- && ok_to_reverse ("The next patch%s would %s the file %s,\nwhich %s!", +- reverse ? ", when reversed," : "", +- (nonexistent ? "delete" +- : empty ? "empty out" +- : "create"), +- quotearg (name), +- (nonexistent ? "does not exist" +- : empty ? "is already empty" +- : "already exists")); +- reverse ^= r; +- return r; ++ if (looks_reversed) ++ reverse ^= ++ ok_to_reverse ("The next patch%s would %s the file %s,\nwhich %s!", ++ reverse ? ", when reversed," : "", ++ (nonexistent ? "delete" ++ : is_empty ? "empty out" ++ : "create"), ++ quotearg (name), ++ (nonexistent ? "does not exist" ++ : is_empty ? "is already empty" ++ : "already exists")); ++ return looks_reversed; + } + + /* True if the remainder of the patch file contains a diff of some sort. */ +@@ -638,6 +637,7 @@ + + if (! posixly_correct) + { ++ /* The best of all existing files. */ + i = best_name (p_name, stat_errno); + + if (i == NONE && patch_get) +@@ -680,12 +680,10 @@ + } + } + +- if (i != NONE && st[i].st_size > 0) +- i0 = i; + if (i0 != NONE +- && ! maybe_reverse (p_name[i0], i == NONE, +- i == NONE || st[i].st_size == 0)) +- i = i0; ++ && maybe_reverse (p_name[i0], i == NONE, ++ i == NONE || st[i].st_size == 0)) ++ i = i0; + + if (i == NONE && p_says_nonexistent[reverse]) + { +@@ -706,6 +704,7 @@ + if (p_name[i]) + distance_from_minimum[i] = newdirs[i] - newdirs_min; + ++ /* The best of the filenames which create the fewest directories. */ + i = best_name (p_name, distance_from_minimum); + } + } diff --git a/patch.spec b/patch.spec index 455140c..0e4245f 100644 --- a/patch.spec +++ b/patch.spec @@ -1,12 +1,13 @@ Summary: Utility for modifying/upgrading files Name: patch Version: 2.6 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.gnu.org/software/patch/patch.html Group: Development/Tools Source: ftp://ftp.gnu.org/gnu/patch/patch-%{version}.tar.xz Patch1: patch-2.5.4-sigsegv.patch +Patch2: patch-best-name.patch Patch100: patch-selinux.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -25,6 +26,7 @@ applications. %prep %setup -q %patch1 -p1 -b .sigsegv +%patch2 -p1 -b .best-name %patch100 -p1 -b .selinux %build @@ -55,6 +57,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/*/* %changelog +* Thu Dec 24 2009 Tim Waugh 2.6-2 +- Applied upstream patch to prevent incorrect filename being chosen + when adding a new file (bug #549122). + * Mon Nov 16 2009 Tim Waugh 2.6-1 - 2.6. No longer need stderr, suffix, stripcr, parse, allow-spaces, ifdef, program_name, or posix-backup patches.