Fri, 09 Jan 2009 01:40:36 +0100
Import package vendor original specs for necessary manipulations.
1 ##
2 ## rpm.patch.porting -- 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 ##
18 +---------------------------------------------------------------------------
19 | Evil hack to get GNU libtool working under NetBSD 1.6
20 | with the ugly way RPM currently has to use it.
21 +---------------------------------------------------------------------------
22 Index: ltconfig
23 --- ltconfig 17 Jan 2001 16:22:58 -0000 1.1.1.7
24 +++ ltconfig 29 Apr 2004 13:07:28 -0000 1.4
25 @@ -2017,6 +2017,7 @@
26 dynamic_linker='NetBSD ld.elf_so'
27 fi
28 shlibpath_var=LD_LIBRARY_PATH
29 + deplibs_check_method=pass_all
30 ;;
32 openbsd*)
34 +---------------------------------------------------------------------------
35 | Disable special RedHat NPTL handling.
36 +---------------------------------------------------------------------------
37 Index: configure.ac
38 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
39 +++ configure.ac 13 Sep 2006 13:40:20 -0000
40 @@ -150,10 +151,10 @@
41 dnl XXX Test for libpthread.a that is NPTL aware (static link only).
42 dnl
43 LDFLAGS_NPTL=
44 -if test -f /usr/lib/nptl/libpthread.a ; then
45 - LDFLAGS_NPTL="-L/usr/lib/nptl"
46 -# INCPATH="$INCPATH -I/usr/include/nptl"
47 -fi
48 +dnl if test -f /usr/lib/nptl/libpthread.a ; then
49 +dnl LDFLAGS_NPTL="-L/usr/lib/nptl"
50 +dnl # INCPATH="$INCPATH -I/usr/include/nptl"
51 +dnl fi
52 AC_SUBST(LDFLAGS_NPTL)
54 dnl
56 +---------------------------------------------------------------------------
57 | Disable any POSIX Pthread stuff because in OpenPKG we use
58 | non-Pthread mutexes in Berkeley-DB.
59 +---------------------------------------------------------------------------
60 Index: configure.ac
61 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
62 +++ configure.ac 13 Sep 2006 13:40:21 -0000
63 @@ -446,14 +447,17 @@
64 AC_CHECK_LIB(socket, socket)
65 ])
67 -AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
68 +dnl # required for HP-UX because of RPC stuff in DB
69 +AC_CHECK_LIB(nsl, svc_run)
71 -AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
72 - dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
73 - AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
74 - AC_CHECK_LIB(thread, mutex_lock)
75 - ])
76 -])
77 +dnl AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
78 +dnl
79 +dnl AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
80 +dnl dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
81 +dnl AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
82 +dnl AC_CHECK_LIB(thread, mutex_lock)
83 +dnl ])
84 +dnl ])
86 AC_CHECK_HEADERS(aio.h)
87 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
89 +---------------------------------------------------------------------------
90 | Add support for BSD getmntinfo(3).
91 +---------------------------------------------------------------------------
92 Index: configure.ac
93 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
94 +++ configure.ac 13 Sep 2006 13:40:23 -0000
95 @@ -963,12 +967,13 @@
96 AC_CHECK_FUNCS(getpassphrase)
98 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
99 + AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have the getmntinfo() function]), [
100 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
101 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
102 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
103 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
104 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
105 - AC_LIBOBJ(getmntent)])])])])
106 + AC_LIBOBJ(getmntent)])])])])])
108 AC_CHECK_FUNC(lchown,
109 [__CHOWN_RHF="%{__chown} -Rhf"
111 +---------------------------------------------------------------------------
112 | Remove RPM's "lib64" hack because we do not install
113 | into any system locations at all.
114 +---------------------------------------------------------------------------
115 Index: configure.ac
116 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
117 +++ configure.ac 13 Sep 2006 13:40:25 -0000
118 @@ -1141,9 +1146,6 @@
120 dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
121 MARK64=
122 -case "${target_cpu}" in
123 -x86_64*|ppc64*|powerpc64*|sparc64*|s390x*) MARK64=64 ;;
124 -esac
125 AC_SUBST(MARK64)
127 dnl Determine the canonical arch-vendor-os for the build machine
129 +---------------------------------------------------------------------------
130 | Provide fallback definitions for uintX_t stuff, which is used by
131 | build/rpmfile.h and not available on all platforms. We do this by
132 | adding the same Autoconf checks file/configure already used for its
133 | original file.h.
134 | Additionally, do not try to configure in an internal
135 | beecrypt subdirectory.
136 +---------------------------------------------------------------------------
137 Index: configure.ac
138 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
139 +++ configure.ac 13 Sep 2006 13:40:29 -0000
140 @@ -1249,11 +1251,40 @@
142 AC_SUBST(OBJDUMP)
144 +dnl OpenPKG: rpmfile.h (used in RPM) from file(1) needs additional checks
145 +dnl for its use of uintXX_t (which are available in file/config.h, but which
146 +dnl we cannot include into RPM because of conflicts with RPM's config.h)
147 +AC_DEFUN([AC_CHECK_TYPE_STDC],
148 +[AC_REQUIRE([AC_HEADER_STDC])dnl
149 +AC_MSG_CHECKING(for $1)
150 +AC_CACHE_VAL(ac_cv_type_$1,
151 +[AC_EGREP_CPP(dnl
152 +[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
153 +[#if HAVE_STDINT_H
154 +#include <stdint.h>
155 +#endif
156 +#include <sys/types.h>
157 +#if STDC_HEADERS
158 +#include <stdlib.h>
159 +#include <stddef.h>
160 +#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
161 +AC_MSG_RESULT($ac_cv_type_$1)
162 +if test $ac_cv_type_$1 = no; then
163 + AC_DEFINE($1, $2, $1)
164 +fi])
165 +AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
166 +AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
167 +AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
168 +
169 +dnl OpenPKG: some strange platforms (like Unixware) really have MADV_XXX
170 +dnl but no madvise(2) function itself, so check for madvise explicitly.
171 +AC_CHECK_FUNC(madvise)
172 +
173 dnl XXX this causes popt to depend on zlib et al
174 dnl # XXX Propagate -lucb to popt ...
175 dnl export LIBS INCPATH CONFIG_SITE
177 -AC_CONFIG_SUBDIRS(popt beecrypt zlib elfutils file db3)
178 +AC_CONFIG_SUBDIRS(popt zlib elfutils file db3)
180 AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec
181 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
183 +---------------------------------------------------------------------------
184 | Remove RPM's "lib64" hack because we do not install
185 | into any system locations at all.
186 +---------------------------------------------------------------------------
187 Index: popt/configure.ac
188 --- popt/configure.ac 27 Mar 2003 17:23:18 -0000 1.1.1.3
189 +++ popt/configure.ac 12 May 2004 14:34:35 -0000 1.2
190 @@ -53,9 +53,6 @@
192 dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
193 MARK64=
194 -case "${target_cpu}" in
195 -x86_64*|powerpc64*|ppc64*|sparc64*|s390x*) MARK64=64 ;;
196 -esac
197 AC_SUBST(MARK64)
199 AC_CHECK_HEADERS(alloca.h float.h libintl.h mcheck.h unistd.h)
201 +---------------------------------------------------------------------------
202 | Prevent (at least NetBSD's) gcc 2.95 from optimizing (at least sha1.c)
203 | and this way run into a resource (virtual memory) exhaustion situation.
204 | Not all Bourne-Shells support embedded TAB characters in
205 | here-document style constructs. Insert the TAB character indirectly
206 | to workaround problems.
207 | Additionally, there is no need to build a shared library version of
208 | Berkeley-DB.
209 | Finally, enforce the use of the standard UNIX/fcntl mutex type for
210 | full portability and to get rid of Pthread library dependencies
211 | (which especially are nasty for the external RPM API users).
212 +---------------------------------------------------------------------------
213 Index: db3/configure
214 --- db3/configure 18 Jan 2003 14:04:22 -0000 1.1.1.4
215 +++ db3/configure 6 Jun 2005 15:53:05 -0000 1.3
216 @@ -7,19 +7,29 @@
217 # XXX edit CFLAGS= ... out of invocation args ???
218 ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's%--cache-file=.*$%%'`"
220 +# prevent gcc 2.95 from optimizing (at least sha1.c)
221 +# and this way get into a resource exhaustion situation
222 +if [ ".`($CC -v; $CC --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
223 + case "`$CC -dumpversion 2>/dev/null`" in
224 + 3.* ) ;;
225 + * ) CFLAGS=`echo " $CFLAGS -O0" | sed -e 's; -O[0-9]* ; ;g' -e 's;^ *;;'` ;;
226 + esac
227 +fi
228 +
229 CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \
230 - --enable-shared --enable-static --enable-rpc \
231 - --with-uniquename=_rpmdb --srcdir=$db_dist
232 + --disable-shared --enable-static --enable-rpc \
233 + --with-uniquename=_rpmdb --srcdir=$db_dist \
234 + --with-mutex="UNIX/fcntl" --disable-largefile
236 mv Makefile Makefile.orig
237 cat Makefile.orig | sed -e '/^install[:-]/c\
238 .PHONY: listobjs\
239 listobjs:\
240 - @echo $(OBJS) $(C_OBJS) \
241 +~@echo $(OBJS) $(C_OBJS) \
242 \
243 distdir install check:\
244 \
245 -db4_install: all install_setip' > Makefile
246 +db4_install: all install_setip' | tr '~' ' ' > Makefile
248 mv db.h db.h.orig
249 cat db.h.orig | sed \
251 +---------------------------------------------------------------------------
252 | Add support for BSD getmntinfo(3).
253 +---------------------------------------------------------------------------
254 Index: lib/fs.c
255 --- lib/fs.c 4 Jun 2003 18:09:43 -0000 1.1.1.13
256 +++ lib/fs.c 25 Nov 2004 09:32:16 -0000 1.3
257 @@ -164,6 +164,15 @@
258 int nextMount = 0;
260 getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
261 +# elif HAVE_GETMNTINFO
262 +# if defined(__NetBSD__) && (__NetBSD_Version__ > 200030000)
263 +# define statfs statvfs
264 +# endif
265 + struct statfs * mounts = NULL;
266 + int mntCount, flags = MNT_NOWAIT;
267 + int nextMount = 0;
268 +
269 + mntCount = getmntinfo(&mounts, flags);
270 # endif
272 filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems)); /* XXX memory leak */
273 @@ -193,6 +202,9 @@
274 # elif HAVE_GETMNTINFO_R
275 if (nextMount == mntCount) break;
276 mntdir = mounts[nextMount++].f_mntonname;
277 +# elif HAVE_GETMNTINFO
278 + if (nextMount == mntCount) break;
279 + mntdir = mounts[nextMount++].f_mntonname;
280 # endif
282 if (stat(mntdir, &sb)) {
284 +---------------------------------------------------------------------------
285 | Add support for Compaq/HP OSF1/Tru64.
286 +---------------------------------------------------------------------------
287 Index: misc/fnmatch.h
288 --- misc/fnmatch.h 22 Feb 2002 17:12:15 -0000 1.1.1.3
289 +++ misc/fnmatch.h 22 Jan 2004 21:42:26 -0000 1.2
290 @@ -55,7 +55,7 @@
291 #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
292 #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
294 -#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
295 +#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE || defined __osf__
296 # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
297 # define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
298 # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
300 +---------------------------------------------------------------------------
301 | Use more correct Autoconf based size_t check.
302 | Add support for Compaq/HP OSF1/Tru64 and SCO UnixWare.
303 +---------------------------------------------------------------------------
304 Index: misc/glob.h
305 --- misc/glob.h 11 Mar 2000 20:59:30 -0000 1.1.1.3
306 +++ misc/glob.h 22 Jan 2004 21:42:27 -0000 1.2
307 @@ -46,7 +46,7 @@
308 #endif /* C++ or ANSI C. */
310 /* We need `size_t' for the following definitions. */
311 -#ifndef __size_t
312 +#if !defined(__size_t) && !defined(_SIZE_T_DECLARED)
313 # if defined __GNUC__ && __GNUC__ >= 2
314 typedef __SIZE_TYPE__ __size_t;
315 # ifdef _XOPEN_SOURCE
316 @@ -74,7 +74,7 @@
317 #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
319 #if (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _BSD_SOURCE \
320 - || defined _GNU_SOURCE)
321 + || defined _GNU_SOURCE || defined __osf__ )
322 # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
323 # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
324 # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
325 @@ -151,7 +151,8 @@
326 `glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
327 If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
328 Otherwise, `glob' returns zero. */
329 -#if _FILE_OFFSET_BITS != 64
330 +/* #if _FILE_OFFSET_BITS != 64 || defined(OPENPKG_UNIXWARE) */
331 +#if !defined(__linux__)
332 extern int glob __P ((__const char *__pattern, int __flags,
333 int (*__errfunc) (__const char *, int),
334 glob_t *__pglob));
336 +---------------------------------------------------------------------------
337 | Better portability.
338 +---------------------------------------------------------------------------
339 Index: misc/glob.c
340 --- misc/glob.c 11 Mar 2000 21:13:18 -0000 1.1.1.4
341 +++ misc/glob.c 22 Jan 2004 21:42:26 -0000 1.2
342 @@ -813,6 +813,7 @@
345 /* Free storage allocated in PGLOB by a previous `glob' call. */
346 +#if !defined(__linux__) || (defined(__linux__) && (_FILE_OFFSET_BITS != 64) || (__GNUC__ >= 2))
347 void
348 globfree (pglob)
349 register glob_t *pglob;
350 @@ -826,7 +827,7 @@
351 free ((__ptr_t) pglob->gl_pathv);
352 }
353 }
354 -
355 +#endif
357 /* Do a collated comparison of A and B. */
358 static int
360 +---------------------------------------------------------------------------
361 | Add libmisc.a for platform portability.
362 +---------------------------------------------------------------------------
363 Index: tools/Makefile.am
364 --- tools/Makefile.am 29 May 2003 17:40:17 -0000 1.1.1.14
365 +++ tools/Makefile.am 22 Jan 2004 21:42:34 -0000 1.2
366 @@ -22,7 +22,7 @@
368 LDADD = \
369 $(top_builddir)/lib/librpm.la \
370 - @INTLLIBS@
371 + @INTLLIBS@ @LIBMISC@
373 staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
376 +---------------------------------------------------------------------------
377 | Add libmisc.a for platform portability.
378 +---------------------------------------------------------------------------
379 Index: tools/Makefile.in
380 --- tools/Makefile.in 16 Jul 2003 17:05:51 -0000 1.1.1.20
381 +++ tools/Makefile.in 22 Jan 2004 21:42:35 -0000 1.2
382 @@ -275,7 +275,7 @@
384 LDADD = \
385 $(top_builddir)/lib/librpm.la \
386 - @INTLLIBS@
387 + @INTLLIBS@ @LIBMISC@
390 staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
392 +---------------------------------------------------------------------------
393 | Drop GCC "inline" attribute if not compiling with GCC.
394 | Workaround some other GCC'isms, too.
395 | Do not take over "const" replacements from Zlib.
396 +---------------------------------------------------------------------------
397 Index: file/system.h
398 --- file/system.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
399 +++ file/system.h 6 Jun 2005 15:53:05 -0000 1.4
400 @@ -13,6 +13,9 @@
401 #endif
403 #include <sys/types.h>
404 +#ifdef HAVE_INTTYPES_H
405 +#include <inttypes.h>
406 +#endif
408 #include <sys/stat.h>
409 #include <stdio.h>
410 @@ -53,6 +56,8 @@
411 #else
412 #if HAVE_ERROR && HAVE_ERROR_H
413 #include <error.h>
414 +#else
415 +extern void error(int status, int errnum, const char *format, ...);
416 #endif
417 #endif
419 @@ -194,6 +199,7 @@
421 #ifdef HAVE_LIBZ
422 #include <zlib.h>
423 +#undef const
424 #endif
426 #ifndef HAVE_STRERROR
427 @@ -246,7 +252,11 @@
428 */
429 /*@-shadow@*/
430 /*@unused@*/ /*@exits@*/ /*@only@*/
431 +#if defined(__GNUC__)
432 static inline void * vmefail(/*@unused@*/ size_t nb)
433 +#else
434 +static void * vmefail(/*@unused@*/ size_t nb)
435 +#endif
436 /*@globals fileSystem @*/
437 /*@modifies fileSystem @*/
438 {
439 @@ -286,9 +296,33 @@
441 #if !defined(__LCLINT__)
442 /* Memory allocation via macro defs to get meaningful locations from mtrace() */
443 +#if defined(__GNUC__)
444 #define xmalloc(_size) (malloc(_size) ? : vmefail(0))
445 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(0))
446 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(0))
447 +#else
448 +static void *xmalloc(size_t size)
449 +{
450 + void *vp = malloc(size);
451 + if (vp == NULL)
452 + vmefail(0);
453 + return vp;
454 +}
455 +static void *xcalloc(size_t number, size_t size)
456 +{
457 + void *vp = calloc(number, size);
458 + if (vp == NULL)
459 + vmefail(0);
460 + return vp;
461 +}
462 +static void *xrealloc(void *ptr, size_t size)
463 +{
464 + void *vp = realloc(ptr, size);
465 + if (vp == NULL)
466 + vmefail(0);
467 + return vp;
468 +}
469 +#endif
470 #define xstrdup(_str) (strcpy(xmalloc(strlen(_str)+1), (_str)))
471 #endif
473 @@ -314,9 +348,14 @@
475 #if defined(__LCLINT__)
476 #define FILE_RCSID(id)
477 -#else
478 +#elif defined(__GNUC__)
479 #define FILE_RCSID(id) \
480 static inline const char *rcsid(const char *p) { \
481 + return rcsid(p = id); \
482 +}
483 +#else
484 +#define FILE_RCSID(id) \
485 +static const char *rcsid(const char *p) { \
486 return rcsid(p = id); \
487 }
488 #endif
490 +---------------------------------------------------------------------------
491 | Use GCC extensional features only if compiled with GCC.
492 +---------------------------------------------------------------------------
493 Index: file/file.h
494 --- file/file.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
495 +++ file/file.h 22 Jan 2004 21:42:22 -0000 1.2
496 @@ -95,7 +95,11 @@
497 } value; /* either number or string */
498 uint32_t mask; /* mask before comparison with value */
499 char desc[MAXDESC]; /* description */
500 +#if defined(__GNUC__)
501 } __attribute__((__packed__));
502 +#else
503 +};
504 +#endif
506 #define BIT(A) (1 << (A))
507 #define STRING_IGNORE_LOWERCASE BIT(0)
509 +---------------------------------------------------------------------------
510 | Add int32_t detection and automatic fallback support.
511 +---------------------------------------------------------------------------
512 Index: file/config.h.in
513 --- file/config.h.in 7 Mar 2003 19:39:18 -0000 1.1.1.1
514 +++ file/config.h.in 13 Sep 2006 13:40:49 -0000
515 @@ -106,6 +106,9 @@
516 /* Define to 1 if you have the <unistd.h> header file. */
517 #undef HAVE_UNISTD_H
519 +/* Define to 1 if you have the `vsnprintf' function. */
520 +#undef HAVE_VSNPRINTF
521 +
522 /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
523 */
524 #undef MAJOR_IN_MKDEV
525 @@ -162,12 +165,16 @@
526 /* Define to empty if `const' does not conform to ANSI C. */
527 #undef const
529 +/* int32_t */
530 +#undef int32_t
531 +
532 /* Define to `long' if <sys/types.h> does not define. */
533 #undef off_t
535 /* Define to `unsigned' if <sys/types.h> does not define. */
536 #undef size_t
538 +#ifndef HAVE_STDINT_H
539 /* uint16_t */
540 #undef uint16_t
542 @@ -179,3 +186,4 @@
544 /* uint8_t */
545 #undef uint8_t
546 +#endif
548 +---------------------------------------------------------------------------
549 | Add int32_t detection and automatic fallback support.
550 +---------------------------------------------------------------------------
551 Index: file/configure.ac
552 --- file/configure.ac 1 Dec 2002 21:34:06 -0000 1.1.1.1
553 +++ file/configure.ac 6 Jun 2005 15:53:05 -0000 1.2
554 @@ -92,6 +92,7 @@
555 AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
556 AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
557 AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
558 +AC_CHECK_TYPE_STDC(int32_t, int)
559 AC_C_LONG_LONG
560 if test $ac_cv_c_long_long = yes; then
561 long64='unsigned long long';
562 @@ -107,7 +108,7 @@
563 AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
565 dnl Checks for functions
566 -AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul)
567 +AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul vsnprintf)
569 dnl Checks for libraries
570 AC_CHECK_LIB(z, gzopen)
572 +---------------------------------------------------------------------------
573 | Add int32_t detection and automatic fallback support.
574 +---------------------------------------------------------------------------
575 Index: file/configure
576 --- file/configure 16 Jul 2003 17:05:25 -0000 1.1.1.2
577 +++ file/configure 6 Jun 2005 15:53:05 -0000 1.2
578 @@ -10847,6 +10847,46 @@
580 fi
582 +echo "$as_me:$LINENO: checking for int32_t" >&5
583 +echo $ECHO_N "checking for int32_t... $ECHO_C" >&6
584 +if test "${ac_cv_type_int32_t+set}" = set; then
585 + echo $ECHO_N "(cached) $ECHO_C" >&6
586 +else
587 + cat >conftest.$ac_ext <<_ACEOF
588 +#line $LINENO "configure"
589 +/* confdefs.h. */
590 +_ACEOF
591 +cat confdefs.h >>conftest.$ac_ext
592 +cat >>conftest.$ac_ext <<_ACEOF
593 +/* end confdefs.h. */
594 +#if HAVE_STDINT_H
595 +#include <stdint.h>
596 +#endif
597 +#include <sys/types.h>
598 +#if STDC_HEADERS
599 +#include <stdlib.h>
600 +#include <stddef.h>
601 +#endif
602 +_ACEOF
603 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
604 + $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
605 + ac_cv_type_int32_t=yes
606 +else
607 + ac_cv_type_int32_t=no
608 +fi
609 +rm -f conftest*
610 +
611 +fi
612 +echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
613 +echo "${ECHO_T}$ac_cv_type_int32_t" >&6
614 +if test $ac_cv_type_int32_t = no; then
615 +
616 +cat >>confdefs.h <<\_ACEOF
617 +#define int32_t int
618 +_ACEOF
619 +
620 +fi
621 +
622 echo "$as_me:$LINENO: checking for long long" >&5
623 echo $ECHO_N "checking for long long... $ECHO_C" >&6
624 if test "${ac_cv_c_long_long+set}" = set; then
625 @@ -11220,7 +11260,8 @@
629 -for ac_func in error mtrace mkstemp mmap strdup strerror strtoul
630 +
631 +for ac_func in error mtrace mkstemp mmap strdup strerror strtoul vsnprintf
632 do
633 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
634 echo "$as_me:$LINENO: checking for $ac_func" >&5
636 +---------------------------------------------------------------------------
637 | Fallback to vsprintf(3) if vsnprintf(3) does not exist.
638 +---------------------------------------------------------------------------
639 Index: file/print.c
640 --- file/print.c 24 Jan 2003 19:41:56 -0000 1.1.1.1
641 +++ file/print.c 6 Jun 2005 15:53:05 -0000 1.2
642 @@ -187,7 +187,11 @@
644 va_start(va, f);
645 /*@-boundswrite@*/
646 +#ifdef HAVE_VSNPRINTF
647 rc = vsnprintf(fm->obp, fm->nob, f, va);
648 +#else
649 + rc = vsprintf(fm->obp, f, va);
650 +#endif
651 /*@=boundswrite@*/
652 va_end(va);
655 +---------------------------------------------------------------------------
656 | Use GNU libtool's weaker -static (link with own static libraries)
657 | instead of the strong -all-static (link even with static libc, etc),
658 | because OpenPKG does not need to be fully static.
659 +---------------------------------------------------------------------------
660 Index: rpmdb/Makefile.am
661 --- rpmdb/Makefile.am 2 Jul 2003 20:14:07 -0000 1.1.1.7
662 +++ rpmdb/Makefile.am 22 Jan 2004 21:42:29 -0000 1.2
663 @@ -18,7 +18,7 @@
664 EXTRA_PROGRAMS = tjfn
666 tjfn_SOURCES = tjfn.c
667 -tjfn_LDFLAGS = -all-static
668 +tjfn_LDFLAGS = -static
669 tjfn_LDADD = librpmdb.la
671 pkgincdir = $(pkgincludedir)
672 @@ -180,4 +180,4 @@
673 $(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
675 tdbi: librpmdb.la tdbi.o
676 - $(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
677 + $(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
679 +---------------------------------------------------------------------------
680 | Use GNU libtool's weaker -static (link with own static libraries)
681 | instead of the strong -all-static (link even with static libc, etc),
682 | because OpenPKG does not need to be fully static.
683 +---------------------------------------------------------------------------
684 Index: rpmdb/Makefile.in
685 --- rpmdb/Makefile.in 16 Jul 2003 17:05:48 -0000 1.1.1.7
686 +++ rpmdb/Makefile.in 22 Jan 2004 21:42:29 -0000 1.2
687 @@ -273,7 +273,7 @@
688 EXTRA_PROGRAMS = tjfn
690 tjfn_SOURCES = tjfn.c
691 -tjfn_LDFLAGS = -all-static
692 +tjfn_LDFLAGS = -static
693 tjfn_LDADD = librpmdb.la
695 pkgincdir = $(pkgincludedir)
696 @@ -952,7 +952,7 @@
697 $(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
699 tdbi: librpmdb.la tdbi.o
700 - $(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
701 + $(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
702 # Tell versions [3.59,3.63) of GNU make to not export all variables.
703 # Otherwise a system limit (for SysV at least) may be exceeded.
704 .NOEXPORT:
706 +---------------------------------------------------------------------------
707 | Use GNU libtool's weaker -static (link with own static libraries)
708 | instead of the strong -all-static (link even with static libc, etc),
709 | because OpenPKG does not need to be fully static.
710 +---------------------------------------------------------------------------
711 Index: rpmio/Makefile.am
712 --- rpmio/Makefile.am 5 Jun 2003 12:05:23 -0000 1.1.1.9
713 +++ rpmio/Makefile.am 22 Jan 2004 21:42:31 -0000 1.2
714 @@ -68,27 +68,27 @@
715 tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
717 tdir_SOURCES = tdir.c
718 -tdir_LDFLAGS = -all-static
719 +tdir_LDFLAGS = -static
720 tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
722 tfts_SOURCES = tfts.c
723 -tfts_LDFLAGS = -all-static
724 +tfts_LDFLAGS = -static
725 tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
727 tglob_SOURCES = tglob.c
728 -tglob_LDFLAGS = -all-static
729 +tglob_LDFLAGS = -static
730 tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
732 tinv_SOURCES = tinv.c
733 -tinv_LDFLAGS = -all-static
734 +tinv_LDFLAGS = -static
735 tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
737 tkey_SOURCES = tkey.c
738 -tkey_LDFLAGS = -all-static
739 +tkey_LDFLAGS = -static
740 tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
742 tring_SOURCES = tring.c
743 -tring_LDFLAGS = -all-static
744 +tring_LDFLAGS = -static
745 tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
747 trpmio_SOURCES = trpmio.c
749 +---------------------------------------------------------------------------
750 | Use GNU libtool's weaker -static (link with own static libraries)
751 | instead of the strong -all-static (link even with static libc, etc),
752 | because OpenPKG does not need to be fully static.
753 | Additionally, remove hard-coded Linux'ism of linking against POSIX
754 | rt/pthread libraries (is not needed even under Linux itself) and
755 | make sure the build does not break by an empty argument list when
756 | iterating over (the not existing) BeeCrypt objects.
757 +---------------------------------------------------------------------------
758 Index: rpmio/Makefile.in
759 --- rpmio/Makefile.in 16 Jul 2003 17:05:49 -0000 1.1.1.9
760 +++ rpmio/Makefile.in 22 Jan 2004 21:42:31 -0000 1.2
761 @@ -288,8 +288,7 @@
762 librpmio_la_LDFLAGS = -release 4.2 \
763 @WITH_BEECRYPT_LIB@ \
764 $(top_builddir)/file/libfmagic.la \
765 - @WITH_ZLIB_LIB@ \
766 - -lrt -lpthread
767 + @WITH_ZLIB_LIB@
769 librpmio_la_LIBADD = $(BEECRYPTLOBJS)
770 librpmio_la_DEPENDENCIES = .created
771 @@ -298,27 +297,27 @@
772 tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
774 tdir_SOURCES = tdir.c
775 -tdir_LDFLAGS = -all-static
776 +tdir_LDFLAGS = -static
777 tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
779 tfts_SOURCES = tfts.c
780 -tfts_LDFLAGS = -all-static
781 +tfts_LDFLAGS = -static
782 tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
784 tglob_SOURCES = tglob.c
785 -tglob_LDFLAGS = -all-static
786 +tglob_LDFLAGS = -static
787 tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
789 tinv_SOURCES = tinv.c
790 -tinv_LDFLAGS = -all-static
791 +tinv_LDFLAGS = -static
792 tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
794 tkey_SOURCES = tkey.c
795 -tkey_LDFLAGS = -all-static
796 +tkey_LDFLAGS = -static
797 tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
799 tring_SOURCES = tring.c
800 -tring_LDFLAGS = -all-static
801 +tring_LDFLAGS = -static
802 tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
804 trpmio_SOURCES = trpmio.c
805 @@ -743,8 +742,8 @@
806 .created:
807 if test X"@WITH_BEECRYPT_SUBDIR@" != X; then \
808 ${MAKE} -C $(top_builddir)/@WITH_BEECRYPT_SUBDIR@ listobjs ; \
809 - for lo in $(BEECRYPTLOBJS); do \
810 - [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
811 + for lo in $(BEECRYPTLOBJS) ''; do \
812 + [ ".$$lo" = . ] || [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
813 done \
814 fi
815 touch $@
817 +---------------------------------------------------------------------------
818 | Add Unixware support.
819 +---------------------------------------------------------------------------
820 Index: rpmio/fts.h
821 --- rpmio/fts.h 18 Jan 2003 16:13:17 -0000 1.1.1.3
822 +++ rpmio/fts.h 22 Jan 2004 21:42:32 -0000 1.2
823 @@ -51,7 +51,7 @@
824 # define _LARGEFILE64_SOURCE
825 #endif
827 -#if defined(sun)
828 +#if defined(sun) || defined(OPENPKG_UNIXWARE)
829 # define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
830 #endif
833 +---------------------------------------------------------------------------
834 | Add FreeBSD/NetBSD/OpenBSD support.
835 | Workaround some GCC'isms.
836 +---------------------------------------------------------------------------
837 Index: rpmio/fts.c
838 --- rpmio/fts.c 18 Jan 2003 16:13:17 -0000 1.1.1.3
839 +++ rpmio/fts.c 8 Jun 2005 13:16:25 -0000 1.5
840 @@ -34,6 +34,8 @@
841 static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
842 #endif /* LIBC_SCCS and not lint */
844 +#include <limits.h>
845 +
846 #if defined(_LIBC)
847 #include <sys/param.h>
848 #include <include/sys/stat.h>
849 @@ -45,20 +47,49 @@
850 #include <string.h>
851 #include <unistd.h>
852 #else
853 -#if defined(hpux)
854 +#if defined(OPENPKG_HPUX)
855 # define _INCLUDE_POSIX_SOURCE
856 # define __errno_location() (&errno)
857 # define dirfd(dirp) -1
858 # define stat64 stat
859 # define _STAT_VER 0
860 # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
861 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
862 #endif
863 -#if defined(sun)
864 +#if defined(sun) || defined(OPENPKG_UNIXWARE)
865 # define __errno_location() (&errno)
866 # define dirfd(dirp) -1
867 # define _STAT_VER 0
868 # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
869 #endif
870 +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
871 +# define __errno_location() (&errno)
872 +# define stat64 stat
873 +# define _STAT_VER 0
874 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
875 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
876 +#endif
877 +#if defined(__osf__)
878 +# define __errno_location() (&errno)
879 +# define dirfd(dirp) -1
880 +# define stat64 stat
881 +# define _STAT_VER 0
882 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
883 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
884 +#endif
885 +#if defined(OPENPKG_IRIX64)
886 +# define __errno_location() (&errno)
887 +# define dirfd(dirp) -1
888 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
889 +# define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
890 +#endif
891 +#if defined(OPENPKG_AIX)
892 +# define __errno_location() (&errno)
893 +# define _STAT_VER 0
894 +# define dirfd(dirp) ((dirp)->dd_fd)
895 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
896 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
897 +#endif
898 #include "system.h"
899 #include "fts.h"
900 #include "rpmio.h"
901 @@ -73,7 +104,12 @@
902 /* Largest alignment size needed, minus one.
903 Usually long double is the worst case. */
904 #ifndef ALIGNBYTES
905 +#if defined(__GNUC__)
906 #define ALIGNBYTES (__alignof__ (long double) - 1)
907 +#else
908 +/* not accurate enough (usually too large), but sufficient (and this way equal safe) */
909 +#define ALIGNBYTES (sizeof (long double) - 1)
910 +#endif
911 #endif
912 /* Align P to that size. */
913 #ifndef ALIGN
914 @@ -107,9 +143,13 @@
915 /*@modifies fileSystem, internalState @*/;
917 #ifndef MAX
918 +#if defined(__GNUC__)
919 #define MAX(a, b) ({ __typeof__ (a) _a = (a); \
920 __typeof__ (b) _b = (b); \
921 _a > _b ? _a : _b; })
922 +#else
923 +#define MAX(a, b) ((a) > (b) ? (a) : (b))
924 +#endif
925 #endif
927 #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
929 +---------------------------------------------------------------------------
930 | Remove inclusion of system <glob.h> because RPM uses its own glob(3)
931 | implementation and this can conflict with the system one.
932 +---------------------------------------------------------------------------
933 Index: rpmio/rpmio.h
934 --- rpmio/rpmio.h 12 Jun 2003 18:22:18 -0000 1.1.1.7
935 +++ rpmio/rpmio.h 22 Jan 2004 21:42:33 -0000 1.2
936 @@ -9,9 +9,6 @@
937 #include <sys/types.h>
938 #include <sys/stat.h>
939 #include <dirent.h>
940 -/*@-noparams@*/
941 -#include <glob.h>
942 -/*@=noparams@*/
943 #include <stdio.h>
944 #include <stdlib.h>
945 #include <unistd.h>
947 +---------------------------------------------------------------------------
948 | Make this whole "dirent" fiddling at least working on
949 | FreeBSD/NetBSD/OpenBSD, Solaris, HPUX and Unixware. This certainly
950 | is a bad corner of RPM which inherently leads to portability
951 | problems.
952 +---------------------------------------------------------------------------
953 Index: rpmio/rpmrpc.c
954 --- rpmio/rpmrpc.c 29 May 2003 22:14:04 -0000 1.1.1.8
955 +++ rpmio/rpmrpc.c 8 Jun 2005 13:16:26 -0000 1.5
956 @@ -1079,6 +1079,8 @@
957 return rc;
958 }
960 +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_DARWIN)
961 +
962 struct __dirstream {
963 int fd; /* File descriptor. */
964 char * data; /* Directory block. */
965 @@ -1091,6 +1093,8 @@
966 #endif
967 };
969 +#endif
970 +
971 #if !defined(DT_DIR)
972 # define DT_UNKNOWN 0
973 # define DT_FIFO 1
974 @@ -1101,14 +1105,30 @@
975 # define DT_LNK 10
976 # define DT_SOCK 12
977 # define DT_WHT 14
978 -typedef struct __dirstream * FTPDIR;
979 -#else
980 -typedef DIR * FTPDIR;
981 #endif
983 +struct mydirstreament {
984 + unsigned char type;
985 + char *name;
986 +};
987 +struct mydirstream {
988 + DIR dir;
989 + struct dirent ent;
990 + unsigned int offset;
991 + unsigned int size;
992 + struct mydirstreament av[1];
993 +};
994 +typedef struct mydirstream *FTPDIR;
995 +
996 /*@unchecked@*/
997 static int ftpmagicdir = 0x8440291;
998 -#define ISFTPMAGIC(_dir) (!memcmp((_dir), &ftpmagicdir, sizeof(ftpmagicdir)))
999 +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_UNIXWARE) && !defined(OPENPKG_DARWIN) && !defined(__osf__) && !defined(OPENPKG_IRIX64) && !defined(OPENPKG_HPUX) && !defined(OPENPKG_AIX)
1000 +#define SETFTPMAGIC(_dir) ((_dir)->fd) = ftpmagicdir
1001 +#define ISFTPMAGIC(_dir) ((_dir)->fd == ftpmagicdir)
1002 +#else
1003 +#define SETFTPMAGIC(_dir) ((_dir)->dd_fd) = ftpmagicdir
1004 +#define ISFTPMAGIC(_dir) ((_dir)->dd_fd == ftpmagicdir)
1005 +#endif
1007 /*@-boundswrite@*/
1008 /*@-type@*/ /* FIX: abstract DIR */
1009 @@ -1121,8 +1141,7 @@
1010 struct dirent * dp;
1011 size_t nb;
1012 const char * s, * sb, * se;
1013 - const char ** av;
1014 - unsigned char * dt;
1015 + struct mydirstreament * av;
1016 char * t;
1017 int ac;
1018 int c;
1019 @@ -1165,28 +1184,22 @@
1020 }
1021 }
1023 - nb += sizeof(*mydir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
1024 + nb = sizeof(*mydir) + (ac * sizeof(*av)) + nb;
1025 mydir = xcalloc(1, nb);
1026 /*@-abstract@*/
1027 - dp = (struct dirent *) (mydir + 1);
1028 - av = (const char **) (dp + 1);
1029 - dt = (char *) (av + (ac + 1));
1030 - t = (char *) (dt + ac + 1);
1031 + dp = &mydir->ent;
1032 + av = &mydir->av[0];
1033 + t = (char *)&mydir->av[ac+1];
1034 /*@=abstract@*/
1036 - mydir->fd = ftpmagicdir;
1037 -/*@-usereleased@*/
1038 - mydir->data = (char *) dp;
1039 -/*@=usereleased@*/
1040 - mydir->allocation = nb;
1041 - mydir->size = ac;
1042 - mydir->offset = -1;
1043 - mydir->filepos = 0;
1044 + SETFTPMAGIC((DIR *)mydir);
1045 + mydir->size = ac;
1046 + mydir->offset = 0;
1048 ac = 0;
1049 /*@-dependenttrans -unrecog@*/
1050 - dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++;
1051 - dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++;
1052 + av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, "."); ++ac;
1053 + av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, ".."); ++ac;
1054 /*@=dependenttrans =unrecog@*/
1055 sb = NULL;
1056 s = se = ftpBuf;
1057 @@ -1198,34 +1211,34 @@
1058 /*@switchbreak@*/ break;
1059 case '\r':
1060 /*@-dependenttrans@*/
1061 - av[ac] = t;
1062 + av[ac].name = t;
1063 /*@=dependenttrans@*/
1064 if (sb == NULL) {
1065 /*@-unrecog@*/
1066 switch(*s) {
1067 case 'p':
1068 - dt[ac] = DT_FIFO;
1069 + av[ac].type = DT_FIFO;
1070 /*@innerbreak@*/ break;
1071 case 'c':
1072 - dt[ac] = DT_CHR;
1073 + av[ac].type = DT_CHR;
1074 /*@innerbreak@*/ break;
1075 case 'd':
1076 - dt[ac] = DT_DIR;
1077 + av[ac].type = DT_DIR;
1078 /*@innerbreak@*/ break;
1079 case 'b':
1080 - dt[ac] = DT_BLK;
1081 + av[ac].type = DT_BLK;
1082 /*@innerbreak@*/ break;
1083 case '-':
1084 - dt[ac] = DT_REG;
1085 + av[ac].type = DT_REG;
1086 /*@innerbreak@*/ break;
1087 case 'l':
1088 - dt[ac] = DT_LNK;
1089 + av[ac].type = DT_LNK;
1090 /*@innerbreak@*/ break;
1091 case 's':
1092 - dt[ac] = DT_SOCK;
1093 + av[ac].type = DT_SOCK;
1094 /*@innerbreak@*/ break;
1095 default:
1096 - dt[ac] = DT_UNKNOWN;
1097 + av[ac].type = DT_UNKNOWN;
1098 /*@innerbreak@*/ break;
1099 }
1100 /*@=unrecog@*/
1101 @@ -1243,7 +1256,7 @@
1102 /*@switchbreak@*/ break;
1103 }
1104 }
1105 - av[ac] = NULL;
1106 + av[ac].name = NULL;
1108 /*@-kepttrans@*/
1109 return (DIR *) mydir;
1110 @@ -1258,43 +1271,50 @@
1111 {
1112 FTPDIR mydir = (FTPDIR)dir;
1113 struct dirent * dp;
1114 - const char ** av;
1115 - unsigned char * dt;
1116 + struct mydirstreament * av;
1117 int ac;
1118 int i;
1120 /*@+voidabstract@*/
1121 - if (mydir == NULL || !ISFTPMAGIC(mydir) || mydir->data == NULL) {
1122 + if (dir == NULL || !ISFTPMAGIC(dir)) {
1123 /* XXX TODO: EBADF errno. */
1124 return NULL;
1125 }
1126 /*@=voidabstract@*/
1128 - dp = (struct dirent *) mydir->data;
1129 - av = (const char **) (dp + 1);
1130 + dp = &mydir->ent;
1131 + av = &mydir->av[0];
1132 ac = mydir->size;
1133 - dt = (char *) (av + (ac + 1));
1134 - i = mydir->offset + 1;
1135 + i = mydir->offset + 1;
1137 /*@-boundsread@*/
1138 - if (i < 0 || i >= ac || av[i] == NULL)
1139 + if (i < 0 || i >= ac || av[i].name == NULL)
1140 return NULL;
1141 /*@=boundsread@*/
1143 mydir->offset = i;
1145 +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
1146 + dp->d_ino = i + 1;
1147 + dp->d_reclen = 0;
1148 + dp->d_type = av[i].type;
1149 + strncpy(dp->d_name, av[i].name, sizeof(dp->d_name) - 1);
1150 + dp->d_name[sizeof(dp->d_name)-1] = '\0';
1151 + dp->d_namlen = strlen(dp->d_name);
1152 +#elif defined(OPENPKG_HPUX) || defined(sun) || defined(OPENPKG_UNIXWARE) || defined(__osf__) || defined(OPENPKG_IRIX64) || defined(OPENPKG_AIX)
1153 + /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
1154 + dp->d_ino = i + 1; /* W2DO? */
1155 + dp->d_reclen = 0; /* W2DO? */
1156 + strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
1157 +#else
1158 /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
1159 dp->d_ino = i + 1; /* W2DO? */
1160 dp->d_reclen = 0; /* W2DO? */
1161 -
1162 -#if !defined(hpux) && !defined(sun)
1163 dp->d_off = 0; /* W2DO? */
1164 -/*@-boundsread@*/
1165 - dp->d_type = dt[i];
1166 -/*@=boundsread@*/
1167 + dp->d_type = av[i].type;
1168 + strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
1169 #endif
1171 - strncpy(dp->d_name, av[i], sizeof(dp->d_name));
1172 /*@+voidabstract@*/
1173 if (_ftp_debug)
1174 fprintf(stderr, "*** ftpReaddir(%p) %p \"%s\"\n", (void *)mydir, dp, dp->d_name);
1175 @@ -1313,7 +1333,7 @@
1176 /*@+voidabstract@*/
1177 if (_ftp_debug)
1178 fprintf(stderr, "*** ftpClosedir(%p)\n", (void *)mydir);
1179 - if (mydir == NULL || !ISFTPMAGIC(mydir)) {
1180 + if (dir == NULL || !ISFTPMAGIC(dir)) {
1181 /* XXX TODO: EBADF errno. */
1182 return -1;
1183 }
1185 +---------------------------------------------------------------------------
1186 | Remove inclusion of ancient (and since years deprecated) <malloc.h>
1187 | header. This especially makes sure RPM build does not break on
1188 | strict platforms like FreeBSD 5.
1189 +---------------------------------------------------------------------------
1190 Index: system.h
1191 --- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
1192 +++ system.h 8 Jun 2005 13:15:16 -0000 1.4
1193 @@ -256,10 +256,6 @@
1194 #include <err.h>
1195 #endif
1197 -#if HAVE_MALLOC_H && !defined(__LCLINT__)
1198 -#include <malloc.h>
1199 -#endif
1200 -
1201 /*@-declundef -incondefs @*/ /* FIX: these are macros */
1202 /**
1203 */
1205 +---------------------------------------------------------------------------
1206 | Add support for BSD getmntinfo(3).
1207 +---------------------------------------------------------------------------
1208 Index: system.h
1209 --- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
1210 +++ system.h 8 Jun 2005 13:15:16 -0000 1.4
1211 @@ -550,7 +546,7 @@
1212 #define lchown chown
1213 #endif
1215 -#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
1216 +#if HAVE_GETMNTINFO_R || HAVE_GETMNTINFO || HAVE_MNTCTL
1217 # define GETMNTENT_ONE 0
1218 # define GETMNTENT_TWO 0
1219 # if HAVE_SYS_MNTCTL_H
1221 +---------------------------------------------------------------------------
1222 | Drop GCC "inline" attribute if not compiling with GCC.
1223 +---------------------------------------------------------------------------
1224 Index: system.h
1225 --- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
1226 +++ system.h 8 Jun 2005 13:15:16 -0000 1.4
1227 @@ -603,11 +599,24 @@
1229 #if defined(__LCLINT__)
1230 #define FILE_RCSID(id)
1231 -#else
1232 +#elif defined(__GNUC__)
1233 #define FILE_RCSID(id) \
1234 static inline const char *rcsid(const char *p) { \
1235 return rcsid(p = id); \
1236 }
1237 +#else
1238 +#define FILE_RCSID(id) \
1239 +static const char *rcsid(const char *p) { \
1240 + return rcsid(p = id); \
1241 +}
1242 +#endif
1243 +
1244 +/* for basename(3) and dirname(3) */
1245 +#if !defined(OPENPKG_AIX)
1246 +#include <libgen.h>
1247 +#endif
1248 +#if defined(OPENPKG_AIX)
1249 +#define unsetenv(x) /* unsetenv() is used in RPM just for malloc debugging purposes */
1250 #endif
1252 #endif /* H_SYSTEM */
1254 +---------------------------------------------------------------------------
1255 | Remove GCC'ism.
1256 +---------------------------------------------------------------------------
1257 Index: build/rpmfile.h
1258 --- build/rpmfile.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
1259 +++ build/rpmfile.h 22 Jan 2004 21:42:14 -0000 1.2
1260 @@ -95,7 +95,11 @@
1261 } value; /* either number or string */
1262 uint32_t mask; /* mask before comparison with value */
1263 char desc[MAXDESC]; /* description */
1264 +#if defined(__GNUC__)
1265 } __attribute__((__packed__));
1266 +#else
1267 +};
1268 +#endif
1270 #define BIT(A) (1 << (A))
1271 #define STRING_IGNORE_LOWERCASE BIT(0)
1273 +---------------------------------------------------------------------------
1274 | Better portability for madvise(2) usage.
1275 +---------------------------------------------------------------------------
1276 Index: rpmdb/legacy.c
1277 --- rpmdb/legacy.c 18 Dec 2002 22:40:19 -0000 1.1.1.4
1278 +++ rpmdb/legacy.c 22 Jan 2004 21:42:30 -0000 1.2
1279 @@ -182,7 +182,7 @@
1280 break;
1281 }
1283 -#ifdef MADV_SEQUENTIAL
1284 +#if defined(HAVE_MADVISE) && defined(MADV_SEQUENTIAL)
1285 xx = madvise(mapped, fsize, MADV_SEQUENTIAL);
1286 #endif
1289 +---------------------------------------------------------------------------
1290 | Better portability for madvise(2) usage.
1291 +---------------------------------------------------------------------------
1292 Index: lib/fsm.c
1293 --- lib/fsm.c 3 Mar 2003 21:28:12 -0000 1.1.1.5
1294 +++ lib/fsm.c 22 Jan 2004 21:42:23 -0000 1.2
1295 @@ -879,7 +879,7 @@
1296 rdbuf = fsm->rdbuf;
1297 fsm->rdbuf = (char *) mapped;
1298 fsm->rdlen = nmapped = st->st_size;
1299 -#if defined(MADV_DONTNEED)
1300 +#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
1301 xx = madvise(mapped, nmapped, MADV_DONTNEED);
1302 #endif
1303 }
1304 @@ -909,7 +909,7 @@
1305 #if HAVE_MMAP
1306 if (mapped != (void *)-1) {
1307 xx = msync(mapped, nmapped, MS_ASYNC);
1308 -#if defined(MADV_DONTNEED)
1309 +#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
1310 xx = madvise(mapped, nmapped, MADV_DONTNEED);
1311 #endif
1312 /*@-noeffect@*/ xx = munmap(mapped, nmapped) /*@=noeffect@*/;
1314 +---------------------------------------------------------------------------
1315 | Support UnixWare 7.1.3 and OpenDarwin 6.6.2, too.
1316 +---------------------------------------------------------------------------
1317 Index: aclocal.m4
1318 --- aclocal.m4 16 Jul 2003 17:05:28 -0000 1.1.1.10
1319 +++ aclocal.m4 6 Jun 2005 15:53:03 -0000 1.4
1320 @@ -2838,7 +2838,7 @@
1321 runpath_var=LD_RUN_PATH
1322 ;;
1324 - sysv5uw7* | unixware7*)
1325 + sysv5uw7* | unixware7* | sysv5UnixWare7* )
1326 no_undefined_flag='${wl}-z ${wl}text'
1327 if test "$GCC" = yes; then
1328 archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
1329 @@ -4311,6 +4311,7 @@
1330 ;;
1331 *) # Darwin 1.3 on
1332 lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
1333 + lt_cv_deplibs_check_method=pass_all
1334 ;;
1335 esac
1336 ;;
1337 @@ -4336,7 +4337,7 @@
1338 ;;
1340 hpux10.20*|hpux11*)
1341 - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
1342 + lt_cv_deplibs_check_method='pass_all'
1343 lt_cv_file_magic_cmd=/usr/bin/file
1344 lt_cv_file_magic_test_file=/usr/lib/libc.sl
1345 ;;
1346 @@ -4375,11 +4376,7 @@
1347 ;;
1349 netbsd*)
1350 - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
1351 - lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
1352 - else
1353 - lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
1354 - fi
1355 + lt_cv_deplibs_check_method='pass_all'
1356 ;;
1358 newos6*)
1359 @@ -4414,7 +4411,7 @@
1360 lt_cv_file_magic_test_file=/lib/libc.so
1361 ;;
1363 -sysv5uw[[78]]* | sysv4*uw2*)
1364 +sysv5uw[[78]]* | sysv4*uw2* | sysv5UnixWare7* )
1365 lt_cv_deplibs_check_method=pass_all
1366 ;;
1369 +---------------------------------------------------------------------------
1370 | Use Linux i386 assembly specific stuff on Linux only.
1371 +---------------------------------------------------------------------------
1372 Index: rpmio/rpmsw.c
1373 --- rpmio/rpmsw.c 5 Jun 2003 12:04:05 -0000 1.1.1.1
1374 +++ rpmio/rpmsw.c 22 Jan 2004 21:42:33 -0000 1.2
1375 @@ -27,7 +27,7 @@
1376 /*@unchecked@*/
1377 static int rpmsw_initialized = 0;
1379 -#if defined(__i386__)
1380 +#if defined(__linux__) && defined(__i386__)
1381 /* Swiped from glibc-2.3.2 sysdeps/i386/i686/hp-timing.h */
1383 #define HP_TIMING_ZERO(Var) (Var) = (0)
1385 +---------------------------------------------------------------------------
1386 | Fix "environ" declaration.
1387 +---------------------------------------------------------------------------
1388 Index: lib/signature.c
1389 --- lib/signature.c 29 May 2003 18:42:23 -0000 1.1.1.23
1390 +++ lib/signature.c 22 Jan 2004 21:42:25 -0000 1.2
1391 @@ -27,7 +27,7 @@
1392 /*@access pgpDigParams@*/
1394 #if !defined(__GLIBC__)
1395 -char ** environ = NULL;
1396 +extern char ** environ;
1397 #endif
1399 int rpmLookupSignatureType(int action)
1401 +---------------------------------------------------------------------------
1402 | Rename own mergesort(3) implementation to avoid conflicts
1403 | with a possibly existing vendor version.
1404 +---------------------------------------------------------------------------
1405 Index: rpmdb/merge.c
1406 --- rpmdb/merge.c 22 Jun 2002 18:51:58 -0000 1.1.1.2
1407 +++ rpmdb/merge.c 22 Jan 2004 21:42:30 -0000 1.2
1408 @@ -204,7 +204,7 @@
1409 * Arguments are as for qsort.
1410 */
1411 int
1412 -mergesort(void *base, size_t nmemb, size_t size,
1413 +rpmdb_mergesort(void *base, size_t nmemb, size_t size,
1414 int (*cmp) (const void *, const void *))
1415 {
1416 register int i, sense;
1418 +---------------------------------------------------------------------------
1419 | Rename own mergesort(3) implementation to avoid conflicts
1420 | with a possibly existing vendor version.
1421 +---------------------------------------------------------------------------
1422 Index: rpmdb/rpmdb.h
1423 --- rpmdb/rpmdb.h 18 Jan 2003 14:04:35 -0000 1.1.1.5
1424 +++ rpmdb/rpmdb.h 22 Jan 2004 21:42:31 -0000 1.2
1425 @@ -1080,7 +1080,7 @@
1426 * Mergesort, same arguments as qsort(2).
1427 */
1428 /*@unused@*/
1429 -int mergesort(void *base, size_t nmemb, size_t size,
1430 +int rpmdb_mergesort(void *base, size_t nmemb, size_t size,
1431 int (*cmp) (const void *, const void *))
1432 /*@globals errno @*/
1433 /*@modifies base, errno @*/;
1435 +---------------------------------------------------------------------------
1436 | Rename own mergesort(3) implementation to avoid conflicts
1437 | with a possibly existing vendor version.
1438 +---------------------------------------------------------------------------
1439 Index: rpmdb/rpmdb.c
1440 --- rpmdb/rpmdb.c 2 Jul 2003 19:21:54 -0000 1.1.1.6
1441 +++ rpmdb/rpmdb.c 22 Jan 2004 21:42:30 -0000 1.2
1442 @@ -2361,7 +2361,7 @@
1443 sizeof(*mi->mi_set->recs), hdrNumCmp);
1444 /*@=boundsread@*/
1445 #else
1446 - mergesort(mi->mi_set->recs, mi->mi_set->count,
1447 + rpmdb_mergesort(mi->mi_set->recs, mi->mi_set->count,
1448 sizeof(*mi->mi_set->recs), hdrNumCmp);
1449 #endif
1450 mi->mi_sorted = 1;
1452 +---------------------------------------------------------------------------
1453 | Workaround a double-inclusion problem under AIX.
1454 +---------------------------------------------------------------------------
1455 Index: lib/getdate.y
1456 --- lib/getdate.y 24 Sep 2001 21:53:15 -0000 1.1.1.2
1457 +++ lib/getdate.y 8 Jun 2005 13:16:22 -0000 1.2
1458 @@ -30,7 +30,9 @@
1459 #undef static
1460 #endif
1462 +#ifndef OPENPKG_AIX
1463 #include <stdio.h>
1464 +#endif
1465 #include <ctype.h>
1467 /* The code at the top of get_date which figures out the offset of the
1469 +---------------------------------------------------------------------------
1470 | Workaround a double-inclusion problem under AIX.
1471 +---------------------------------------------------------------------------
1472 Index: lib/getdate.c
1473 --- lib/getdate.c 2 Jul 2003 19:21:45 -0000 1.1.1.4
1474 +++ lib/getdate.c 8 Jun 2005 13:16:21 -0000 1.2
1475 @@ -50,7 +50,9 @@
1476 #undef static
1477 #endif
1479 +#ifndef OPENPKG_AIX
1480 #include <stdio.h>
1481 +#endif
1482 #include <ctype.h>
1484 /* The code at the top of get_date which figures out the offset of the
1486 +---------------------------------------------------------------------------
1487 | The following patch works around a general failure of RPM to
1488 | adhere to the ISO C standard, for which newer GCC releases claim
1489 | compile errors and fail.
1490 +---------------------------------------------------------------------------
1491 Index: misc/err.h
1492 --- misc/err.h 2009-01-06 22:48:16.104430941 +0100
1493 +++ misc/err.h 2009-01-06 22:47:55.944312482 +0100
1494 @@ -29,31 +29,4 @@
1495 # define __gnuc_va_list __ptr_t
1496 #endif
1498 -__BEGIN_DECLS
1499 -
1500 -/* Print "program: ", FORMAT, ": ", the standard error string for errno,
1501 - and a newline, on stderr. */
1502 -extern void warn __P ((__const char *__format, ...))
1503 - __attribute__ ((__format__ (__printf__, 1, 2)));
1504 -extern void vwarn __P ((__const char *__format, __gnuc_va_list))
1505 - __attribute__ ((__format__ (__printf__, 1, 0)));
1506 -
1507 -/* Likewise, but without ": " and the standard error string. */
1508 -extern void warnx __P ((__const char *__format, ...))
1509 - __attribute__ ((__format__ (__printf__, 1, 2)));
1510 -extern void vwarnx __P ((__const char *__format, __gnuc_va_list))
1511 - __attribute__ ((__format__ (__printf__, 1, 0)));
1512 -
1513 -/* Likewise, and then exit with STATUS. */
1514 -extern void err __P ((int __status, __const char *__format, ...))
1515 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
1516 -extern void verr __P ((int __status, __const char *__format, __gnuc_va_list))
1517 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
1518 -extern void errx __P ((int __status, __const char *__format, ...))
1519 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
1520 -extern void verrx __P ((int __status, __const char *, __gnuc_va_list))
1521 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
1522 -
1523 -__END_DECLS
1524 -
1525 #endif /* err.h */
1527 +---------------------------------------------------------------------------
1528 | Due to either GCC enforcing ISO C or faulty references in the
1529 | rpmio component, Solaris 11 fails to build while compiling fts.c.
1530 | Hack a custom 'dirent.h' as found in /usr/include, remove the
1531 | line 104 'extern int dirfd(DIR *);' from the header file, and
1532 | place in directory openpkg-`date +%Y%m%d`/rpm-<version>/rpmio/.
1533 +---------------------------------------------------------------------------