- 2.6. No longer need stderr, suffix, stripcr, parse, allow-spaces, ifdef,

program_name, or posix-backup patches.
This commit is contained in:
Tim Waugh 2009-11-16 10:05:01 +00:00
parent 988f8a1a7e
commit d1ec77bd15
15 changed files with 175 additions and 448 deletions

View File

@ -1 +1,2 @@
patch-2.5.4.tar.gz patch-2.5.4.tar.gz
patch-2.6.tar.xz

View File

@ -1,11 +0,0 @@
--- patch-2.5/util.c~ Thu Jul 10 09:16:12 1997
+++ patch-2.5/util.c Sun Jun 6 18:16:30 1999
@@ -568,6 +568,8 @@
int r;
va_list args;
+ fflush(stderr); /* Ensure pending errors are written before the question */
+
vararg_start (args, format);
vfprintf (stdout, format, args);
va_end (args);

View File

@ -1,70 +0,0 @@
--- patch-2.5.4/patch.c.ifdef Tue Mar 5 09:42:45 2002
+++ patch-2.5.4/patch.c Tue Mar 5 09:42:47 2002
@@ -88,8 +88,9 @@
static char const *do_defines; /* symbol to patch using ifdef, ifndef, etc. */
static char const if_defined[] = "\n#ifdef %s\n";
-static char const not_defined[] = "#ifndef %s\n";
-static char const else_defined[] = "\n#else\n";
+static char const not_defined[] = "\n#ifndef %s\n";
+static char const elseis_defined[] = "\n#else /* %s */\n";
+static char const elsenot_defined[] = "\n#else /* not %s */\n";
static char const end_defined[] = "\n#endif /* %s */\n";
static int Argc;
@@ -1014,12 +1015,13 @@
return FALSE;
if (R_do_defines) {
if (def_state == OUTSIDE) {
- fprintf (fp, outstate->after_newline + if_defined,
+ fprintf (fp, outstate->after_newline + not_defined,
R_do_defines);
def_state = IN_IFNDEF;
}
else if (def_state == IN_IFDEF) {
- fprintf (fp, outstate->after_newline + else_defined);
+ fprintf (fp, outstate->after_newline + elsenot_defined,
+ R_do_defines);
def_state = IN_ELSE;
}
if (ferror (fp))
@@ -1038,7 +1040,8 @@
return FALSE;
if (R_do_defines) {
if (def_state == IN_IFNDEF) {
- fprintf (fp, outstate->after_newline + else_defined);
+ fprintf (fp, outstate->after_newline + elseis_defined,
+ R_do_defines);
def_state = IN_ELSE;
}
else if (def_state == OUTSIDE) {
@@ -1069,7 +1072,8 @@
return FALSE;
assert (outstate->after_newline);
if (R_do_defines) {
- fprintf (fp, not_defined, R_do_defines);
+ fprintf (fp, outstate->after_newline + not_defined,
+ R_do_defines);
if (ferror (fp))
write_fatal ();
def_state = IN_IFNDEF;
@@ -1086,7 +1090,8 @@
while (pch_char (old) == '!');
if (R_do_defines) {
- fprintf (fp, outstate->after_newline + else_defined);
+ fprintf (fp, outstate->after_newline + elseis_defined,
+ R_do_defines);
if (ferror (fp))
write_fatal ();
def_state = IN_ELSE;
@@ -1124,7 +1129,8 @@
def_state = IN_IFDEF;
}
else if (def_state == IN_IFNDEF) {
- fprintf (fp, outstate->after_newline + else_defined);
+ fprintf (fp, outstate->after_newline + elseis_defined,
+ R_do_defines);
def_state = IN_ELSE;
}
if (ferror (fp))

View File

@ -1,11 +0,0 @@
--- patch-2.5.4/error.c.program_name Tue Apr 9 14:38:27 2002
+++ patch-2.5.4/error.c Tue Apr 9 14:38:43 2002
@@ -80,7 +80,7 @@
/* The calling program should define program_name and set it to the
name of the executing program. */
-extern char *program_name;
+extern char const program_name[];
# ifdef HAVE_STRERROR_R
# define __strerror_r strerror_r

View File

@ -1,11 +1,7 @@
Bug report: #14693 diff -up patch-2.6/src/inp.c.sigsegv patch-2.6/src/inp.c
Reported by: Vincent Renardias <vincent@waw.com> --- patch-2.6/src/inp.c.sigsegv 2009-11-02 19:09:57.000000000 +0000
Patch: jdassen@wi.leidenuniv.nl (J.H.M.Dassen) +++ patch-2.6/src/inp.c 2009-11-16 09:31:52.305022200 +0000
Since Version: 2.5-2 @@ -77,6 +77,14 @@ re_input (void)
--- patch-2.5.orig/inp.c
+++ patch-2.5/inp.c
@@ -71,6 +71,14 @@
} }
} }
@ -20,9 +16,19 @@ Since Version: 2.5-2
/* Construct the line index, somehow or other. */ /* Construct the line index, somehow or other. */
void void
--- patch-2.5.orig/patch.c diff -up patch-2.6/src/inp.h.sigsegv patch-2.6/src/inp.h
+++ patch-2.5/patch.c --- patch-2.6/src/inp.h.sigsegv 2009-11-02 19:09:57.000000000 +0000
@@ -210,7 +210,10 @@ +++ patch-2.6/src/inp.h 2009-11-16 09:32:24.440021838 +0000
@@ -24,4 +24,5 @@ XTERN LINENUM input_lines; /* how long
char const *ifetch (LINENUM, bool, size_t *);
void get_input_file (char const *, char const *);
void re_input (void);
+void reset_scan_input_vars (void);
void scan_input (char *);
diff -up patch-2.6/src/patch.c.sigsegv patch-2.6/src/patch.c
--- patch-2.6/src/patch.c.sigsegv 2009-11-02 19:09:57.000000000 +0000
+++ patch-2.6/src/patch.c 2009-11-16 09:31:52.306021801 +0000
@@ -210,7 +210,10 @@ main (int argc, char **argv)
/* find out where all the lines are */ /* find out where all the lines are */
if (!skip_rest_of_patch) if (!skip_rest_of_patch)
@ -34,11 +40,3 @@ Since Version: 2.5-2
/* from here on, open no standard i/o files, because malloc */ /* from here on, open no standard i/o files, because malloc */
/* might misfire and we can't catch it easily */ /* might misfire and we can't catch it easily */
--- patch-2.5.orig/inp.h
+++ patch-2.5/inp.h
@@ -7,4 +7,5 @@
char const *ifetch PARAMS ((LINENUM, int, size_t *));
void get_input_file PARAMS ((char const *, char const *));
void re_input PARAMS ((void));
+void reset_scan_input_vars PARAMS (());
void scan_input PARAMS ((char *));

View File

@ -1,12 +0,0 @@
--- patch-2.5.4/patch.c.suffix Thu Nov 2 17:57:46 2000
+++ patch-2.5.4/patch.c Thu Nov 2 17:58:25 2000
@@ -145,8 +145,7 @@
: posixly_correct - 1);
val = getenv ("SIMPLE_BACKUP_SUFFIX");
- if (val && *val)
- simple_backup_suffix = val;
+ simple_backup_suffix = val && *val ? val : ".orig";
if ((version_control = getenv ("PATCH_VERSION_CONTROL")))
version_control_context = "$PATCH_VERSION_CONTROL";

