openpkg/rpm.patch.bugfix

Fri, 09 Jan 2009 01:40:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 09 Jan 2009 01:40:36 +0100
changeset 54
f012bbb2a542
child 333
4ecfc2416fd8
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

michael@13 1 ##
michael@13 2 ## rpm.patch.bugfix -- Annotated OpenPKG RPM Patch file
michael@13 3 ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@13 4 ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
michael@13 5 ##
michael@13 6 ## This file assembles changes to existing RPM source files between
michael@13 7 ## the original RedHat RPM and the OpenPKG RPM variant. It can be
michael@13 8 ## automatically applied to a vanilla RedHat RPM source tree with the
michael@13 9 ## 'patch' tool to upgrade those files. Each patch snippet is annotated
michael@13 10 ## with a short description.
michael@13 11 ##
michael@13 12 ## Created on: 13-Sep-2006
michael@13 13 ##
michael@13 14 ## ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
michael@13 15 ## RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
michael@13 16 ##
michael@13 17
michael@13 18 +---------------------------------------------------------------------------
michael@13 19 | %setup and %patch macros are treated very special internally, but
michael@13 20 | make sure they at least optically can be used like any other macro
michael@13 21 | and especially can have leading whitespaces.
michael@13 22 +---------------------------------------------------------------------------
michael@13 23 Index: build/parsePrep.c
michael@13 24 --- build/parsePrep.c 7 Aug 2002 14:20:45 -0000 1.1.1.10
michael@13 25 +++ build/parsePrep.c 6 Jun 2005 15:53:04 -0000 1.4
michael@13 26 @@ -584,12 +635,15 @@
michael@13 27 saveLines = splitString(getStringBuf(sb), strlen(getStringBuf(sb)), '\n');
michael@13 28 /*@-usereleased@*/
michael@13 29 for (lines = saveLines; *lines; lines++) {
michael@13 30 + char *cp;
michael@13 31 + for (cp = *lines; *cp == ' ' || *cp == '\t'; cp++)
michael@13 32 + ;
michael@13 33 res = 0;
michael@13 34 /*@-boundsread@*/
michael@13 35 - if (! strncmp(*lines, "%setup", sizeof("%setup")-1)) {
michael@13 36 - res = doSetupMacro(spec, *lines);
michael@13 37 - } else if (! strncmp(*lines, "%patch", sizeof("%patch")-1)) {
michael@13 38 - res = doPatchMacro(spec, *lines);
michael@13 39 + if (! strncmp(cp, "%setup", sizeof("%setup")-1)) {
michael@13 40 + res = doSetupMacro(spec, cp);
michael@13 41 + } else if (! strncmp(cp, "%patch", sizeof("%patch")-1)) {
michael@13 42 + res = doPatchMacro(spec, cp);
michael@13 43 } else {
michael@13 44 appendLineStringBuf(spec->prep, *lines);
michael@13 45 }
michael@13 46
michael@13 47 +---------------------------------------------------------------------------
michael@13 48 | Do not pick of the vendor BeeCrypt package on RedHat Linux.
michael@13 49 +---------------------------------------------------------------------------
michael@13 50 Index: configure.ac
michael@13 51 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
michael@13 52 +++ configure.ac 13 Sep 2006 13:38:23 -0000
michael@13 53 @@ -416,7 +417,7 @@
michael@13 54 AC_CHECK_HEADER([beecrypt/beecrypt.h], [
michael@13 55 AC_CHECK_LIB(beecrypt, mpfprintln, [
michael@13 56 AC_DEFINE(HAVE_LIBBEECRYPT, 1, [Define to 1 if you have the `beecrypt' library (-lbeecrypt).])
michael@13 57 - WITH_BEECRYPT_INCLUDE="-I/usr/include/beecrypt"
michael@13 58 + WITH_BEECRYPT_INCLUDE=""
michael@13 59 WITH_BEECRYPT_LIB="-lbeecrypt"
michael@13 60 ])
michael@13 61 ], [
michael@13 62
michael@13 63 +---------------------------------------------------------------------------
michael@13 64 | Remove access to not-existing beecrypt/ subdirectory
michael@13 65 | to avoid the configure script to break building.
michael@13 66 +---------------------------------------------------------------------------
michael@13 67 Index: configure.ac
michael@13 68 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
michael@13 69 +++ configure.ac 13 Sep 2006 13:38:26 -0000
michael@13 70 @@ -1274,7 +1305,6 @@
michael@13 71 python/rpmdb/Makefile
michael@13 72 python/test/Makefile
michael@13 73 ], [ echo timestamp > popt/stamp-h.in
michael@13 74 - echo timestamp > beecrypt/stamp-h.in
michael@13 75 echo timestamp > stamp-h.in
michael@13 76 ]
michael@13 77 )
michael@13 78
michael@13 79 +---------------------------------------------------------------------------
michael@13 80 | Fix filedescriptor leakage.
michael@13 81 +---------------------------------------------------------------------------
michael@13 82 Index: lib/psm.c
michael@13 83 --- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
michael@13 84 +++ lib/psm.c 13 Sep 2006 13:38:27 -0000
michael@13 85 @@ -940,6 +960,8 @@
michael@13 86 if (sfdno > STDERR_FILENO) {
michael@13 87 xx = Fclose (scriptFd);
michael@13 88 }
michael@13 89 + } else {
michael@13 90 + xx = Fclose(out);
michael@13 91 }
michael@13 92
michael@13 93 { const char *ipath = rpmExpand("PATH=%{_install_script_path}", NULL);
michael@13 94
michael@13 95 +---------------------------------------------------------------------------
michael@13 96 | Fix trigger argument passing. For more details see RPM BugDB under:
michael@13 97 | http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=100509
michael@13 98 +---------------------------------------------------------------------------
michael@13 99 Index: lib/psm.c
michael@13 100 --- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
michael@13 101 +++ lib/psm.c 13 Sep 2006 13:38:29 -0000
michael@13 102 @@ -1106,11 +1128,13 @@
michael@13 103 const char ** triggerProgs;
michael@13 104 int_32 * triggerIndices;
michael@13 105 const char * sourceName;
michael@13 106 + const char * triggerName;
michael@13 107 rpmRC rc = RPMRC_OK;
michael@13 108 int xx;
michael@13 109 int i;
michael@13 110
michael@13 111 xx = headerNVR(sourceH, &sourceName, NULL, NULL);
michael@13 112 + xx = headerNVR(triggeredH, &triggerName, NULL, NULL);
michael@13 113
michael@13 114 trigger = rpmdsInit(rpmdsNew(triggeredH, RPMTAG_TRIGGERNAME, scareMem));
michael@13 115 if (trigger == NULL)
michael@13 116 @@ -1149,7 +1173,7 @@
michael@13 117 { int arg1;
michael@13 118 int index;
michael@13 119
michael@13 120 - arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), Name);
michael@13 121 + arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), triggerName);
michael@13 122 if (arg1 < 0) {
michael@13 123 /* XXX W2DO? fails as "execution of script failed" */
michael@13 124 rc = RPMRC_FAIL;
michael@13 125
michael@13 126 +---------------------------------------------------------------------------
michael@13 127 | Make sure RPM does not try to set file owner/group on files during
michael@13 128 | installation of _source_ RPMs. Instead, let it use the current
michael@13 129 | run-time owner/group, because most of the time the owner/group in
michael@13 130 | the source RPM (which is the owner/group of the files as staying on
michael@13 131 | the package author system) is not existing on the target system, of
michael@13 132 | course.
michael@13 133 +---------------------------------------------------------------------------
michael@13 134 Index: lib/psm.c
michael@13 135 --- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
michael@13 136 +++ lib/psm.c 13 Sep 2006 13:38:32 -0000
michael@13 137 @@ -1710,6 +1734,7 @@
michael@13 138
michael@13 139 uid = fi->uid;
michael@13 140 gid = fi->gid;
michael@13 141 + if (!headerIsEntry(fi->h, RPMTAG_SOURCEPACKAGE)) {
michael@13 142 if (fi->fuser && unameToUid(fi->fuser[i], &uid)) {
michael@13 143 rpmMessage(RPMMESS_WARNING,
michael@13 144 _("user %s does not exist - using root\n"),
michael@13 145 @@ -1727,6 +1752,7 @@
michael@13 146 /* XXX this diddles header memory. */
michael@13 147 fi->fmodes[i] &= ~S_ISGID; /* turn off the sgid bit */
michael@13 148 }
michael@13 149 + }
michael@13 150 if (fi->fuids) fi->fuids[i] = uid;
michael@13 151 if (fi->fgids) fi->fgids[i] = gid;
michael@13 152 }
michael@13 153
michael@13 154 +---------------------------------------------------------------------------
michael@13 155 | Fix --justdb operation by consistently use the same rootDir checks
michael@13 156 | RPM uses everywhere else, too.
michael@13 157 +---------------------------------------------------------------------------
michael@13 158 Index: lib/psm.c
michael@13 159 --- lib/psm.c 5 Jun 2003 12:43:18 -0000 1.1.1.6
michael@13 160 +++ lib/psm.c 13 Sep 2006 13:38:33 -0000
michael@13 161 @@ -2027,7 +2053,8 @@
michael@13 162 case PSM_CHROOT_IN:
michael@13 163 { const char * rootDir = rpmtsRootDir(ts);
michael@13 164 /* Change root directory if requested and not already done. */
michael@13 165 - if (rootDir != NULL && !rpmtsChrootDone(ts) && !psm->chrootDone) {
michael@13 166 + if (rootDir != NULL && !(rootDir[0] == '/' && rootDir[1] == '\0')
michael@13 167 + && !rpmtsChrootDone(ts) && !psm->chrootDone) {
michael@13 168 static int _loaded = 0;
michael@13 169
michael@13 170 /*
michael@13 171
michael@13 172 +---------------------------------------------------------------------------
michael@13 173 | First, remove incorrectly introduced buffer assignment. Second, fix
michael@13 174 | second and subsequent "%{foo -x}" constructs for non-Linux systems
michael@13 175 | (without resetting the option index only the first construct would
michael@13 176 | work). Third, bugfix the handling of macros inside macro arguments
michael@13 177 | as in "%{foo bar%{quux}baz}": RPM correctly determined the pointer
michael@13 178 | to the terminating second closing brace, but instead of passing
michael@13 179 | this pointer to the subroutine which handles the macro argument
michael@13 180 | construction, it passed the underlying character. This in turn
michael@13 181 | obviously leaded to an incorrect determination of the argument end
michael@13 182 | (it then though the first closing brace is the end). We fix this by
michael@13 183 | passing the pointer and not the underlying character.
michael@13 184 +---------------------------------------------------------------------------
michael@13 185 Index: rpmio/macro.c
michael@13 186 --- rpmio/macro.c 15 May 2003 13:42:01 -0000 1.1.1.7
michael@13 187 +++ rpmio/macro.c 22 Jan 2004 21:42:32 -0000 1.2
michael@13 188 @@ -879,7 +882,7 @@
michael@13 189 */
michael@13 190 /*@-bounds@*/
michael@13 191 /*@dependent@*/ static const char *
michael@13 192 -grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char lastc)
michael@13 193 +grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char *lastc)
michael@13 194 /*@globals rpmGlobalMacroContext @*/
michael@13 195 /*@modifies mb, rpmGlobalMacroContext @*/
michael@13 196 {
michael@13 197 @@ -900,7 +903,7 @@
michael@13 198
michael@13 199 /* Copy args into buf until lastc */
michael@13 200 *be++ = ' ';
michael@13 201 - while ((c = *se++) != '\0' && c != lastc) {
michael@13 202 + while ((c = *se++) != '\0' && (se-1) != lastc) {
michael@13 203 /*@-globs@*/
michael@13 204 if (!isblank(c)) {
michael@13 205 *be++ = c;
michael@13 206 @@ -968,6 +971,8 @@
michael@13 207 /*@-mods@*/
michael@13 208 optind = 0; /* XXX but posix != glibc */
michael@13 209 /*@=mods@*/
michael@13 210 +#else
michael@13 211 + optind = 1;
michael@13 212 #endif
michael@13 213
michael@13 214 opts = me->opts;
michael@13 215 @@ -1168,7 +1175,7 @@
michael@13 216 int c;
michael@13 217 int rc = 0;
michael@13 218 int negate;
michael@13 219 - char grab;
michael@13 220 + char *grab;
michael@13 221 int chkexist;
michael@13 222
michael@13 223 if (++mb->depth > max_macro_depth) {
michael@13 224 @@ -1202,7 +1209,7 @@
michael@13 225 if (mb->depth > 1) /* XXX full expansion for outermost level */
michael@13 226 t = mb->t; /* save expansion pointer for printExpand */
michael@13 227 negate = 0;
michael@13 228 - grab = '\0';
michael@13 229 + grab = NULL;
michael@13 230 chkexist = 0;
michael@13 231 switch ((c = *s)) {
michael@13 232 default: /* %name substitution */
michael@13 233 @@ -1237,7 +1244,8 @@
michael@13 234 /* For "%name " macros ... */
michael@13 235 /*@-globs@*/
michael@13 236 if ((c = *fe) && isblank(c))
michael@13 237 - grab = '\n';
michael@13 238 + if ((grab = strchr(fe,'\n')) == NULL)
michael@13 239 + grab = strchr(fe, '\0');
michael@13 240 /*@=globs@*/
michael@13 241 /*@switchbreak@*/ break;
michael@13 242 case '(': /* %(...) shell escape */
michael@13 243 @@ -1284,7 +1292,7 @@
michael@13 244 ge = se - 1;
michael@13 245 /*@innerbreak@*/ break;
michael@13 246 case ' ':
michael@13 247 - grab = se[-1];
michael@13 248 + grab = se-1;
michael@13 249 /*@innerbreak@*/ break;
michael@13 250 default:
michael@13 251 /*@innerbreak@*/ break;
michael@13 252 @@ -1438,7 +1446,7 @@
michael@13 253
michael@13 254 /* Setup args for "%name " macros with opts */
michael@13 255 if (me && me->opts != NULL) {
michael@13 256 - if (grab != '\0') {
michael@13 257 + if (grab != NULL) {
michael@13 258 se = grabArgs(mb, me, fe, grab);
michael@13 259 } else {
michael@13 260 addMacro(mb->mc, "**", NULL, "", mb->depth);
michael@13 261
michael@13 262 +---------------------------------------------------------------------------
michael@13 263 | Backported RPM vendor patch:
michael@13 264 | "fix: packages w/o file colors segfault"
michael@13 265 | (cvs diff -r2.41.2.6 -r2.41.2.7 lib/rpmfi.c)
michael@13 266 +---------------------------------------------------------------------------
michael@13 267 Index: lib/rpmfi.c
michael@13 268 --- lib/rpmfi.c 17 Jul 2003 22:44:28 -0000 1.1.1.3
michael@13 269 +++ lib/rpmfi.c 22 Jan 2004 21:42:24 -0000 1.2
michael@13 270 @@ -866,6 +866,7 @@
michael@13 271 *fn = '\0';
michael@13 272 fnlen = stpcpy( stpcpy(fn, dirNames[dirIndexes[i]]), baseNames[i]) - fn;
michael@13 273
michael@13 274 +if (fColors != NULL)
michael@13 275 dColors[dirIndexes[i]] |= fColors[i];
michael@13 276 /*
michael@13 277 * See if this file path needs relocating.
michael@13 278
michael@13 279 +---------------------------------------------------------------------------
michael@13 280 | The "%_excludedocs" macro is intended to set the _default_ if
michael@13 281 | both --excludedocs and --includedocs are not specified and it is
michael@13 282 | evaluated already before. So, do not override it here again, because
michael@13 283 | it would not allow us to make "%_excludedocs 1" the default.
michael@13 284 +---------------------------------------------------------------------------
michael@13 285 Index: lib/transaction.c
michael@13 286 --- lib/transaction.c 15 Jul 2003 15:15:47 -0000 1.1.1.15
michael@13 287 +++ lib/transaction.c 22 Jan 2004 21:42:26 -0000 1.2
michael@13 288 @@ -702,8 +702,10 @@
michael@13 289 int dc;
michael@13 290 int i, j;
michael@13 291
michael@13 292 +#if 0
michael@13 293 if (!noDocs)
michael@13 294 noDocs = rpmExpandNumeric("%{_excludedocs}");
michael@13 295 +#endif
michael@13 296
michael@13 297 { const char *tmpPath = rpmExpand("%{_netsharedpath}", NULL);
michael@13 298 /*@-branchstate@*/
michael@13 299
michael@13 300 +---------------------------------------------------------------------------
michael@13 301 | Bugfix: POSIX/SUSv3 clearly expresses that fcntl(2) returns "value
michael@13 302 | other than -1" on success, so check for equality to -1 instead of
michael@13 303 | non-equality to 0. In practice this does not harm on most platforms,
michael@13 304 | because they fortunately (by conincidence and common practice)
michael@13 305 | return 0.
michael@13 306 | Additionally, at least Solaris may reject (see fcntl(2) manpage) the
michael@13 307 | (partial) locking, because DB mmap(2)'ed the file (or vice versa).
michael@13 308 | The workaround is to lock the entire(!) file.
michael@13 309 +---------------------------------------------------------------------------
michael@13 310 Index: db/mutex/mut_fcntl.c
michael@13 311 --- db/mutex/mut_fcntl.c 18 Jan 2003 14:05:03 -0000 1.1.1.5
michael@13 312 +++ db/mutex/mut_fcntl.c 22 Jan 2004 21:42:18 -0000 1.2
michael@13 313 @@ -84,8 +84,13 @@
michael@13 314
michael@13 315 /* Initialize the lock. */
michael@13 316 k_lock.l_whence = SEEK_SET;
michael@13 317 +#if 0
michael@13 318 k_lock.l_start = mutexp->off;
michael@13 319 k_lock.l_len = 1;
michael@13 320 +#else
michael@13 321 + k_lock.l_start = 0;
michael@13 322 + k_lock.l_len = 0;
michael@13 323 +#endif
michael@13 324
michael@13 325 for (locked = waited = 0;;) {
michael@13 326 /*
michael@13 327 @@ -101,7 +106,7 @@
michael@13 328
michael@13 329 /* Acquire an exclusive kernel lock. */
michael@13 330 k_lock.l_type = F_WRLCK;
michael@13 331 - if (fcntl(dbenv->lockfhp->fd, F_SETLKW, &k_lock))
michael@13 332 + if (fcntl(dbenv->lockfhp->fd, F_SETLKW, &k_lock) == -1)
michael@13 333 return (__os_get_errno());
michael@13 334
michael@13 335 /* If the resource is still available, it's ours. */
michael@13 336 @@ -112,7 +117,7 @@
michael@13 337
michael@13 338 /* Release the kernel lock. */
michael@13 339 k_lock.l_type = F_UNLCK;
michael@13 340 - if (fcntl(dbenv->lockfhp->fd, F_SETLK, &k_lock))
michael@13 341 + if (fcntl(dbenv->lockfhp->fd, F_SETLK, &k_lock) == -1)
michael@13 342 return (__os_get_errno());
michael@13 343
michael@13 344 /*
michael@13 345
michael@13 346 +---------------------------------------------------------------------------
michael@13 347 | The O_DIRECT feature is fully broken under at least Linux 2.2 and
michael@13 348 | 2.4. It is sometimes accepted by open(2) without error and later
michael@13 349 | causes a write(2) to fail with EINVAL -- all depending on the
michael@13 350 | underlying filesystem (usually works on tmpfs and fails on ext3).
michael@13 351 | Sometimes it also causes open(2) to fail with EINVAL. In general,
michael@13 352 | it does especially no "graceful degradation" and so is useless for
michael@13 353 | use mostly all platforms except for those where we know it works
michael@13 354 | (currently FreeBSD only). Interestingly, RPM works on RedHat, just
michael@13 355 | because RedHat's "kernel" package contains a patch which masks out
michael@13 356 | O_DIRECT usage... ;-)
michael@13 357 +---------------------------------------------------------------------------
michael@13 358 Index: db/os/os_open.c
michael@13 359 --- db/os/os_open.c 18 Jan 2003 14:05:03 -0000 1.1.1.5
michael@13 360 +++ db/os/os_open.c 22 Jan 2004 21:42:19 -0000 1.2
michael@13 361 @@ -93,7 +93,7 @@
michael@13 362 if (LF_ISSET(DB_OSO_TRUNC))
michael@13 363 oflags |= O_TRUNC;
michael@13 364
michael@13 365 -#ifdef HAVE_O_DIRECT
michael@13 366 +#if defined(HAVE_O_DIRECT) && defined(__FreeBSD__)
michael@13 367 if (LF_ISSET(DB_OSO_DIRECT))
michael@13 368 oflags |= O_DIRECT;
michael@13 369 #endif

mercurial