[patch] 2.7. No longer need sigsegv, get-arg, CVE-2010-4651, backup-if-mismatch or coverity-leak patches.
Tim Waugh
twaugh at fedoraproject.org
Thu Oct 18 16:27:43 UTC 2012
commit 274dc2d261d66b252d9b8d2686f453c795a1e644
Author: Tim Waugh <twaugh at redhat.com>
Date: Thu Oct 18 17:24:00 2012 +0100
2.7. No longer need sigsegv, get-arg, CVE-2010-4651, backup-if-mismatch or coverity-leak patches.
.gitignore | 1 +
patch-2.5.4-sigsegv.patch | 42 ---------
patch-2.6.1.tar.xz.sig | 7 --
patch-2.7.tar.xz.sig | 7 ++
patch-backup-if-mismatch.patch | 31 -------
patch-coverity-leak.patch | 15 ---
patch-get-arg.patch | 12 ---
patch-selinux.patch | 196 +++++++++++++++++++++++-----------------
patch.spec | 30 ++-----
sources | 2 +-
10 files changed, 129 insertions(+), 214 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 1b77c72..d606fe7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
patch-2.5.4.tar.gz
patch-2.6.tar.xz
patch-2.6.1.tar.xz
+/patch-2.7.tar.xz
diff --git a/patch-2.7.tar.xz.sig b/patch-2.7.tar.xz.sig
new file mode 100644
index 0000000..fdcc64b
--- /dev/null
+++ b/patch-2.7.tar.xz.sig
@@ -0,0 +1,7 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.12 (GNU/Linux)
+
+iEYEABECAAYFAlBQWaAACgkQ9+hy/rlxVNPdqwCePxf2mZmHhEw2dfdGp/Fq0uuB
+/3oAoLlxmZxIodFqnT+3h8bna7+oEAWL
+=4Gbj
+-----END PGP SIGNATURE-----
diff --git a/patch-selinux.patch b/patch-selinux.patch
index b9891c5..519dcbb 100644
--- a/patch-selinux.patch
+++ b/patch-selinux.patch
@@ -1,28 +1,16 @@
-diff -up patch-2.6.1/Makefile.in.selinux patch-2.6.1/Makefile.in
---- patch-2.6.1/Makefile.in.selinux 2011-02-08 11:29:34.590271489 +0000
-+++ patch-2.6.1/Makefile.in 2011-02-08 11:29:34.602271607 +0000
-@@ -40,7 +40,7 @@ EXEEXT = @EXEEXT@
- LDFLAGS = @LDFLAGS@
- LIBOBJDIR = gl/lib/
- LIBOBJS = @LIBOBJS@ ${LIBOBJDIR}full-write$U.o
--LIBS = @LIBS@
-+LIBS = @LIBS@ -lselinux
- OBJEXT = @OBJEXT@
- PACKAGE_NAME = @PACKAGE_NAME@
- PACKAGE_VERSION = @PACKAGE_VERSION@
-diff -up patch-2.6.1/src/common.h.selinux patch-2.6.1/src/common.h
---- patch-2.6.1/src/common.h.selinux 2009-12-30 12:56:30.000000000 +0000
-+++ patch-2.6.1/src/common.h 2011-02-08 11:29:34.602271607 +0000
-@@ -32,6 +32,8 @@
+diff -up patch-2.7/src/common.h.selinux patch-2.7/src/common.h
+--- patch-2.7/src/common.h.selinux 2012-04-17 21:13:36.000000000 +0100
++++ patch-2.7/src/common.h 2012-10-18 17:04:21.215420195 +0100
+@@ -30,6 +30,8 @@
#include <sys/types.h>
#include <time.h>
+#include <selinux/selinux.h>
+
#include <sys/stat.h>
- #if ! defined S_ISDIR && defined S_IFDIR
- # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-@@ -118,6 +120,7 @@ XTERN char *outfile;
+
+ #include <limits.h>
+@@ -80,6 +82,7 @@ XTERN char *outfile;
XTERN int inerrno;
XTERN int invc;
XTERN struct stat instat;
@@ -30,31 +18,34 @@ diff -up patch-2.6.1/src/common.h.selinux patch-2.6.1/src/common.h
XTERN bool dry_run;
XTERN bool posixly_correct;
-diff -up patch-2.6.1/src/inp.c.selinux patch-2.6.1/src/inp.c
---- patch-2.6.1/src/inp.c.selinux 2011-02-08 11:29:34.576271352 +0000
-+++ patch-2.6.1/src/inp.c 2011-02-08 11:29:34.604271627 +0000
-@@ -152,8 +152,18 @@ get_input_file (char const *filename, ch
- char *diffbuf;
+diff -up patch-2.7/src/inp.c.selinux patch-2.7/src/inp.c
+--- patch-2.7/src/inp.c.selinux 2012-08-07 20:46:33.000000000 +0100
++++ patch-2.7/src/inp.c 2012-10-18 17:18:31.335799300 +0100
+@@ -138,7 +138,22 @@ get_input_file (char const *filename, ch
char *getbuf;
-- if (inerrno == -1)
-- inerrno = stat (filename, &instat) == 0 ? 0 : errno;
-+ inerrno = stat (filename, &instat) == 0 ? 0 : errno;
-+ if (inerrno == 0)
+ if (inerrno == -1)
+- inerrno = lstat (filename, &instat) == 0 ? 0 : errno;
+ {
-+ inerrno = getfilecon (inname, &incontext) == -1 ? errno : 0;
-+ if (inerrno == ENODATA || inerrno == ENOTSUP)
-+ {
-+ inerrno = 0;
-+ incontext = NULL;
-+ }
++ inerrno = lstat (filename, &instat) == 0 ? 0 : errno;
++ if (inerrno == 0)
++ {
++ inerrno = getfilecon (inname, &incontext) == -1 ? errno : 0;
++ if (inerrno == ENODATA || inerrno == ENOTSUP)
++ {
++ inerrno = 0;
++ incontext = NULL;
++ }
++ }
++ else
++ incontext = NULL;
+ }
+ else
+ incontext = NULL;
/* Perhaps look for RCS or SCCS versions. */
- if (patch_get
-@@ -197,7 +207,7 @@ get_input_file (char const *filename, ch
+ if (S_ISREG (mode)
+@@ -183,7 +198,7 @@ get_input_file (char const *filename, ch
}
if (cs && version_get (filename, cs, ! inerrno, elsewhere, getbuf,
@@ -63,49 +54,60 @@ diff -up patch-2.6.1/src/inp.c.selinux patch-2.6.1/src/inp.c
inerrno = 0;
free (getbuf);
-@@ -209,6 +219,7 @@ get_input_file (char const *filename, ch
+@@ -194,6 +209,7 @@ get_input_file (char const *filename, ch
{
instat.st_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
instat.st_size = 0;
+ incontext = NULL;
}
- else if (! S_ISREG (instat.st_mode))
- fatal ("File %s is not a regular file -- can't patch",
-diff -up patch-2.6.1/src/patch.c.selinux patch-2.6.1/src/patch.c
---- patch-2.6.1/src/patch.c.selinux 2011-02-08 11:29:34.586271450 +0000
-+++ patch-2.6.1/src/patch.c 2011-02-08 11:29:34.606271646 +0000
-@@ -421,6 +421,21 @@ main (int argc, char **argv)
- /* Fails if we are not in group instat.st_gid. */
- chown (outname, -1, instat.st_gid);
- }
-+
-+ if (! inerrno && incontext)
-+ {
-+ security_context_t outcontext;
-+ if (getfilecon (outname, &outcontext) != -1 &&
-+ outcontext &&
-+ strcmp(outcontext, incontext) &&
-+ setfilecon (outname, incontext) != 0)
-+ {
-+ if (errno != ENOTSUP && errno != EPERM)
-+ pfatal ("Can't set security context "
-+ "on file %s", quotearg (outname));
-+ }
-+ }
-+
- /* FIXME: There may be other attributes to preserve. */
+ else if (! ((S_ISREG (mode) || S_ISLNK (mode))
+ && (mode & S_IFMT) == (instat.st_mode & S_IFMT)))
+diff -up patch-2.7/src/Makefile.am.selinux patch-2.7/src/Makefile.am
+--- patch-2.7/src/Makefile.am.selinux 2012-04-17 08:59:41.000000000 +0100
++++ patch-2.7/src/Makefile.am 2012-10-18 17:04:21.216420199 +0100
+@@ -34,7 +34,7 @@ patch_SOURCES = \
+
+ AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
+ patch_LDADD = $(LDADD) $(top_builddir)/lib/libpatch.a $(LIB_CLOCK_GETTIME) \
+- $(LIB_XATTR)
++ $(LIB_XATTR) -lselinux
+
+ if ENABLE_MERGE
+ patch_SOURCES += merge.c
+diff -up patch-2.7/src/Makefile.in.selinux patch-2.7/src/Makefile.in
+--- patch-2.7/src/Makefile.in.selinux 2012-09-12 02:40:57.000000000 +0100
++++ patch-2.7/src/Makefile.in 2012-10-18 17:04:21.217420203 +0100
+@@ -989,7 +989,7 @@ patch_SOURCES = bestmatch.h common.h inp
+ AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
+ $(am__append_2)
+ patch_LDADD = $(LDADD) $(top_builddir)/lib/libpatch.a $(LIB_CLOCK_GETTIME) \
+- $(LIB_XATTR)
++ $(LIB_XATTR) -lselinux
+
+ all: all-am
+
+diff -up patch-2.7/src/patch.c.selinux patch-2.7/src/patch.c
+--- patch-2.7/src/patch.c.selinux 2012-08-08 12:24:46.000000000 +0100
++++ patch-2.7/src/patch.c 2012-10-18 17:04:21.219420213 +0100
+@@ -552,7 +552,7 @@ main (int argc, char **argv)
+ mode, &new_time);
+ else
+ {
+- attr |= FA_IDS | FA_MODE | FA_XATTRS;
++ attr |= FA_IDS | FA_MODE | FA_XATTRS | FA_SECCONTEXT;
+ set_file_attributes (TMPOUTNAME, attr, inname, &instat,
+ mode, &new_time);
}
- }
-diff -up patch-2.6.1/src/pch.c.selinux patch-2.6.1/src/pch.c
---- patch-2.6.1/src/pch.c.selinux 2011-05-04 16:17:59.000000000 +0200
-+++ patch-2.6.1/src/pch.c 2011-05-04 16:49:45.000000000 +0200
-@@ -289,7 +289,12 @@ there_is_another_patch (bool need_header
+diff -up patch-2.7/src/pch.c.selinux patch-2.7/src/pch.c
+--- patch-2.7/src/pch.c.selinux 2012-08-11 09:19:49.000000000 +0100
++++ patch-2.7/src/pch.c 2012-10-18 17:04:21.220420217 +0100
+@@ -295,7 +295,12 @@ there_is_another_patch (bool need_header
inname[t - buf - 1] = 0;
- if (stat (inname, &instat) == 0)
+ if (lstat (inname, &instat) == 0)
{
- inerrno = 0;
+ inerrno = getfilecon (inname, &incontext) == -1 ? errno : 0;
-+ if (inerrno == ENODATA || inerrno == ENOTSUP)
++ if (errno == ENODATA || inerrno == ENOTSUP)
+ {
+ inerrno = 0;
+ incontext = NULL;
@@ -113,7 +115,7 @@ diff -up patch-2.6.1/src/pch.c.selinux patch-2.6.1/src/pch.c
invc = -1;
}
else
-@@ -663,7 +668,7 @@ intuit_diff_type (bool need_header)
+@@ -927,7 +932,7 @@ intuit_diff_type (bool need_header, mode
if (cs)
{
if (version_get (p_name[i], cs, false, readonly,
@@ -122,20 +124,40 @@ diff -up patch-2.6.1/src/pch.c.selinux patch-2.6.1/src/pch.c
stat_errno[i] = 0;
else
version_controlled[i] = 0;
-@@ -728,6 +733,9 @@ intuit_diff_type (bool need_header)
+@@ -993,6 +998,9 @@ intuit_diff_type (bool need_header, mode
+ inerrno = stat_errno[i];
invc = version_controlled[i];
instat = st[i];
- validate_target_name (inname);
+ if (getfilecon (inname, &incontext) == -1)
+ if (errno == ENODATA || errno == ENOTSUP)
+ incontext = NULL;
}
return retval;
-diff -up patch-2.6.1/src/util.c.selinux patch-2.6.1/src/util.c
---- patch-2.6.1/src/util.c.selinux 2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6.1/src/util.c 2011-02-08 11:29:34.613271715 +0000
-@@ -574,7 +574,8 @@ version_controller (char const *filename
+diff -up patch-2.7/src/util.c.selinux patch-2.7/src/util.c
+--- patch-2.7/src/util.c.selinux 2012-08-11 09:20:49.000000000 +0100
++++ patch-2.7/src/util.c 2012-10-18 17:20:25.397226771 +0100
+@@ -291,6 +291,19 @@ set_file_attributes (char const *to, enu
+ S_ISLNK (mode) ? "symbolic link" : "file",
+ quotearg (to));
+ }
++ if (attr & FA_SECCONTEXT)
++ {
++ security_context_t outcontext;
++ if (incontext && getfilecon (to, &outcontext) != -1 &&
++ outcontext &&
++ strcmp (outcontext, incontext) &&
++ setfilecon (to, incontext) != 0)
++ {
++ if (errno != ENOTSUP && errno != EPERM)
++ pfatal ("Can't set security context on file %s",
++ quotearg (to));
++ }
++ }
+ }
+
+ static void
+@@ -807,7 +820,8 @@ version_controller (char const *filename
Return true if successful. */
bool
version_get (char const *filename, char const *cs, bool exists, bool readonly,
@@ -145,7 +167,7 @@ diff -up patch-2.6.1/src/util.c.selinux patch-2.6.1/src/util.c
{
if (patch_get < 0)
{
-@@ -599,6 +600,13 @@ version_get (char const *filename, char
+@@ -832,6 +846,13 @@ version_get (char const *filename, char
fatal ("Can't get file %s from %s", quotearg (filename), cs);
if (stat (filename, filestat) != 0)
pfatal ("%s", quotearg (filename));
@@ -159,10 +181,10 @@ diff -up patch-2.6.1/src/util.c.selinux patch-2.6.1/src/util.c
}
return 1;
-diff -up patch-2.6.1/src/util.h.selinux patch-2.6.1/src/util.h
---- patch-2.6.1/src/util.h.selinux 2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6.1/src/util.h 2011-02-08 11:29:34.614271726 +0000
-@@ -51,7 +51,7 @@ char *fetchname (char *, int, char **, t
+diff -up patch-2.7/src/util.h.selinux patch-2.7/src/util.h
+--- patch-2.7/src/util.h.selinux 2012-08-11 09:20:01.000000000 +0100
++++ patch-2.7/src/util.h 2012-10-18 17:04:21.220420217 +0100
+@@ -45,7 +45,7 @@ char *parse_name (char const *, int, cha
char *savebuf (char const *, size_t);
char *savestr (char const *);
char const *version_controller (char const *, bool, struct stat const *, char **, char **);
@@ -170,4 +192,14 @@ diff -up patch-2.6.1/src/util.h.selinux patch-2.6.1/src/util.h
+bool version_get (char const *, char const *, bool, bool, char const *, struct stat *, security_context_t *);
int create_file (char const *, int, mode_t, bool);
int systemic (char const *);
- char *format_linenum (char[LINENUM_LENGTH_BOUND + 1], LINENUM);
+ char *format_linenum (char[LINENUM_LENGTH_BOUND + 1], lin);
+@@ -73,7 +73,8 @@ enum file_attributes {
+ FA_TIMES = 1,
+ FA_IDS = 2,
+ FA_MODE = 4,
+- FA_XATTRS = 8
++ FA_XATTRS = 8,
++ FA_SECCONTEXT = 16
+ };
+
+ void set_file_attributes (char const *, enum file_attributes, char const *,
diff --git a/patch.spec b/patch.spec
index be16a6a..8712b25 100644
--- a/patch.spec
+++ b/patch.spec
@@ -1,16 +1,11 @@
Summary: Utility for modifying/upgrading files
Name: patch
-Version: 2.6.1
-Release: 13%{?dist}
+Version: 2.7
+Release: 1%{?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-get-arg.patch
-Patch3: patch-CVE-2010-4651.patch
-Patch4: patch-backup-if-mismatch.patch
-Patch5: patch-coverity-leak.patch
Patch100: patch-selinux.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -30,23 +25,6 @@ applications.
%prep
%setup -q
-# Avoid segfault.
-%patch1 -p1 -b .sigsegv
-
-# Fixed argument type for --get (bug #553624).
-%patch2 -p1 -b .get-arg
-
-# Applied upstream patch to fix CVE-2010-4651 so that malicious
-# patches cannot create files above the current directory
-# (bug #667529).
-%patch3 -p1 -b .CVE-2010-4651
-
-# Let --posix cause --no-backup-if-mismatch (bug #678016).
-%patch4 -p1 -b .backup-if-mismatch
-
-# Fix memory leak (bug #704554).
-%patch5 -p1 -b .coverity-leak
-
# SELinux support.
%patch100 -p1 -b .selinux
@@ -75,6 +53,10 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/*/*
%changelog
+* Thu Oct 18 2012 Tim Waugh <twaugh at redhat.com> 2.7-1
+- 2.7. No longer need sigsegv, get-arg, CVE-2010-4651,
+ backup-if-mismatch or coverity-leak patches.
+
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.6.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
diff --git a/sources b/sources
index 1dd45ef..efb49a2 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-057d78436e858c3ed086a544f5e1fe7e patch-2.6.1.tar.xz
+d443f9d9a7d1bf1715831883917699d9 patch-2.7.tar.xz
More information about the scm-commits
mailing list