Re: [CVS] RPM: rpm/ CHANGES configure.ac rpm/misc/ Makefile.am asprintf.h ...
On Jul 29, 2008, at 7:24 AM, devzero2000 wrote: On Mon, Jul 28, 2008 at 4:53 PM, Jeff Johnson [EMAIL PROTECTED] wrote: This likely needs some context ... rpmmtree derived from BSD still has some *BSD peculier API usages, strtouq(), asprintf() and strvis() just to mention some of the portability issues. Normally I'd just rewrite rpmmtree.c to avoid the portability issues, and will likely do that with rpmmtree(8) somewhen soon as well. However, rpm.org is making heavy usage of something called rasprintf, so some sort of malloc'ing printf simplifies stealing code from rpm.org. I prefer the well known asprintf(3) API, which is often present in system libraries, to a home rolled custom malloc'ing printf gadget API. strtouq(3) is almost certainly going to have some portability issues somewhere (my guess). Dunno the best answer, time to find out. http://mirbsd.org/htman/i386/man3/strtoul.htm So it is possibile to use strtoul(3) in place of strouq. And strtoul is more portable , standard (C99) compliant The problem reported needs solving on QNX, which either does not have strtoul, or (more likely) that the sizeof(unsigned long) sizeof(off_t). The strtouq() is being used to convert st-st_size in a stat(2) structure. But yes strtoul() is likely more portable than strtouq(). And I still don't know what to do with the strvis(3) usages in rpmmtree. Internal to rpmmtree a while longer hurts little for now. Perhaps it is necessary to introduce libedit, that have the implementation of strvis, internal to RPM - for portabilty. Or, perhaps better, to use internal only the strvis function of vis.c in libedit http://koji.fedoraproject.org/packages/libedit/2.11/1.20080712cvs.fc10/src/libedit-2.11-1.20080712cvs.fc10.src.rpm Yes, libedit is the library where where strvis() is usually found on Linux. But there's portability to other non-linux platforms needed too, and tying rpmmtree = -ledit in order to use strvis() limits where rpmmtree can be compiled. Personally, strvis(3) does not seem to be a very useful function imho. I would have rewritten rpmmtree to eliminate strvis(3) usage already if strvis(3) were used directly in rpm code paths. Interoperability with system mtree(8) on Mac OS X and *BSD is what caused me to leave strvis(3) within rpmmtree. So there's lots of solutions, just no clear indication of which solution is best yet. hth 73 de Jeff
Re: [CVS] RPM: rpm/ CHANGES configure.ac rpm/misc/ Makefile.am asprintf.h ...
This likely needs some context ... rpmmtree derived from BSD still has some *BSD peculier API usages, strtouq(), asprintf() and strvis() just to mention some of the portability issues. Normally I'd just rewrite rpmmtree.c to avoid the portability issues, and will likely do that with rpmmtree(8) somewhen soon as well. However, rpm.org is making heavy usage of something called rasprintf, so some sort of malloc'ing printf simplifies stealing code from rpm.org. I prefer the well known asprintf(3) API, which is often present in system libraries, to a home rolled custom malloc'ing printf gadget API. strtouq(3) is almost certainly going to have some portability issues somewhere (my guess). Dunno the best answer, time to find out. And I still don't know what to do with the strvis(3) usages in rpmmtree. Internal to rpmmtree a while longer hurts little for now. hth 73 de Jeff On Jul 28, 2008, at 10:35 AM, Jeff Johnson wrote: RPM Package Manager, CVS Repository http://rpm5.org/cvs/ __ __ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 28-Jul-2008 16:35:27 Branch: HEAD Handle: 2008072814352501 Added files: rpm/miscasprintf.h Modified files: rpm CHANGES configure.ac rpm/miscMakefile.am rpm/rpmdb rpmdb.c sqlite.c rpm/tools rpmmtree.c Log: - QNX: use strtouq() instead of strtoul() in rpmmtree. - QNX: retrofit asprintf.h (from XAR) for the deprived. rpmmtree uses (rewrite to eliminate asprintf is an alternative). - QNX: supply missing typedef's for uint32_t. Summary: RevisionChanges Path 1.2509 +4 -0 rpm/CHANGES 2.305 +1 -1 rpm/configure.ac 1.34+1 -1 rpm/misc/Makefile.am 1.1 +92 -0 rpm/misc/asprintf.h 1.253 +1 -1 rpm/rpmdb/rpmdb.c 1.34+1 -1 rpm/rpmdb/sqlite.c 2.3 +10 -2 rpm/tools/rpmmtree.c __ __ patch -p0 '@@ .' Index: rpm/CHANGES == == $ cvs diff -u -r1.2508 -r1.2509 CHANGES --- rpm/CHANGES 20 Jul 2008 00:04:51 - 1.2508 +++ rpm/CHANGES 28 Jul 2008 14:35:25 - 1.2509 @@ -1,5 +1,9 @@ 5.1.0 - 5.2a0: +- jbj: QNX: use strtouq() instead of strtoul() in rpmmtree. +- jbj: QNX: retrofit asprintf.h (from XAR) for the deprived. rpmmtree uses + (rewrite to eliminate asprintf is an alternative). +- jbj: QNX: supply missing typedef's for uint32_t. - jbj: add alternative %{sparcx} macro shorthand (bz #455972). - jbj: rpmio: add new link/unlink methods to loader map. - jbj: python: add rpm.Keyring/rpm.Pubkey subtype methods for rpmkeyring. @@ . patch -p0 '@@ .' Index: rpm/configure.ac == == $ cvs diff -u -r2.304 -r2.305 configure.ac --- rpm/configure.ac 15 Jul 2008 18:57:09 - 2.304 +++ rpm/configure.ac 28 Jul 2008 14:35:25 - 2.305 @@ -686,7 +686,7 @@ dnl checks for library functions (generic) AC_CHECK_FUNCS([dnl -basename getaddrinfo getcwd getnameinfo getwd iconv inet_aton confstr dnl +asprintf basename getaddrinfo getcwd getnameinfo getwd iconv inet_aton confstr dnl mtrace putenv realpath setenv clearenv stpcpy stpncpy strcspn strdup dnl strndup strerror strtol strtoul strspn strstr sighold sigrelse sigpause dnl sigprocmask sigemptyset sigaddset sigdelset sigsuspend madvise dnl @@ . patch -p0 '@@ .' Index: rpm/misc/Makefile.am == == $ cvs diff -u -r1.33 -r1.34 Makefile.am --- rpm/misc/Makefile.am 28 Apr 2008 16:40:28 - 1.33 +++ rpm/misc/Makefile.am 28 Jul 2008 14:35:26 - 1.34 @@ -7,7 +7,7 @@ -I$(top_srcdir) EXTRA_DIST = \ - librpmmisc.vers \ + librpmmisc.vers asprintf.h \ alloca.cbasename.c err.c error.c \ fakefork.c fnmatch.c getcwd.cgetmntent.c \ getwd.c glob.c memcmp.c\ @@ . patch -p0 '@@ .' Index: rpm/misc/asprintf.h == == $ cvs diff -u -r0 -r1.1 asprintf.h --- /dev/null 2008-07-28 16:33:00 +0200 +++ asprintf.h2008-07-28 16:35:26 +0200 @@ -0,0 +1,92 @@ +// ==
Re: [CVS] RPM: rpm/ CHANGES configure.ac rpm/misc/ Makefile.am asprintf.h ...
On Jul 28, 2008, at 11:10 AM, Ralf S. Engelschall wrote: On Mon, Jul 28, 2008, Jeff Johnson wrote: [...] @@ -0,0 +1,92 @@ +// = = +// +// Copyright (C) 2005 Jason Evans [EMAIL PROTECTED]. All rights reserved. +// [...] You are sure we already want C++/C99-style comments in the RPM code base? I'm quite sure that we dinna want the original patch as sent: --- tools/rpmmtree.c.orig 2008-07-24 15:03:04.0 +0200 +++ tools/rpmmtree.c2008-07-24 15:06:55.0 +0200 @@ -53,6 +53,10 @@ #definest_mtimespecst_mtim #endif +#if defined(__QNXNTO__) +#definest_mtimespecst_mtime +#endif + #include rpmio_internal.h/* XXX fdInitDigest() et al */ #include fts.h #include ugid.h @@ -69,6 +73,11 @@ #include rpmts.h #endif +#include config.h +#ifndef HAVE_ASPRINTF +#include ../xar/lib/asprintf.h +#endif + #defineRPM_LIST_HEAD(name, type) \ struct name { struct type *lh_first; } #defineRPM_LIST_ENTRY(type) \ @@ -1015,7 +1024,7 @@ /*==*/ /* XXX *BSD systems already have getmode(3) and setmode(3) */ -#if defined(__linux__) || defined(__LCLINT__) +#if defined(__linux__) || defined(__LCLINT__) || defined(__QNXNTO__) #if !defined(HAVE_GETMODE) || !defined(HAVE_SETMODE) #defineSET_LEN 6 /* initial # of bitcmd struct to malloc */ @@ -1500,7 +1509,7 @@ /[EMAIL PROTECTED]@*/ break; case MTREE_KEYS_SIZE: /[EMAIL PROTECTED]@*/ - ip-sb.st_size = strtouq(val, ep, 10); + ip-sb.st_size = strtoul(val, ep, 10); /[EMAIL PROTECTED]@*/ if (*ep != '\0') mtree_error(invalid size %s, val); todo++, thanks for noticing. 73 de Jeff Ralf S. Engelschall [EMAIL PROTECTED] www.engelschall.com __ RPM Package Managerhttp://rpm5.org Developer Communication Listrpm-devel@rpm5.org __ RPM Package Managerhttp://rpm5.org Developer Communication Listrpm-devel@rpm5.org