rpm.patch.bugfix 13 KB

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