7
patch-2.6.tar.xz.sig Normal file
View File

@ -0,0 +1,7 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
iEYEABECAAYFAkr9aWMACgkQ9+hy/rlxVNMK0wCgg0Jg3HqcXm2Eh8jR66YADk8L
Si8AmwZ1EDTTvYmeQmae0zrYK6+4HRTR
=KgtY
-----END PGP SIGNATURE-----

View File

@ -1,16 +0,0 @@
--- patch-2.5.4/util.c 1999-08-30 07:20:08.000000000 +0100
+++ patch-2.5.9/util.c 2003-05-20 15:04:53.000000000 +0100
@@ -939,7 +939,13 @@ fetchname (char *at, int strip_leading,
}
else if (ISSPACE ((unsigned char) *t))
{
+ /* Allow file names with internal spaces,
+ but only if a tab separates the file name from the date. */
char const *u = t;
+ while (*u != '\t' && ISSPACE ((unsigned char) u[1]))
+ u++;
+ if (*u != '\t' && strchr (u + 1, '\t'))
+ continue;
if (set_time | set_utc)
stamp = str2time (&u, initial_time,

View File

@ -1,12 +0,0 @@
--- patch-2.5.4/partime.c.parse 1998-03-15 15:48:53.000000000 +0000
+++ patch-2.5.4/partime.c 2005-09-07 08:04:41.000000000 +0000
@@ -792,7 +792,8 @@
if (negative)
n = -n;
while (!ISALNUM ((unsigned char) *s))
- s++;
+ if (*s++ == '\0')
+ return 0;
i = lookup (s, relative_units);
if (!TM_DEFINED (i))
return 0;

View File

@ -1,166 +0,0 @@
diff -up patch-2.5.4/util.c.posix-backup patch-2.5.4/util.c
--- patch-2.5.4/util.c.posix-backup 2008-06-16 10:22:52.000000000 +0100
+++ patch-2.5.4/util.c 2008-06-16 11:30:27.000000000 +0100
@@ -109,37 +109,40 @@ move_file (char const *from, int volatil
memory_fatal ();
}
- if (to_errno)
+ if (strcmp (bakname, "/dev/null") != 0)
{
- int fd;
+ if (to_errno)
+ {
+ int fd;
- if (debug & 4)
- say ("Creating empty unreadable file %s\n", quotearg (bakname));
+ if (debug & 4)
+ say ("Creating empty unreadable file %s\n", quotearg (bakname));
- try_makedirs_errno = ENOENT;
- unlink (bakname);
- while ((fd = creat (bakname, 0)) < 0)
- {
- if (errno != try_makedirs_errno)
- pfatal ("Can't create file %s", quotearg (bakname));
- makedirs (bakname);
- try_makedirs_errno = 0;
+ try_makedirs_errno = ENOENT;
+ unlink (bakname);
+ while ((fd = creat (bakname, 0)) < 0)
+ {
+ if (errno != try_makedirs_errno)
+ pfatal ("Can't create file %s", quotearg (bakname));
+ makedirs (bakname);
+ try_makedirs_errno = 0;
+ }
+ if (close (fd) != 0)
+ pfatal ("Can't close file %s", quotearg (bakname));
}
- if (close (fd) != 0)
- pfatal ("Can't close file %s", quotearg (bakname));
- }
- else
- {
- if (debug & 4)
- say ("Renaming file %s to %s\n",
- quotearg_n (0, to), quotearg_n (1, bakname));
- while (rename (to, bakname) != 0)
+ else
{
- if (errno != try_makedirs_errno)
- pfatal ("Can't rename file %s to %s",
- quotearg_n (0, to), quotearg_n (1, bakname));
- makedirs (bakname);
- try_makedirs_errno = 0;
+ if (debug & 4)
+ say ("Renaming file %s to %s\n",
+ quotearg_n (0, to), quotearg_n (1, bakname));
+ while (rename (to, bakname) != 0)
+ {
+ if (errno != try_makedirs_errno)
+ pfatal ("Can't rename file %s to %s",
+ quotearg_n (0, to), quotearg_n (1, bakname));
+ makedirs (bakname);
+ try_makedirs_errno = 0;
+ }
}
}
diff -up patch-2.5.4/backupfile.c.posix-backup patch-2.5.4/backupfile.c
--- patch-2.5.4/backupfile.c.posix-backup 2008-06-16 11:27:55.000000000 +0100
+++ patch-2.5.4/backupfile.c 2008-06-16 11:44:05.000000000 +0100
@@ -23,6 +23,8 @@
# include <config.h>
#endif
+#define XTERN extern
+#include <common.h>
#include <argmatch.h>
#include <backupfile.h>
@@ -118,11 +120,15 @@ static int version_number PARAMS ((const
char *
find_backup_file_name (const char *file, enum backup_type backup_type)
{
+ static char **previous_files = NULL;
+ static int previous_files_allocated = 0;
+
size_t backup_suffix_size_max;
size_t file_len = strlen (file);
size_t numbered_suffix_size_max = INT_STRLEN_BOUND (int) + 4;
char *s;
const char *suffix = simple_backup_suffix;
+ int used_version = 0;
/* Allow room for simple or `.~N~' backups. */
backup_suffix_size_max = strlen (simple_backup_suffix) + 1;
@@ -147,12 +153,66 @@ find_backup_file_name (const char *file,
char *numbered_suffix = s + (file_len + backup_suffix_size_max);
sprintf (numbered_suffix, ".~%d~", highest_backup + 1);
suffix = numbered_suffix;
+ used_version = 1;
}
strcpy (s, file);
}
#endif /* HAVE_DIR */
- addext (s, suffix, '~');
+ if (used_version == 0)
+ {
+ /* If we have already written a ".orig" backup file during
+ this run, don't overwrite it. */
+ if (previous_files_allocated != 0)
+ {
+ int i;
+ for (i = 0; previous_files[i] != NULL; i++)
+ {
+ if (!strcmp (previous_files[i], s))
+ {
+ strcpy (s, "/dev/null");
+ break;
+ }
+ }
+
+ if (previous_files[i] == NULL)
+ {
+ if (i == previous_files_allocated - 1)
+ {
+ char **old_previous_files = previous_files;
+ previous_files = realloc (previous_files,
+ 2 * previous_files_allocated *
+ sizeof (const char *));
+ if (previous_files)
+ previous_files_allocated *= 2;
+ else
+ {
+ for (i = 0; old_previous_files[i] != NULL; i++)
+ free (old_previous_files[i]);
+ free (old_previous_files);
+ previous_files_allocated = 0;
+ }
+ }
+
+ if (i < previous_files_allocated - 1)
+ {
+ previous_files[i] = strdup (s);
+ previous_files[i + 1] = NULL;
+ }
+ }
+ }
+ else
+ {
+ previous_files_allocated = 2;
+ previous_files = malloc (previous_files_allocated *
+ sizeof (const char *));
+ previous_files[0] = strdup (s);
+ previous_files[1] = NULL;
+ }
+ }
+
+ if (strcmp (s, "/dev/null") != 0)
+ addext (s, suffix, '~');
}
return s;
}

View File

@ -1,7 +1,19 @@
diff -up patch-2.5.4/common.h.selinux patch-2.5.4/common.h diff -up patch-2.6/Makefile.in.selinux patch-2.6/Makefile.in
--- patch-2.5.4/common.h.selinux 1999-08-30 07:20:08.000000000 +0100 --- patch-2.6/Makefile.in.selinux 2009-11-02 19:09:57.000000000 +0000
+++ patch-2.5.4/common.h 2009-02-17 15:33:13.000000000 +0000 +++ patch-2.6/Makefile.in 2009-11-16 09:38:44.171021894 +0000
@@ -39,6 +39,8 @@ @@ -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/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
@@ -32,6 +32,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
@ -10,7 +22,7 @@ diff -up patch-2.5.4/common.h.selinux patch-2.5.4/common.h
#include <sys/stat.h> #include <sys/stat.h>
#if ! defined S_ISDIR && defined S_IFDIR #if ! defined S_ISDIR && defined S_IFDIR
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
@@ -168,6 +170,7 @@ XTERN char *outfile; @@ -118,6 +120,7 @@ XTERN char *outfile;
XTERN int inerrno; XTERN int inerrno;
XTERN int invc; XTERN int invc;
XTERN struct stat instat; XTERN struct stat instat;
@ -18,16 +30,16 @@ diff -up patch-2.5.4/common.h.selinux patch-2.5.4/common.h
XTERN bool dry_run; XTERN bool dry_run;
XTERN bool posixly_correct; XTERN bool posixly_correct;
diff -up patch-2.5.4/inp.c.selinux patch-2.5.4/inp.c diff -up patch-2.6/src/inp.c.selinux patch-2.6/src/inp.c
--- patch-2.5.4/inp.c.selinux 2009-02-17 15:33:13.000000000 +0000 --- patch-2.6/src/inp.c.selinux 2009-11-16 09:37:57.515147431 +0000
+++ patch-2.5.4/inp.c 2009-02-17 15:33:13.000000000 +0000 +++ patch-2.6/src/inp.c 2009-11-16 09:40:04.782022221 +0000
@@ -154,7 +154,20 @@ get_input_file (char const *filename, ch @@ -153,7 +153,20 @@ get_input_file (char const *filename, ch
char *getbuf; char *getbuf;
if (inerrno == -1) if (inerrno == -1)
- inerrno = stat (inname, &instat) == 0 ? 0 : errno; - inerrno = stat (filename, &instat) == 0 ? 0 : errno;
+ { + {
+ inerrno = stat (inname, &instat) == 0 ? 0 : errno; + inerrno = stat (filename, &instat) == 0 ? 0 : errno;
+ if (inerrno == 0) + if (inerrno == 0)
+ { + {
+ inerrno = getfilecon (inname, &incontext) == -1 ? errno : 0; + inerrno = getfilecon (inname, &incontext) == -1 ? errno : 0;
@ -43,7 +55,7 @@ diff -up patch-2.5.4/inp.c.selinux patch-2.5.4/inp.c
/* Perhaps look for RCS or SCCS versions. */ /* Perhaps look for RCS or SCCS versions. */
if (patch_get if (patch_get
@@ -196,7 +209,7 @@ get_input_file (char const *filename, ch @@ -197,7 +210,7 @@ get_input_file (char const *filename, ch
} }
if (cs && version_get (filename, cs, ! inerrno, elsewhere, getbuf, if (cs && version_get (filename, cs, ! inerrno, elsewhere, getbuf,
@ -52,7 +64,7 @@ diff -up patch-2.5.4/inp.c.selinux patch-2.5.4/inp.c
inerrno = 0; inerrno = 0;
free (getbuf); free (getbuf);
@@ -213,6 +226,7 @@ get_input_file (char const *filename, ch @@ -209,6 +222,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_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
instat.st_size = 0; instat.st_size = 0;
@ -60,43 +72,36 @@ diff -up patch-2.5.4/inp.c.selinux patch-2.5.4/inp.c
} }
else if (! S_ISREG (instat.st_mode)) else if (! S_ISREG (instat.st_mode))
fatal ("File %s is not a regular file -- can't patch", fatal ("File %s is not a regular file -- can't patch",
diff -up patch-2.5.4/Makefile.in.selinux patch-2.5.4/Makefile.in diff -up patch-2.6/src/patch.c.selinux patch-2.6/src/patch.c
--- patch-2.5.4/Makefile.in.selinux 1999-08-30 07:37:54.000000000 +0100 --- patch-2.6/src/patch.c.selinux 2009-11-16 09:37:57.516146641 +0000
+++ patch-2.5.4/Makefile.in 2009-02-17 15:33:13.000000000 +0000 +++ patch-2.6/src/patch.c 2009-11-16 09:41:47.676147549 +0000
@@ -36,7 +36,7 @@ DEFS = @DEFS@ @@ -421,6 +421,21 @@ main (int argc, char **argv)
EXEEXT = @EXEEXT@ /* Fails if we are not in group instat.st_gid. */
LDFLAGS = @LDFLAGS@ chown (outname, -1, instat.st_gid);
LIBOBJS = @LIBOBJS@ }
-LIBS = @LIBS@ +
+LIBS = @LIBS@ -lselinux + if (! inerrno && incontext)
PACKAGE = @PACKAGE@ + {
U = @U@ + security_context_t outcontext;
VERSION = @VERSION@ + if (! getfilecon (outname, &outcontext) &&
diff -up patch-2.5.4/patch.c.selinux patch-2.5.4/patch.c + outcontext &&
--- patch-2.5.4/patch.c.selinux 2009-02-17 15:33:13.000000000 +0000 + strcmp(outcontext, incontext) &&
+++ patch-2.5.4/patch.c 2009-02-17 15:34:42.000000000 +0000 + setfilecon (outname, incontext) != 0)
@@ -414,6 +414,16 @@ main (int argc, char **argv) + {
if (! inerrno && chmod (outname, instat.st_mode) != 0)
pfatal ("Can't set permissions on file %s",
quotearg (outname));
+ if (! inerrno && incontext) {
+ security_context_t outcontext;
+ if (! getfilecon (outname, &outcontext) && outcontext &&
+ strcmp(outcontext, incontext) &&
+ setfilecon (outname, incontext) != 0) {
+ if (errno != ENOTSUP && errno != EPERM) + if (errno != ENOTSUP && errno != EPERM)
+ pfatal ("Can't set security context on file %s", + pfatal ("Can't set security context "
+ quotearg (outname)); + "on file %s", quotearg (outname));
+ } + }
+ } + }
} +
} /* FIXME: There may be other attributes to preserve. */
} }
diff -up patch-2.5.4/pch.c.selinux patch-2.5.4/pch.c }
--- patch-2.5.4/pch.c.selinux 2009-02-17 15:33:13.000000000 +0000 diff -up patch-2.6/src/pch.c.selinux patch-2.6/src/pch.c
+++ patch-2.5.4/pch.c 2009-02-17 15:33:13.000000000 +0000 --- patch-2.6/src/pch.c.selinux 2009-11-02 19:09:57.000000000 +0000
@@ -258,7 +258,12 @@ there_is_another_patch (void) +++ 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
inname[t - buf - 1] = 0;
if (stat (inname, &instat) == 0) if (stat (inname, &instat) == 0)
{ {
- inerrno = 0; - inerrno = 0;
@ -109,37 +114,37 @@ diff -up patch-2.5.4/pch.c.selinux patch-2.5.4/pch.c
invc = -1; invc = -1;
} }
else else
@@ -573,7 +578,7 @@ intuit_diff_type (void) @@ -662,7 +667,7 @@ intuit_diff_type (bool need_header)
if (cs) if (cs)
{ {
if (version_get (name[i], cs, 0, readonly, if (version_get (p_name[i], cs, false, readonly,
- getbuf, &st[i])) - getbuf, &st[i]))
+ getbuf, &st[i], NULL)) + getbuf, &st[i], NULL))
stat_errno[i] = 0; stat_errno[i] = 0;
else else
version_controlled[i] = 0; version_controlled[i] = 0;
@@ -641,6 +646,7 @@ intuit_diff_type (void) @@ -727,6 +732,7 @@ intuit_diff_type (bool need_header)
inerrno = stat_errno[i]; inerrno = stat_errno[i];
invc = version_controlled[i]; invc = version_controlled[i];
instat = st[i]; instat = st[i];
+ getfilecon (inname, &incontext); + getfilecon (inname, &incontext);
} }
for (i = OLD; i <= INDEX; i++) return retval;
diff -up patch-2.5.4/util.c.selinux patch-2.5.4/util.c diff -up patch-2.6/src/util.c.selinux patch-2.6/src/util.c
--- patch-2.5.4/util.c.selinux 2009-02-17 15:33:13.000000000 +0000 --- patch-2.6/src/util.c.selinux 2009-11-02 19:09:57.000000000 +0000
+++ patch-2.5.4/util.c 2009-02-17 15:33:13.000000000 +0000 +++ patch-2.6/src/util.c 2009-11-16 09:40:27.472147644 +0000
@@ -375,7 +375,8 @@ version_controller (char const *filename @@ -574,7 +574,8 @@ version_controller (char const *filename
Return nonzero if successful. */ Return true if successful. */
int bool
version_get (char const *filename, char const *cs, int exists, int readonly, version_get (char const *filename, char const *cs, bool exists, bool readonly,
- char const *getbuf, struct stat *filestat) - char const *getbuf, struct stat *filestat)
+ char const *getbuf, struct stat *filestat, + char const *getbuf, struct stat *filestat,
+ security_context_t *filecontext) + security_context_t *filecontext)
{ {
if (patch_get < 0) if (patch_get < 0)
{ {
@@ -400,6 +401,13 @@ version_get (char const *filename, char @@ -599,6 +600,13 @@ version_get (char const *filename, char
fatal ("Can't get file %s from %s", quotearg (filename), cs); fatal ("Can't get file %s from %s", quotearg (filename), cs);
if (stat (filename, filestat) != 0) if (stat (filename, filestat) != 0)
pfatal ("%s", quotearg (filename)); pfatal ("%s", quotearg (filename));
@ -153,15 +158,15 @@ diff -up patch-2.5.4/util.c.selinux patch-2.5.4/util.c
} }
return 1; return 1;
diff -up patch-2.5.4/util.h.selinux patch-2.5.4/util.h diff -up patch-2.6/src/util.h.selinux patch-2.6/src/util.h
--- patch-2.5.4/util.h.selinux 1999-08-30 07:20:08.000000000 +0100 --- patch-2.6/src/util.h.selinux 2009-11-02 19:09:57.000000000 +0000
+++ patch-2.5.4/util.h 2009-02-17 15:33:13.000000000 +0000 +++ patch-2.6/src/util.h 2009-11-16 09:42:48.750148164 +0000
@@ -21,7 +21,7 @@ char *fetchname PARAMS ((char *, int, ti @@ -51,7 +51,7 @@ char *fetchname (char *, int, char **, t
char *savebuf PARAMS ((char const *, size_t)); char *savebuf (char const *, size_t);
char *savestr PARAMS ((char const *)); char *savestr (char const *);
char const *version_controller PARAMS ((char const *, int, struct stat const *, char **, char **)); char const *version_controller (char const *, bool, struct stat const *, char **, char **);
-int version_get PARAMS ((char const *, char const *, int, int, char const *, struct stat *)); -bool version_get (char const *, char const *, bool, bool, char const *, struct stat *);
+int version_get PARAMS ((char const *, char const *, int, int, char const *, struct stat *, security_context_t *)); +bool version_get (char const *, char const *, bool, bool, char const *, struct stat *, security_context_t *);
int create_file PARAMS ((char const *, int, mode_t)); int create_file (char const *, int, mode_t, bool);
int systemic PARAMS ((char const *)); int systemic (char const *);
char *format_linenum PARAMS ((char[LINENUM_LENGTH_BOUND + 1], LINENUM)); char *format_linenum (char[LINENUM_LENGTH_BOUND + 1], LINENUM);

View File

@ -1,35 +0,0 @@
--- patch-2.5.4/pch.c.stripcr 1999-08-30 07:20:08.000000000 +0100
+++ patch-2.5.4/pch.c 2005-08-11 12:59:35.000000000 +0100
@@ -355,10 +355,16 @@
if (!stars_last_line && strnEQ(s, "*** ", 4))
name[OLD] = fetchname (s+4, strippath, &p_timestamp[OLD]);
else if (strnEQ(s, "+++ ", 4))
+ {
/* Swap with NEW below. */
name[OLD] = fetchname (s+4, strippath, &p_timestamp[OLD]);
+ p_strip_trailing_cr = strip_trailing_cr;
+ }
else if (strnEQ(s, "Index:", 6))
+ {
name[INDEX] = fetchname (s+6, strippath, (time_t *) 0);
+ p_strip_trailing_cr = strip_trailing_cr;
+ }
else if (strnEQ(s, "Prereq:", 7)) {
for (t = s + 7; ISSPACE ((unsigned char) *t); t++)
continue;
@@ -386,6 +392,7 @@
p_timestamp[NEW] = timestamp;
p_rfc934_nesting = (t - s) >> 1;
}
+ p_strip_trailing_cr = strip_trailing_cr;
}
}
if ((diff_type == NO_DIFF || diff_type == ED_DIFF) &&
@@ -419,7 +426,6 @@
if (s[0] == '+' && s[1] == '0' && !ISDIGIT (s[2]))
p_says_nonexistent[NEW] = 1 + ! p_timestamp[NEW];
p_indent = indent;
- p_strip_trailing_cr = strip_trailing_cr;
p_start = this_line;
p_sline = p_input_line;
retval = UNI_DIFF;

View File

@ -1,21 +1,13 @@
Summary: Utility for modifying/upgrading files Summary: Utility for modifying/upgrading files
Name: patch Name: patch
Version: 2.5.4 Version: 2.6
Release: 40%{?dist} Release: 1%{?dist}
License: GPLv2+ License: GPLv2+
URL: http://www.gnu.org/software/patch/patch.html URL: http://www.gnu.org/software/patch/patch.html
Group: Development/Tools Group: Development/Tools
Source: ftp://ftp.gnu.org/gnu/patch/patch-%{version}.tar.gz Source: ftp://ftp.gnu.org/gnu/patch/patch-%{version}.tar.xz
Patch1: patch-2.5-stderr.patch Patch1: patch-2.5.4-sigsegv.patch
Patch2: patch-2.5.4-suffix.patch Patch100: patch-selinux.patch
Patch3: patch-2.5.4-sigsegv.patch
Patch4: patch-2.5.4-ifdef.patch
Patch5: patch-2.5.4-program_name.patch
Patch6: patch-stripcr.patch
Patch7: patch-parse.patch
Patch8: patch-allow-spaces.patch
Patch9: patch-selinux.patch
Patch10: patch-posix-backup.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
@ -32,16 +24,8 @@ applications.
%prep %prep
%setup -q %setup -q
%patch1 -p1 -b .stderr %patch1 -p1 -b .sigsegv
%patch2 -p1 -b .suffix %patch100 -p1 -b .selinux
%patch3 -p1 -b .sigsegv
%patch4 -p1 -b .ifdef
%patch5 -p1 -b .program_name
%patch6 -p1 -b .stripcr
%patch7 -p1 -b .parse
%patch8 -p1 -b .allow-spaces
%patch9 -p1 -b .selinux
%patch10 -p1 -b .posix-backup
%build %build
CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"
@ -54,6 +38,9 @@ make CPPFLAGS=""
make %{?smp_mflags} make %{?smp_mflags}
%endif %endif
%check
make check
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%makeinstall %makeinstall
@ -68,6 +55,10 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/*/* %{_mandir}/*/*
%changelog %changelog
* Mon Nov 16 2009 Tim Waugh <twaugh@redhat.com> 2.6-1
- 2.6. No longer need stderr, suffix, stripcr, parse, allow-spaces,
ifdef, program_name, or posix-backup patches.
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.4-40 * Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.4-40
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

View File

@ -1 +1,2 @@
ee5ae84d115f051d87fcaaef3b4ae782 patch-2.5.4.tar.gz ee5ae84d115f051d87fcaaef3b4ae782 patch-2.5.4.tar.gz
d9d62cb7b98a8a17e42dab910fd2adc9 patch-2.6.tar.xz

57
upstream-key.gpg Normal file
View File

@ -0,0 +1,57 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux)
mQGiBErnFxkRBADiiaYtqw46j2/Dwvw/pUdHeK1T3kqJGxxyWb1xNtQMOTaViNRB
fmc19omxdOylPBfGwMN3Aavw2HCdC5F8JeVTXIO9hyM79zf15qNrrfku9IwG7Lmu
iKxSLgSDPwMyL9rT+lpaxvpU4m5nRfCwaIN38K+mpqfKLp/5mptaDsvoewCg6IuK
sQemv/fsfolVGW/zzL+7eBMD/0XO/I957FEuwX+1wCMtLMFj0tdJq2AdOAkh/T9X
zC7aoPSwA97zlSFoKYS4J9W0SdIgyY5FqLwfvbo43qr03AdaLCKDu8lmTnfDp/jp
C7kBQWTFSdhkVjtncJQW91MseJ5bjXuZJCZFN3Qo0onP4d1dr4KdPe+nAxUeHEjp
NgOYBACV7w+/Eu5dY6OydEl9kanKyiUGhV17YUWX5RRyNqlsSEFDrVgym1eGZ1Z8
xrcXWO2za5sRCe5jkik7v0IUxaAA2B0BWLOM4TEJgLcOyztgzDIrXYLQO1xdCUDz
TN+cXKAlz6xrAQrD4OQGv18xyVxyoBts+oVpnFOM4CONnnBLnrQkQW5kcmVhcyBH
cnVlbmJhY2hlciA8YWdAYmVzdGJpdHMuYXQ+iEYEEBECAAYFAkrnG3kACgkQGfdM
MnwSO19wEwCfQTrsTruGEgl7toByUQNCEhGoPCUAoLAVDVwg6HHyACOw26Paqb8/
rRzriGYEExECACYFAkrnG0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