[patch/f12/master] Another fix for the selinux patch (bug #618215).

Tim Waugh twaugh at fedoraproject.org
Mon Aug 16 16:44:36 UTC 2010


commit 1151a30acae3510a51cf5fda6e27943735668d6a
Author: Tim Waugh <twaugh at redhat.com>
Date:   Mon Aug 16 17:44:01 2010 +0100

    Another fix for the selinux patch (bug #618215).

 patch-selinux.patch |   79 +++++++++++++++++++++++++--------------------------
 patch.spec          |    5 ++-
 2 files changed, 43 insertions(+), 41 deletions(-)
---
diff --git a/patch-selinux.patch b/patch-selinux.patch
index d88e222..45ed818 100644
--- a/patch-selinux.patch
+++ b/patch-selinux.patch
@@ -1,6 +1,6 @@
-diff -up patch-2.6/Makefile.in.selinux patch-2.6/Makefile.in
---- patch-2.6/Makefile.in.selinux	2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6/Makefile.in	2009-11-16 09:38:44.171021894 +0000
+diff -up patch-2.6.1/Makefile.in.selinux patch-2.6.1/Makefile.in
+--- patch-2.6.1/Makefile.in.selinux	2009-12-30 12:56:30.000000000 +0000
++++ patch-2.6.1/Makefile.in	2010-08-16 17:36:31.778174077 +0100
 @@ -40,7 +40,7 @@ EXEEXT = @EXEEXT@
  LDFLAGS = @LDFLAGS@
  LIBOBJDIR = gl/lib/
@@ -10,9 +10,9 @@ diff -up patch-2.6/Makefile.in.selinux patch-2.6/Makefile.in
  OBJEXT = @OBJEXT@
  PACKAGE_NAME = @PACKAGE_NAME@
  PACKAGE_VERSION = @PACKAGE_VERSION@
-diff -up patch-2.6/src/common.h.selinux patch-2.6/src/common.h
---- patch-2.6/src/common.h.selinux	2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6/src/common.h	2009-11-16 09:38:12.579147244 +0000
+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	2010-08-16 17:36:31.779174533 +0100
 @@ -32,6 +32,8 @@
  #include <sys/types.h>
  #include <time.h>
@@ -30,32 +30,31 @@ diff -up patch-2.6/src/common.h.selinux patch-2.6/src/common.h
  XTERN bool dry_run;
  XTERN bool posixly_correct;
  
-diff -up patch-2.6/src/inp.c.selinux patch-2.6/src/inp.c
---- patch-2.6/src/inp.c.selinux	2009-11-16 09:37:57.515147431 +0000
-+++ patch-2.6/src/inp.c	2009-11-16 09:40:04.782022221 +0000
-@@ -153,7 +153,20 @@ get_input_file (char const *filename, ch
+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	2010-08-16 17:36:31.767177911 +0100
++++ patch-2.6.1/src/inp.c	2010-08-16 17:36:59.356174175 +0100
+@@ -152,8 +152,18 @@ get_input_file (char const *filename, ch
+     char *diffbuf;
      char *getbuf;
  
-     if (inerrno == -1)
+-    if (inerrno == -1)
 -      inerrno = stat (filename, &instat) == 0 ? 0 : errno;
++    inerrno = stat (filename, &instat) == 0 ? 0 : errno;
++    if (inerrno == 0)
 +      {
-+	inerrno = stat (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;
++        inerrno = getfilecon (inname, &incontext) == -1 ? errno : 0;
++        if (inerrno == ENODATA || inerrno == ENOTSUP)
++          {
++    	inerrno = 0;
++    	incontext = NULL;
++          }
 +      }
++    else
++      incontext = NULL;
  
      /* Perhaps look for RCS or SCCS versions.  */
      if (patch_get
-@@ -197,7 +210,7 @@ get_input_file (char const *filename, ch
+@@ -197,7 +207,7 @@ get_input_file (char const *filename, ch
  	    }
  
  	    if (cs && version_get (filename, cs, ! inerrno, elsewhere, getbuf,
@@ -64,7 +63,7 @@ diff -up patch-2.6/src/inp.c.selinux patch-2.6/src/inp.c
  	      inerrno = 0;
  
  	    free (getbuf);
-@@ -209,6 +222,7 @@ get_input_file (char const *filename, ch
+@@ -209,6 +219,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;
@@ -72,9 +71,9 @@ diff -up patch-2.6/src/inp.c.selinux patch-2.6/src/inp.c
        }
      else if (! S_ISREG (instat.st_mode))
        fatal ("File %s is not a regular file -- can't patch",
-diff -up patch-2.6/src/patch.c.selinux patch-2.6/src/patch.c
---- patch-2.6/src/patch.c.selinux	2009-11-16 09:37:57.516146641 +0000
-+++ patch-2.6/src/patch.c	2009-11-16 09:41:47.676147549 +0000
+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	2010-08-16 17:36:31.775174023 +0100
++++ patch-2.6.1/src/patch.c	2010-08-16 17:36:31.782174240 +0100
 @@ -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);
@@ -97,10 +96,10 @@ diff -up patch-2.6/src/patch.c.selinux patch-2.6/src/patch.c
  			  /* FIXME: There may be other attributes to preserve.  */
  			}
  		    }
-diff -up patch-2.6/src/pch.c.selinux patch-2.6/src/pch.c
---- patch-2.6/src/pch.c.selinux	2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6/src/pch.c	2009-11-16 09:42:17.453147283 +0000
-@@ -288,7 +288,12 @@ there_is_another_patch (bool need_header
+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	2009-12-30 12:56:30.000000000 +0000
++++ patch-2.6.1/src/pch.c	2010-08-16 17:36:31.786174283 +0100
+@@ -287,7 +287,12 @@ there_is_another_patch (bool need_header
  	    inname[t - buf - 1] = 0;
  	    if (stat (inname, &instat) == 0)
  	      {
@@ -114,7 +113,7 @@ diff -up patch-2.6/src/pch.c.selinux patch-2.6/src/pch.c
  		invc = -1;
  	      }
  	    else
-@@ -662,7 +667,7 @@ intuit_diff_type (bool need_header)
+@@ -661,7 +666,7 @@ intuit_diff_type (bool need_header)
  			  if (cs)
  			    {
  			      if (version_get (p_name[i], cs, false, readonly,
@@ -123,7 +122,7 @@ diff -up patch-2.6/src/pch.c.selinux patch-2.6/src/pch.c
  				stat_errno[i] = 0;
  			      else
  				version_controlled[i] = 0;
-@@ -727,6 +732,7 @@ intuit_diff_type (bool need_header)
+@@ -725,6 +730,7 @@ intuit_diff_type (bool need_header)
  	inerrno = stat_errno[i];
  	invc = version_controlled[i];
  	instat = st[i];
@@ -131,9 +130,9 @@ diff -up patch-2.6/src/pch.c.selinux patch-2.6/src/pch.c
        }
  
      return retval;
-diff -up patch-2.6/src/util.c.selinux patch-2.6/src/util.c
---- patch-2.6/src/util.c.selinux	2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6/src/util.c	2009-11-16 09:40:27.472147644 +0000
+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	2010-08-16 17:36:31.794173938 +0100
 @@ -574,7 +574,8 @@ version_controller (char const *filename
     Return true if successful.  */
  bool
@@ -158,9 +157,9 @@ diff -up patch-2.6/src/util.c.selinux patch-2.6/src/util.c
      }
  
    return 1;
-diff -up patch-2.6/src/util.h.selinux patch-2.6/src/util.h
---- patch-2.6/src/util.h.selinux	2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6/src/util.h	2009-11-16 09:42:48.750148164 +0000
+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	2010-08-16 17:36:31.795173993 +0100
 @@ -51,7 +51,7 @@ char *fetchname (char *, int, char **, t
  char *savebuf (char const *, size_t);
  char *savestr (char const *);
diff --git a/patch.spec b/patch.spec
index ed6fb9a..67dcfde 100644
--- a/patch.spec
+++ b/patch.spec
@@ -1,7 +1,7 @@
 Summary: Utility for modifying/upgrading files
 Name: patch
 Version: 2.6.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2+
 URL: http://www.gnu.org/software/patch/patch.html
 Group: Development/Tools
@@ -61,6 +61,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/*/*
 
 %changelog
+* Mon Aug 16 2010 Tim Waugh <twaugh at redhat.com> 2.6.1-4
+- Another fix for the selinux patch (bug #618215).
+
 * Fri Aug  6 2010 Tim Waugh <twaugh at redhat.com> 2.6.1-3
 - Fixed interpretation of return value from getfilecon().
 - Fixed argument type for --get (bug #553624).


More information about the scm-commits mailing list