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