[BusyBox 0000728]: [PORTABILITY] GNU libc asprintf dependency

bugs at busybox.net bugs at busybox.net
Wed Mar 1 14:03:15 UTC 2006


A NOTE has been added to this issue. 
====================================================================== 
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:                     acknowledged
====================================================================== 
Date Submitted:             02-18-2006 10:18 PST
Last Modified:              03-01-2006 06:03 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. 

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                          
======================================================================




More information about the busybox-cvs mailing list