diff -r b363f8ef6dcb -r 9b4bbbae3a98 openpkg/rpm.patch.bugfix
--- a/openpkg/rpm.patch.bugfix Tue Jul 31 12:27:54 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,369 +0,0 @@
-##
-## rpm.patch.bugfix -- Annotated OpenPKG RPM Patch file
-## Copyright (c) 2000-2007 OpenPKG Foundation e.V.
-## Copyright (c) 2000-2007 Ralf S. Engelschall
-##
-## This file assembles changes to existing RPM source files between
-## the original RedHat RPM and the OpenPKG RPM variant. It can be
-## automatically applied to a vanilla RedHat RPM source tree with the
-## 'patch' tool to upgrade those files. Each patch snippet is annotated
-## with a short description.
-##
-## Created on: 13-Sep-2006
-##
-## ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
-## RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
-##
-
-+---------------------------------------------------------------------------
-| %setup and %patch macros are treated very special internally, but
-| make sure they at least optically can be used like any other macro
-| and especially can have leading whitespaces.
-+---------------------------------------------------------------------------
-Index: build/parsePrep.c
---- build/parsePrep.c 7 Aug 2002 14:20:45 -0000 1.1.1.10
-+++ build/parsePrep.c 6 Jun 2005 15:53:04 -0000 1.4
-@@ -584,12 +584,15 @@
- saveLines = splitString(getStringBuf(sb), strlen(getStringBuf(sb)), '\n');
- /*@-usereleased@*/
- for (lines = saveLines; *lines; lines++) {
-+ char *cp;
-+ for (cp = *lines; *cp == ' ' || *cp == '\t'; cp++)
-+ ;
- res = 0;
- /*@-boundsread@*/
-- if (! strncmp(*lines, "%setup", sizeof("%setup")-1)) {
-- res = doSetupMacro(spec, *lines);
-- } else if (! strncmp(*lines, "%patch", sizeof("%patch")-1)) {
-- res = doPatchMacro(spec, *lines);
-+ if (! strncmp(cp, "%setup", sizeof("%setup")-1)) {
-+ res = doSetupMacro(spec, cp);
-+ } else if (! strncmp(cp, "%patch", sizeof("%patch")-1)) {
-+ res = doPatchMacro(spec, cp);
- } else {
- appendLineStringBuf(spec->prep, *lines);
- }
-
-+---------------------------------------------------------------------------
-| Do not pick of the vendor BeeCrypt package on RedHat Linux.
-+---------------------------------------------------------------------------
-Index: configure.ac
---- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
-+++ configure.ac 13 Sep 2006 13:38:23 -0000
-@@ -416,7 +416,7 @@
- AC_CHECK_HEADER([beecrypt/beecrypt.h], [
- AC_CHECK_LIB(beecrypt, mpfprintln, [
- AC_DEFINE(HAVE_LIBBEECRYPT, 1, [Define to 1 if you have the `beecrypt' library (-lbeecrypt).])
-- WITH_BEECRYPT_INCLUDE="-I/usr/include/beecrypt"
-+ WITH_BEECRYPT_INCLUDE=""
- WITH_BEECRYPT_LIB="-lbeecrypt"
- ])
- ], [
-
-+---------------------------------------------------------------------------
-| Remove access to not-existing beecrypt/ subdirectory
-| to avoid the configure script to break building.
-+---------------------------------------------------------------------------
-Index: configure.ac
---- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
-+++ configure.ac 13 Sep 2006 13:38:26 -0000
-@@ -1274,7 +1274,6 @@
- python/rpmdb/Makefile
- python/test/Makefile
- ], [ echo timestamp > popt/stamp-h.in
-- echo timestamp > beecrypt/stamp-h.in
- echo timestamp > stamp-h.in
- ]
- )
-
-+---------------------------------------------------------------------------
-| Fix filedescriptor leakage.
-+---------------------------------------------------------------------------
-Index: lib/psm.c
---- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
-+++ lib/psm.c 13 Sep 2006 13:38:27 -0000
-@@ -940,6 +940,8 @@
- if (sfdno > STDERR_FILENO) {
- xx = Fclose (scriptFd);
- }
-+ } else {
-+ xx = Fclose(out);
- }
-
- { const char *ipath = rpmExpand("PATH=%{_install_script_path}", NULL);
-
-+---------------------------------------------------------------------------
-| Fix trigger argument passing. For more details see RPM BugDB under:
-| http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=100509
-+---------------------------------------------------------------------------
-Index: lib/psm.c
---- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
-+++ lib/psm.c 13 Sep 2006 13:38:29 -0000
-@@ -1108,11 +1108,13 @@
- const char ** triggerProgs;
- int_32 * triggerIndices;
- const char * sourceName;
-+ const char * triggerName;
- rpmRC rc = RPMRC_OK;
- int xx;
- int i;
-
- xx = headerNVR(sourceH, &sourceName, NULL, NULL);
-+ xx = headerNVR(triggeredH, &triggerName, NULL, NULL);
-
- trigger = rpmdsInit(rpmdsNew(triggeredH, RPMTAG_TRIGGERNAME, scareMem));
- if (trigger == NULL)
-@@ -1151,7 +1153,7 @@
- { int arg1;
- int index;
-
-- arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), Name);
-+ arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), triggerName);
- if (arg1 < 0) {
- /* XXX W2DO? fails as "execution of script failed" */
- rc = RPMRC_FAIL;
-
-+---------------------------------------------------------------------------
-| Make sure RPM does not try to set file owner/group on files during
-| installation of _source_ RPMs. Instead, let it use the current
-| run-time owner/group, because most of the time the owner/group in
-| the source RPM (which is the owner/group of the files as staying on
-| the package author system) is not existing on the target system, of
-| course.
-+---------------------------------------------------------------------------
-Index: lib/psm.c
---- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
-+++ lib/psm.c 13 Sep 2006 13:38:32 -0000
-@@ -1714,6 +1714,7 @@
-
- uid = fi->uid;
- gid = fi->gid;
-+ if (!headerIsEntry(fi->h, RPMTAG_SOURCEPACKAGE)) {
- if (fi->fuser && unameToUid(fi->fuser[i], &uid)) {
- rpmMessage(RPMMESS_WARNING,
- _("user %s does not exist - using root\n"),
-@@ -1731,6 +1732,7 @@
- /* XXX this diddles header memory. */
- fi->fmodes[i] &= ~S_ISGID; /* turn off the sgid bit */
- }
-+ }
- if (fi->fuids) fi->fuids[i] = uid;
- if (fi->fgids) fi->fgids[i] = gid;
- }
-
-+---------------------------------------------------------------------------
-| Fix --justdb operation by consistently use the same rootDir checks
-| RPM uses everywhere else, too.
-+---------------------------------------------------------------------------
-Index: lib/psm.c
---- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
-+++ lib/psm.c 13 Sep 2006 13:38:33 -0000
-@@ -2033,7 +2033,8 @@
- case PSM_CHROOT_IN:
- { const char * rootDir = rpmtsRootDir(ts);
- /* Change root directory if requested and not already done. */
-- if (rootDir != NULL && !rpmtsChrootDone(ts) && !psm->chrootDone) {
-+ if (rootDir != NULL && !(rootDir[0] == '/' && rootDir[1] == '\0')
-+ && !rpmtsChrootDone(ts) && !psm->chrootDone) {
- static int _loaded = 0;
-
- /*
-
-+---------------------------------------------------------------------------
-| First, remove incorrectly introduced buffer assignment. Second, fix
-| second and subsequent "%{foo -x}" constructs for non-Linux systems
-| (without resetting the option index only the first construct would
-| work). Third, bugfix the handling of macros inside macro arguments
-| as in "%{foo bar%{quux}baz}": RPM correctly determined the pointer
-| to the terminating second closing brace, but instead of passing
-| this pointer to the subroutine which handles the macro argument
-| construction, it passed the underlying character. This in turn
-| obviously leaded to an incorrect determination of the argument end
-| (it then though the first closing brace is the end). We fix this by
-| passing the pointer and not the underlying character.
-+---------------------------------------------------------------------------
-Index: rpmio/macro.c
---- rpmio/macro.c 15 May 2003 13:42:01 -0000 1.1.1.7
-+++ rpmio/macro.c 22 Jan 2004 21:42:32 -0000 1.2
-@@ -879,7 +879,7 @@
- */
- /*@-bounds@*/
- /*@dependent@*/ static const char *
--grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char lastc)
-+grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char *lastc)
- /*@globals rpmGlobalMacroContext @*/
- /*@modifies mb, rpmGlobalMacroContext @*/
- {
-@@ -900,7 +900,7 @@
-
- /* Copy args into buf until lastc */
- *be++ = ' ';
-- while ((c = *se++) != '\0' && c != lastc) {
-+ while ((c = *se++) != '\0' && (se-1) != lastc) {
- /*@-globs@*/
- if (!isblank(c)) {
- *be++ = c;
-@@ -968,6 +968,8 @@
- /*@-mods@*/
- optind = 0; /* XXX but posix != glibc */
- /*@=mods@*/
-+#else
-+ optind = 1;
- #endif
-
- opts = me->opts;
-@@ -1168,7 +1170,7 @@
- int c;
- int rc = 0;
- int negate;
-- char grab;
-+ char *grab;
- int chkexist;
-
- if (++mb->depth > max_macro_depth) {
-@@ -1202,7 +1204,7 @@
- if (mb->depth > 1) /* XXX full expansion for outermost level */
- t = mb->t; /* save expansion pointer for printExpand */
- negate = 0;
-- grab = '\0';
-+ grab = NULL;
- chkexist = 0;
- switch ((c = *s)) {
- default: /* %name substitution */
-@@ -1237,7 +1239,8 @@
- /* For "%name " macros ... */
- /*@-globs@*/
- if ((c = *fe) && isblank(c))
-- grab = '\n';
-+ if ((grab = strchr(fe,'\n')) == NULL)
-+ grab = strchr(fe, '\0');
- /*@=globs@*/
- /*@switchbreak@*/ break;
- case '(': /* %(...) shell escape */
-@@ -1284,7 +1287,7 @@
- ge = se - 1;
- /*@innerbreak@*/ break;
- case ' ':
-- grab = se[-1];
-+ grab = se-1;
- /*@innerbreak@*/ break;
- default:
- /*@innerbreak@*/ break;
-@@ -1438,7 +1441,7 @@
-
- /* Setup args for "%name " macros with opts */
- if (me && me->opts != NULL) {
-- if (grab != '\0') {
-+ if (grab != NULL) {
- se = grabArgs(mb, me, fe, grab);
- } else {
- addMacro(mb->mc, "**", NULL, "", mb->depth);
-
-+---------------------------------------------------------------------------
-| Backported RPM vendor patch:
-| "fix: packages w/o file colors segfault"
-| (cvs diff -r2.41.2.6 -r2.41.2.7 lib/rpmfi.c)
-+---------------------------------------------------------------------------
-Index: lib/rpmfi.c
---- lib/rpmfi.c 17 Jul 2003 22:44:28 -0000 1.1.1.3
-+++ lib/rpmfi.c 22 Jan 2004 21:42:24 -0000 1.2
-@@ -866,6 +866,7 @@
- *fn = '\0';
- fnlen = stpcpy( stpcpy(fn, dirNames[dirIndexes[i]]), baseNames[i]) - fn;
-
-+if (fColors != NULL)
- dColors[dirIndexes[i]] |= fColors[i];
- /*
- * See if this file path needs relocating.
-
-+---------------------------------------------------------------------------
-| The "%_excludedocs" macro is intended to set the _default_ if
-| both --excludedocs and --includedocs are not specified and it is
-| evaluated already before. So, do not override it here again, because
-| it would not allow us to make "%_excludedocs 1" the default.
-+---------------------------------------------------------------------------
-Index: lib/transaction.c
---- lib/transaction.c 15 Jul 2003 15:15:47 -0000 1.1.1.15
-+++ lib/transaction.c 22 Jan 2004 21:42:26 -0000 1.2
-@@ -702,8 +702,10 @@
- int dc;
- int i, j;
-
-+#if 0
- if (!noDocs)
- noDocs = rpmExpandNumeric("%{_excludedocs}");
-+#endif
-
- { const char *tmpPath = rpmExpand("%{_netsharedpath}", NULL);
- /*@-branchstate@*/
-
-+---------------------------------------------------------------------------
-| Bugfix: POSIX/SUSv3 clearly expresses that fcntl(2) returns "value
-| other than -1" on success, so check for equality to -1 instead of
-| non-equality to 0. In practice this does not harm on most platforms,
-| because they fortunately (by conincidence and common practice)
-| return 0.
-| Additionally, at least Solaris may reject (see fcntl(2) manpage) the
-| (partial) locking, because DB mmap(2)'ed the file (or vice versa).
-| The workaround is to lock the entire(!) file.
-+---------------------------------------------------------------------------
-Index: db/mutex/mut_fcntl.c
---- db/mutex/mut_fcntl.c 18 Jan 2003 14:05:03 -0000 1.1.1.5
-+++ db/mutex/mut_fcntl.c 22 Jan 2004 21:42:18 -0000 1.2
-@@ -84,8 +84,13 @@
-
- /* Initialize the lock. */
- k_lock.l_whence = SEEK_SET;
-+#if 0
- k_lock.l_start = mutexp->off;
- k_lock.l_len = 1;
-+#else
-+ k_lock.l_start = 0;
-+ k_lock.l_len = 0;
-+#endif
-
- for (locked = waited = 0;;) {
- /*
-@@ -101,7 +106,7 @@
-
- /* Acquire an exclusive kernel lock. */
- k_lock.l_type = F_WRLCK;
-- if (fcntl(dbenv->lockfhp->fd, F_SETLKW, &k_lock))
-+ if (fcntl(dbenv->lockfhp->fd, F_SETLKW, &k_lock) == -1)
- return (__os_get_errno());
-
- /* If the resource is still available, it's ours. */
-@@ -112,7 +117,7 @@
-
- /* Release the kernel lock. */
- k_lock.l_type = F_UNLCK;
-- if (fcntl(dbenv->lockfhp->fd, F_SETLK, &k_lock))
-+ if (fcntl(dbenv->lockfhp->fd, F_SETLK, &k_lock) == -1)
- return (__os_get_errno());
-
- /*
-
-+---------------------------------------------------------------------------
-| The O_DIRECT feature is fully broken under at least Linux 2.2 and
-| 2.4. It is sometimes accepted by open(2) without error and later
-| causes a write(2) to fail with EINVAL -- all depending on the
-| underlying filesystem (usually works on tmpfs and fails on ext3).
-| Sometimes it also causes open(2) to fail with EINVAL. In general,
-| it does especially no "graceful degradation" and so is useless for
-| use mostly all platforms except for those where we know it works
-| (currently FreeBSD only). Interestingly, RPM works on RedHat, just
-| because RedHat's "kernel" package contains a patch which masks out
-| O_DIRECT usage... ;-)
-+---------------------------------------------------------------------------
-Index: db/os/os_open.c
---- db/os/os_open.c 18 Jan 2003 14:05:03 -0000 1.1.1.5
-+++ db/os/os_open.c 22 Jan 2004 21:42:19 -0000 1.2
-@@ -93,7 +93,7 @@
- if (LF_ISSET(DB_OSO_TRUNC))
- oflags |= O_TRUNC;
-
--#ifdef HAVE_O_DIRECT
-+#if defined(HAVE_O_DIRECT) && defined(__FreeBSD__)
- if (LF_ISSET(DB_OSO_DIRECT))
- oflags |= O_DIRECT;
- #endif