Tue, 29 Mar 2011 19:46:35 +0200
Correct and introduce slightly needed logic, leading to better reliability:
Update bash(1) patch logic, correct several buildconf make location
errors, correct failed bash(1) configure invocation, enable perl(1) to
build with unpathed make(1), patch rpm(1) to correctly link with
internal libdb(3), and lastly unsuscessfully try to reorganize rpm patch
hunks.
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 @@ -151,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 @@ -447,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 @@ -964,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 @@ -1142,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 @@ -1250,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,52 @@
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 locdirfd(dirp) -1
859 # define stat64 stat
860 # define _STAT_VER 0
861 # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
862 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
863 #endif
864 -#if defined(sun)
865 +#if defined(sun) || defined(OPENPKG_UNIXWARE)
866 # define __errno_location() (&errno)
867 -# define dirfd(dirp) -1
868 +# define locdirfd(dirp) -1
869 # define _STAT_VER 0
870 # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
871 #endif
872 +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
873 +# define __errno_location() (&errno)
874 +# define stat64 stat
875 +# define _STAT_VER 0
876 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
877 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
878 +#endif
879 +#if defined(__osf__)
880 +# define __errno_location() (&errno)
881 +# define locdirfd(dirp) -1
882 +# define stat64 stat
883 +# define _STAT_VER 0
884 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
885 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
886 +#endif
887 +#if defined(OPENPKG_IRIX64)
888 +# define __errno_location() (&errno)
889 +# define locdirfd(dirp) -1
890 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
891 +# define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
892 +#endif
893 +#if defined(OPENPKG_AIX)
894 +# define __errno_location() (&errno)
895 +# define _STAT_VER 0
896 +# define locdirfd(dirp) ((dirp)->dd_fd)
897 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
898 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
899 +#endif
900 +#if !defined(locdirfd)
901 +# define locdirfd(dirp) dirfd(dirp)
902 +#endif
903 #include "system.h"
904 #include "fts.h"
905 #include "rpmio.h"
906 @@ -73,7 +107,12 @@
907 /* Largest alignment size needed, minus one.
908 Usually long double is the worst case. */
909 #ifndef ALIGNBYTES
910 +#if defined(__GNUC__)
911 #define ALIGNBYTES (__alignof__ (long double) - 1)
912 +#else
913 +/* not accurate enough (usually too large), but sufficient (and this way equal safe) */
914 +#define ALIGNBYTES (sizeof (long double) - 1)
915 +#endif
916 #endif
917 /* Align P to that size. */
918 #ifndef ALIGN
919 @@ -107,9 +146,13 @@
920 /*@modifies fileSystem, internalState @*/;
922 #ifndef MAX
923 +#if defined(__GNUC__)
924 #define MAX(a, b) ({ __typeof__ (a) _a = (a); \
925 __typeof__ (b) _b = (b); \
926 _a > _b ? _a : _b; })
927 +#else
928 +#define MAX(a, b) ((a) > (b) ? (a) : (b))
929 +#endif
930 #endif
932 #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
933 @@ -719,7 +762,7 @@
934 */
935 cderrno = 0;
936 if (nlinks || type == BREAD) {
937 - if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
938 + if (fts_safe_changedir(sp, cur, locdirfd(dirp), NULL)) {
939 if (nlinks && type == BREAD)
940 cur->fts_errno = errno;
941 cur->fts_flags |= FTS_DONTCHDIR;
943 +---------------------------------------------------------------------------
944 | Remove inclusion of system <glob.h> because RPM uses its own glob(3)
945 | implementation and this can conflict with the system one.
946 +---------------------------------------------------------------------------
947 Index: rpmio/rpmio.h
948 --- rpmio/rpmio.h 12 Jun 2003 18:22:18 -0000 1.1.1.7
949 +++ rpmio/rpmio.h 22 Jan 2004 21:42:33 -0000 1.2
950 @@ -9,9 +9,6 @@
951 #include <sys/types.h>
952 #include <sys/stat.h>
953 #include <dirent.h>
954 -/*@-noparams@*/
955 -#include <glob.h>
956 -/*@=noparams@*/
957 #include <stdio.h>
958 #include <stdlib.h>
959 #include <unistd.h>
961 +---------------------------------------------------------------------------
962 | Make this whole "dirent" fiddling at least working on
963 | FreeBSD/NetBSD/OpenBSD, Solaris, HPUX and Unixware. This certainly
964 | is a bad corner of RPM which inherently leads to portability
965 | problems.
966 +---------------------------------------------------------------------------
967 Index: rpmio/rpmrpc.c
968 --- rpmio/rpmrpc.c 29 May 2003 22:14:04 -0000 1.1.1.8
969 +++ rpmio/rpmrpc.c 8 Jun 2005 13:16:26 -0000 1.5
970 @@ -1079,6 +1079,8 @@
971 return rc;
972 }
974 +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_DARWIN)
975 +
976 struct __dirstream {
977 int fd; /* File descriptor. */
978 char * data; /* Directory block. */
979 @@ -1091,6 +1093,8 @@
980 #endif
981 };
983 +#endif
984 +
985 #if !defined(DT_DIR)
986 # define DT_UNKNOWN 0
987 # define DT_FIFO 1
988 @@ -1101,14 +1105,30 @@
989 # define DT_LNK 10
990 # define DT_SOCK 12
991 # define DT_WHT 14
992 -typedef struct __dirstream * FTPDIR;
993 -#else
994 -typedef DIR * FTPDIR;
995 #endif
997 +struct mydirstreament {
998 + unsigned char type;
999 + char *name;
1000 +};
1001 +struct mydirstream {
1002 + DIR dir;
1003 + struct dirent ent;
1004 + unsigned int offset;
1005 + unsigned int size;
1006 + struct mydirstreament av[1];
1007 +};
1008 +typedef struct mydirstream *FTPDIR;
1009 +
1010 /*@unchecked@*/
1011 static int ftpmagicdir = 0x8440291;
1012 -#define ISFTPMAGIC(_dir) (!memcmp((_dir), &ftpmagicdir, sizeof(ftpmagicdir)))
1013 +#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)
1014 +#define SETFTPMAGIC(_dir) ((_dir)->fd) = ftpmagicdir
1015 +#define ISFTPMAGIC(_dir) ((_dir)->fd == ftpmagicdir)
1016 +#else
1017 +#define SETFTPMAGIC(_dir) ((_dir)->dd_fd) = ftpmagicdir
1018 +#define ISFTPMAGIC(_dir) ((_dir)->dd_fd == ftpmagicdir)
1019 +#endif
1021 /*@-boundswrite@*/
1022 /*@-type@*/ /* FIX: abstract DIR */
1023 @@ -1121,8 +1141,7 @@
1024 struct dirent * dp;
1025 size_t nb;
1026 const char * s, * sb, * se;
1027 - const char ** av;
1028 - unsigned char * dt;
1029 + struct mydirstreament * av;
1030 char * t;
1031 int ac;
1032 int c;
1033 @@ -1165,28 +1184,22 @@
1034 }
1035 }
1037 - nb += sizeof(*mydir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
1038 + nb = sizeof(*mydir) + (ac * sizeof(*av)) + nb;
1039 mydir = xcalloc(1, nb);
1040 /*@-abstract@*/
1041 - dp = (struct dirent *) (mydir + 1);
1042 - av = (const char **) (dp + 1);
1043 - dt = (char *) (av + (ac + 1));
1044 - t = (char *) (dt + ac + 1);
1045 + dp = &mydir->ent;
1046 + av = &mydir->av[0];
1047 + t = (char *)&mydir->av[ac+1];
1048 /*@=abstract@*/
1050 - mydir->fd = ftpmagicdir;
1051 -/*@-usereleased@*/
1052 - mydir->data = (char *) dp;
1053 -/*@=usereleased@*/
1054 - mydir->allocation = nb;
1055 - mydir->size = ac;
1056 - mydir->offset = -1;
1057 - mydir->filepos = 0;
1058 + SETFTPMAGIC((DIR *)mydir);
1059 + mydir->size = ac;
1060 + mydir->offset = 0;
1062 ac = 0;
1063 /*@-dependenttrans -unrecog@*/
1064 - dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++;
1065 - dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++;
1066 + av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, "."); ++ac;
1067 + av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, ".."); ++ac;
1068 /*@=dependenttrans =unrecog@*/
1069 sb = NULL;
1070 s = se = ftpBuf;
1071 @@ -1198,34 +1211,34 @@
1072 /*@switchbreak@*/ break;
1073 case '\r':
1074 /*@-dependenttrans@*/
1075 - av[ac] = t;
1076 + av[ac].name = t;
1077 /*@=dependenttrans@*/
1078 if (sb == NULL) {
1079 /*@-unrecog@*/
1080 switch(*s) {
1081 case 'p':
1082 - dt[ac] = DT_FIFO;
1083 + av[ac].type = DT_FIFO;
1084 /*@innerbreak@*/ break;
1085 case 'c':
1086 - dt[ac] = DT_CHR;
1087 + av[ac].type = DT_CHR;
1088 /*@innerbreak@*/ break;
1089 case 'd':
1090 - dt[ac] = DT_DIR;
1091 + av[ac].type = DT_DIR;
1092 /*@innerbreak@*/ break;
1093 case 'b':
1094 - dt[ac] = DT_BLK;
1095 + av[ac].type = DT_BLK;
1096 /*@innerbreak@*/ break;
1097 case '-':
1098 - dt[ac] = DT_REG;
1099 + av[ac].type = DT_REG;
1100 /*@innerbreak@*/ break;
1101 case 'l':
1102 - dt[ac] = DT_LNK;
1103 + av[ac].type = DT_LNK;
1104 /*@innerbreak@*/ break;
1105 case 's':
1106 - dt[ac] = DT_SOCK;
1107 + av[ac].type = DT_SOCK;
1108 /*@innerbreak@*/ break;
1109 default:
1110 - dt[ac] = DT_UNKNOWN;
1111 + av[ac].type = DT_UNKNOWN;
1112 /*@innerbreak@*/ break;
1113 }
1114 /*@=unrecog@*/
1115 @@ -1243,7 +1256,7 @@
1116 /*@switchbreak@*/ break;
1117 }
1118 }
1119 - av[ac] = NULL;
1120 + av[ac].name = NULL;
1122 /*@-kepttrans@*/
1123 return (DIR *) mydir;
1124 @@ -1258,43 +1271,50 @@
1125 {
1126 FTPDIR mydir = (FTPDIR)dir;
1127 struct dirent * dp;
1128 - const char ** av;
1129 - unsigned char * dt;
1130 + struct mydirstreament * av;
1131 int ac;
1132 int i;
1134 /*@+voidabstract@*/
1135 - if (mydir == NULL || !ISFTPMAGIC(mydir) || mydir->data == NULL) {
1136 + if (dir == NULL || !ISFTPMAGIC(dir)) {
1137 /* XXX TODO: EBADF errno. */
1138 return NULL;
1139 }
1140 /*@=voidabstract@*/
1142 - dp = (struct dirent *) mydir->data;
1143 - av = (const char **) (dp + 1);
1144 + dp = &mydir->ent;
1145 + av = &mydir->av[0];
1146 ac = mydir->size;
1147 - dt = (char *) (av + (ac + 1));
1148 - i = mydir->offset + 1;
1149 + i = mydir->offset + 1;
1151 /*@-boundsread@*/
1152 - if (i < 0 || i >= ac || av[i] == NULL)
1153 + if (i < 0 || i >= ac || av[i].name == NULL)
1154 return NULL;
1155 /*@=boundsread@*/
1157 mydir->offset = i;
1159 +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
1160 + dp->d_ino = i + 1;
1161 + dp->d_reclen = 0;
1162 + dp->d_type = av[i].type;
1163 + strncpy(dp->d_name, av[i].name, sizeof(dp->d_name) - 1);
1164 + dp->d_name[sizeof(dp->d_name)-1] = '\0';
1165 + dp->d_namlen = strlen(dp->d_name);
1166 +#elif defined(OPENPKG_HPUX) || defined(sun) || defined(OPENPKG_UNIXWARE) || defined(__osf__) || defined(OPENPKG_IRIX64) || defined(OPENPKG_AIX)
1167 + /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
1168 + dp->d_ino = i + 1; /* W2DO? */
1169 + dp->d_reclen = 0; /* W2DO? */
1170 + strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
1171 +#else
1172 /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
1173 dp->d_ino = i + 1; /* W2DO? */
1174 dp->d_reclen = 0; /* W2DO? */
1175 -
1176 -#if !defined(hpux) && !defined(sun)
1177 dp->d_off = 0; /* W2DO? */
1178 -/*@-boundsread@*/
1179 - dp->d_type = dt[i];
1180 -/*@=boundsread@*/
1181 + dp->d_type = av[i].type;
1182 + strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
1183 #endif
1185 - strncpy(dp->d_name, av[i], sizeof(dp->d_name));
1186 /*@+voidabstract@*/
1187 if (_ftp_debug)
1188 fprintf(stderr, "*** ftpReaddir(%p) %p \"%s\"\n", (void *)mydir, dp, dp->d_name);
1189 @@ -1313,7 +1333,7 @@
1190 /*@+voidabstract@*/
1191 if (_ftp_debug)
1192 fprintf(stderr, "*** ftpClosedir(%p)\n", (void *)mydir);
1193 - if (mydir == NULL || !ISFTPMAGIC(mydir)) {
1194 + if (dir == NULL || !ISFTPMAGIC(dir)) {
1195 /* XXX TODO: EBADF errno. */
1196 return -1;
1197 }
1199 +---------------------------------------------------------------------------
1200 | Remove inclusion of ancient (and since years deprecated) <malloc.h>
1201 | header. This especially makes sure RPM build does not break on
1202 | strict platforms like FreeBSD 5.
1203 +---------------------------------------------------------------------------
1204 Index: system.h
1205 --- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
1206 +++ system.h 8 Jun 2005 13:15:16 -0000 1.4
1207 @@ -256,10 +256,6 @@
1208 #include <err.h>
1209 #endif
1211 -#if HAVE_MALLOC_H && !defined(__LCLINT__)
1212 -#include <malloc.h>
1213 -#endif
1214 -
1215 /*@-declundef -incondefs @*/ /* FIX: these are macros */
1216 /**
1217 */
1219 +---------------------------------------------------------------------------
1220 | Add support for BSD getmntinfo(3).
1221 +---------------------------------------------------------------------------
1222 Index: system.h
1223 --- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
1224 +++ system.h 8 Jun 2005 13:15:16 -0000 1.4
1225 @@ -550,7 +546,7 @@
1226 #define lchown chown
1227 #endif
1229 -#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
1230 +#if HAVE_GETMNTINFO_R || HAVE_GETMNTINFO || HAVE_MNTCTL
1231 # define GETMNTENT_ONE 0
1232 # define GETMNTENT_TWO 0
1233 # if HAVE_SYS_MNTCTL_H
1235 +---------------------------------------------------------------------------
1236 | Drop GCC "inline" attribute if not compiling with GCC.
1237 +---------------------------------------------------------------------------
1238 Index: system.h
1239 --- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
1240 +++ system.h 8 Jun 2005 13:15:16 -0000 1.4
1241 @@ -603,11 +599,24 @@
1243 #if defined(__LCLINT__)
1244 #define FILE_RCSID(id)
1245 -#else
1246 +#elif defined(__GNUC__)
1247 #define FILE_RCSID(id) \
1248 static inline const char *rcsid(const char *p) { \
1249 return rcsid(p = id); \
1250 }
1251 +#else
1252 +#define FILE_RCSID(id) \
1253 +static const char *rcsid(const char *p) { \
1254 + return rcsid(p = id); \
1255 +}
1256 +#endif
1257 +
1258 +/* for basename(3) and dirname(3) */
1259 +#if !defined(OPENPKG_AIX)
1260 +#include <libgen.h>
1261 +#endif
1262 +#if defined(OPENPKG_AIX)
1263 +#define unsetenv(x) /* unsetenv() is used in RPM just for malloc debugging purposes */
1264 #endif
1266 #endif /* H_SYSTEM */
1268 +---------------------------------------------------------------------------
1269 | Remove GCC'ism.
1270 +---------------------------------------------------------------------------
1271 Index: build/rpmfile.h
1272 --- build/rpmfile.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
1273 +++ build/rpmfile.h 22 Jan 2004 21:42:14 -0000 1.2
1274 @@ -95,7 +95,11 @@
1275 } value; /* either number or string */
1276 uint32_t mask; /* mask before comparison with value */
1277 char desc[MAXDESC]; /* description */
1278 +#if defined(__GNUC__)
1279 } __attribute__((__packed__));
1280 +#else
1281 +};
1282 +#endif
1284 #define BIT(A) (1 << (A))
1285 #define STRING_IGNORE_LOWERCASE BIT(0)
1287 +---------------------------------------------------------------------------
1288 | Better portability for madvise(2) usage.
1289 +---------------------------------------------------------------------------
1290 Index: rpmdb/legacy.c
1291 --- rpmdb/legacy.c 18 Dec 2002 22:40:19 -0000 1.1.1.4
1292 +++ rpmdb/legacy.c 22 Jan 2004 21:42:30 -0000 1.2
1293 @@ -182,7 +182,7 @@
1294 break;
1295 }
1297 -#ifdef MADV_SEQUENTIAL
1298 +#if defined(HAVE_MADVISE) && defined(MADV_SEQUENTIAL)
1299 xx = madvise(mapped, fsize, MADV_SEQUENTIAL);
1300 #endif
1303 +---------------------------------------------------------------------------
1304 | Better portability for madvise(2) usage.
1305 +---------------------------------------------------------------------------
1306 Index: lib/fsm.c
1307 --- lib/fsm.c 3 Mar 2003 21:28:12 -0000 1.1.1.5
1308 +++ lib/fsm.c 22 Jan 2004 21:42:23 -0000 1.2
1309 @@ -879,7 +879,7 @@
1310 rdbuf = fsm->rdbuf;
1311 fsm->rdbuf = (char *) mapped;
1312 fsm->rdlen = nmapped = st->st_size;
1313 -#if defined(MADV_DONTNEED)
1314 +#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
1315 xx = madvise(mapped, nmapped, MADV_DONTNEED);
1316 #endif
1317 }
1318 @@ -909,7 +909,7 @@
1319 #if HAVE_MMAP
1320 if (mapped != (void *)-1) {
1321 xx = msync(mapped, nmapped, MS_ASYNC);
1322 -#if defined(MADV_DONTNEED)
1323 +#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
1324 xx = madvise(mapped, nmapped, MADV_DONTNEED);
1325 #endif
1326 /*@-noeffect@*/ xx = munmap(mapped, nmapped) /*@=noeffect@*/;
1328 +---------------------------------------------------------------------------
1329 | Support UnixWare 7.1.3 and OpenDarwin 6.6.2, too.
1330 +---------------------------------------------------------------------------
1331 Index: aclocal.m4
1332 --- aclocal.m4 16 Jul 2003 17:05:28 -0000 1.1.1.10
1333 +++ aclocal.m4 6 Jun 2005 15:53:03 -0000 1.4
1334 @@ -2838,7 +2838,7 @@
1335 runpath_var=LD_RUN_PATH
1336 ;;
1338 - sysv5uw7* | unixware7*)
1339 + sysv5uw7* | unixware7* | sysv5UnixWare7* )
1340 no_undefined_flag='${wl}-z ${wl}text'
1341 if test "$GCC" = yes; then
1342 archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
1343 @@ -4311,6 +4311,7 @@
1344 ;;
1345 *) # Darwin 1.3 on
1346 lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
1347 + lt_cv_deplibs_check_method=pass_all
1348 ;;
1349 esac
1350 ;;
1351 @@ -4336,7 +4337,7 @@
1352 ;;
1354 hpux10.20*|hpux11*)
1355 - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
1356 + lt_cv_deplibs_check_method='pass_all'
1357 lt_cv_file_magic_cmd=/usr/bin/file
1358 lt_cv_file_magic_test_file=/usr/lib/libc.sl
1359 ;;
1360 @@ -4375,11 +4376,7 @@
1361 ;;
1363 netbsd*)
1364 - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
1365 - lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
1366 - else
1367 - lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
1368 - fi
1369 + lt_cv_deplibs_check_method='pass_all'
1370 ;;
1372 newos6*)
1373 @@ -4414,7 +4411,7 @@
1374 lt_cv_file_magic_test_file=/lib/libc.so
1375 ;;
1377 -sysv5uw[[78]]* | sysv4*uw2*)
1378 +sysv5uw[[78]]* | sysv4*uw2* | sysv5UnixWare7* )
1379 lt_cv_deplibs_check_method=pass_all
1380 ;;
1383 +---------------------------------------------------------------------------
1384 | Use Linux i386 assembly specific stuff on Linux only.
1385 +---------------------------------------------------------------------------
1386 Index: rpmio/rpmsw.c
1387 --- rpmio/rpmsw.c 5 Jun 2003 12:04:05 -0000 1.1.1.1
1388 +++ rpmio/rpmsw.c 22 Jan 2004 21:42:33 -0000 1.2
1389 @@ -27,7 +27,7 @@
1390 /*@unchecked@*/
1391 static int rpmsw_initialized = 0;
1393 -#if defined(__i386__)
1394 +#if defined(__linux__) && defined(__i386__)
1395 /* Swiped from glibc-2.3.2 sysdeps/i386/i686/hp-timing.h */
1397 #define HP_TIMING_ZERO(Var) (Var) = (0)
1399 +---------------------------------------------------------------------------
1400 | Fix "environ" declaration.
1401 +---------------------------------------------------------------------------
1402 Index: lib/signature.c
1403 --- lib/signature.c 29 May 2003 18:42:23 -0000 1.1.1.23
1404 +++ lib/signature.c 22 Jan 2004 21:42:25 -0000 1.2
1405 @@ -27,7 +27,7 @@
1406 /*@access pgpDigParams@*/
1408 #if !defined(__GLIBC__)
1409 -char ** environ = NULL;
1410 +extern char ** environ;
1411 #endif
1413 int rpmLookupSignatureType(int action)
1415 +---------------------------------------------------------------------------
1416 | Rename own mergesort(3) implementation to avoid conflicts
1417 | with a possibly existing vendor version.
1418 +---------------------------------------------------------------------------
1419 Index: rpmdb/merge.c
1420 --- rpmdb/merge.c 22 Jun 2002 18:51:58 -0000 1.1.1.2
1421 +++ rpmdb/merge.c 22 Jan 2004 21:42:30 -0000 1.2
1422 @@ -204,7 +204,7 @@
1423 * Arguments are as for qsort.
1424 */
1425 int
1426 -mergesort(void *base, size_t nmemb, size_t size,
1427 +rpmdb_mergesort(void *base, size_t nmemb, size_t size,
1428 int (*cmp) (const void *, const void *))
1429 {
1430 register int i, sense;
1432 +---------------------------------------------------------------------------
1433 | Rename own mergesort(3) implementation to avoid conflicts
1434 | with a possibly existing vendor version.
1435 +---------------------------------------------------------------------------
1436 Index: rpmdb/rpmdb.h
1437 --- rpmdb/rpmdb.h 18 Jan 2003 14:04:35 -0000 1.1.1.5
1438 +++ rpmdb/rpmdb.h 22 Jan 2004 21:42:31 -0000 1.2
1439 @@ -1080,7 +1080,7 @@
1440 * Mergesort, same arguments as qsort(2).
1441 */
1442 /*@unused@*/
1443 -int mergesort(void *base, size_t nmemb, size_t size,
1444 +int rpmdb_mergesort(void *base, size_t nmemb, size_t size,
1445 int (*cmp) (const void *, const void *))
1446 /*@globals errno @*/
1447 /*@modifies base, errno @*/;
1449 +---------------------------------------------------------------------------
1450 | Rename own mergesort(3) implementation to avoid conflicts
1451 | with a possibly existing vendor version.
1452 +---------------------------------------------------------------------------
1453 Index: rpmdb/rpmdb.c
1454 --- rpmdb/rpmdb.c 2 Jul 2003 19:21:54 -0000 1.1.1.6
1455 +++ rpmdb/rpmdb.c 22 Jan 2004 21:42:30 -0000 1.2
1456 @@ -2361,7 +2361,7 @@
1457 sizeof(*mi->mi_set->recs), hdrNumCmp);
1458 /*@=boundsread@*/
1459 #else
1460 - mergesort(mi->mi_set->recs, mi->mi_set->count,
1461 + rpmdb_mergesort(mi->mi_set->recs, mi->mi_set->count,
1462 sizeof(*mi->mi_set->recs), hdrNumCmp);
1463 #endif
1464 mi->mi_sorted = 1;
1466 +---------------------------------------------------------------------------
1467 | Workaround a double-inclusion problem under AIX.
1468 +---------------------------------------------------------------------------
1469 Index: lib/getdate.y
1470 --- lib/getdate.y 24 Sep 2001 21:53:15 -0000 1.1.1.2
1471 +++ lib/getdate.y 8 Jun 2005 13:16:22 -0000 1.2
1472 @@ -30,7 +30,9 @@
1473 #undef static
1474 #endif
1476 +#ifndef OPENPKG_AIX
1477 #include <stdio.h>
1478 +#endif
1479 #include <ctype.h>
1481 /* The code at the top of get_date which figures out the offset of the
1483 +---------------------------------------------------------------------------
1484 | Workaround a double-inclusion problem under AIX.
1485 +---------------------------------------------------------------------------
1486 Index: lib/getdate.c
1487 --- lib/getdate.c 2 Jul 2003 19:21:45 -0000 1.1.1.4
1488 +++ lib/getdate.c 8 Jun 2005 13:16:21 -0000 1.2
1489 @@ -50,7 +50,9 @@
1490 #undef static
1491 #endif
1493 +#ifndef OPENPKG_AIX
1494 #include <stdio.h>
1495 +#endif
1496 #include <ctype.h>
1498 /* The code at the top of get_date which figures out the offset of the
1500 +---------------------------------------------------------------------------
1501 | The following patch works around a general failure of RPM to
1502 | adhere to the ISO C standard, for which newer GCC releases claim
1503 | compile errors and fail.
1504 +---------------------------------------------------------------------------
1505 Index: misc/err.h
1506 --- misc/err.h 2009-01-06 22:48:16.104430941 +0100
1507 +++ misc/err.h 2009-01-06 22:47:55.944312482 +0100
1508 @@ -29,31 +29,4 @@
1509 # define __gnuc_va_list __ptr_t
1510 #endif
1512 -__BEGIN_DECLS
1513 -
1514 -/* Print "program: ", FORMAT, ": ", the standard error string for errno,
1515 - and a newline, on stderr. */
1516 -extern void warn __P ((__const char *__format, ...))
1517 - __attribute__ ((__format__ (__printf__, 1, 2)));
1518 -extern void vwarn __P ((__const char *__format, __gnuc_va_list))
1519 - __attribute__ ((__format__ (__printf__, 1, 0)));
1520 -
1521 -/* Likewise, but without ": " and the standard error string. */
1522 -extern void warnx __P ((__const char *__format, ...))
1523 - __attribute__ ((__format__ (__printf__, 1, 2)));
1524 -extern void vwarnx __P ((__const char *__format, __gnuc_va_list))
1525 - __attribute__ ((__format__ (__printf__, 1, 0)));
1526 -
1527 -/* Likewise, and then exit with STATUS. */
1528 -extern void err __P ((int __status, __const char *__format, ...))
1529 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
1530 -extern void verr __P ((int __status, __const char *__format, __gnuc_va_list))
1531 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
1532 -extern void errx __P ((int __status, __const char *__format, ...))
1533 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
1534 -extern void verrx __P ((int __status, __const char *, __gnuc_va_list))
1535 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
1536 -
1537 -__END_DECLS
1538 -
1539 #endif /* err.h */