[BusyBox 0000728]: [PORTABILITY] GNU libc asprintf dependency
bugs at busybox.net
bugs at busybox.net
Thu Mar 9 23:01:30 UTC 2006
The following issue has been REOPENED.
======================================================================
http://busybox.net/bugs/view.php?id=728
======================================================================
Reported By: rfelker
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 728
Category: Other
Reproducibility: always
Severity: minor
Priority: normal
Status: feedback
======================================================================
Date Submitted: 02-18-2006 10:18 PST
Last Modified: 03-09-2006 15:01 PST
======================================================================
Summary: [PORTABILITY] GNU libc asprintf dependency
Description:
libbb/bb_asprintf.c fails to compile without GNU vasprintf. A simple
fallback is to first call snprintf with NULL string argument to get the
length (excluding terminator byte), malloc, then call snprintf again with
the new buffer.
======================================================================
----------------------------------------------------------------------
vodz - 02-20-06 03:19
----------------------------------------------------------------------
Its require the auto configure infrastructure.
I don`t know, how detect supporting asprintf in libbb internally in the
compiling process.
----------------------------------------------------------------------
rfelker - 02-28-06 00:27
----------------------------------------------------------------------
I've found other dependencies on GNU functions too, like strndup (that one
is stupid though since it obviously should be replaced by bb_xstrdup). IMO
one possible solution is to have a manual configuration option to disable
dependence on all GNU-specific functions and use portable replacements for
them (at a possible but minor size/performance penalty).
----------------------------------------------------------------------
rfelker - 02-28-06 14:17
----------------------------------------------------------------------
I just uploaded a patch with fixes for this and several other GNU-isms. The
others can all easily be fixed without any option since BusyBox already has
its own function in libbb to match. However, the patch has vasprintf inside
#ifdef HAVE_GNU_EXTENSIONS which is obviously not going to make everyone
happy unless HAVE_GNU_EXTENSIONS is selectable somewhere. On the other
hand, maybe it's desirable to always use my version since vasprintf may
not have the desired malloc error checking..?
Other portability issues remain, especially the inclusion of
Linux-specific modules in libbb even if the applets which use them are
disabled. I'll attempt to submit more patches later.
----------------------------------------------------------------------
vodz - 02-28-06 21:34
----------------------------------------------------------------------
My (very old) local copy ucLibc 0.9.20 have not HAVE_GNU_EXTENSIONS.
----------------------------------------------------------------------
rfelker - 03-01-06 06:03
----------------------------------------------------------------------
Of course it doesn't. As I said in my note, this is an undefined macro
which would have to be added somewhere in busybox configuration if you
want to use vasprintf. Whether there's any good reason to want to use it
is open to question.
Anyway this is just one part of the patch. The other fixes should all be
clean and noncontroversial.
----------------------------------------------------------------------
landley - 03-09-06 14:22
----------------------------------------------------------------------
svn 14498.
I'd suggest setting the #define in platform.h.
----------------------------------------------------------------------
rfelker - 03-09-06 15:01
----------------------------------------------------------------------
Some of the changes were reverted in 14499, recreating the issue with
netinet/in.h. A much cleaner solution would be to always include both.
Issue History
Date Modified Username Field Change
======================================================================
02-18-06 10:18 rfelker New Issue
02-18-06 10:18 rfelker Status new => assigned
02-18-06 10:18 rfelker Assigned To => BusyBox
02-20-06 03:19 vodz Note Added: 0001122
02-20-06 03:19 vodz Status assigned => acknowledged
02-20-06 03:19 vodz Resolution open => suspended
02-28-06 00:27 rfelker Note Added: 0001145
02-28-06 13:54 rfelker File Added: portability1.diff
02-28-06 14:17 rfelker Note Added: 0001149
02-28-06 21:34 vodz Note Added: 0001150
03-01-06 06:03 rfelker Note Added: 0001152
03-09-06 14:22 landley Status acknowledged => closed
03-09-06 14:22 landley Note Added: 0001181
03-09-06 15:01 rfelker Status closed => feedback
03-09-06 15:01 rfelker Resolution suspended => reopened
03-09-06 15:01 rfelker Note Added: 0001182
======================================================================
More information about the busybox-cvs
mailing list