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