[BusyBox 0001438]: [patch] fix assumptions the build environment is Linux

bugs at busybox.net bugs at busybox.net
Tue Jul 31 18:57:55 UTC 2007


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1438 
====================================================================== 
Reported By:                mirabilos
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1438
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             07-20-2007 05:41 PDT
Last Modified:              07-31-2007 11:57 PDT
====================================================================== 
Summary:                    [patch] fix assumptions the build environment is
Linux
Description: 
• not all systems have /bin/bash

• compressed usage generation does not work if the target sy-
  stem deviates from the build system too much: busybox itself
  includes several Linux headers, which obviously aren't existent
  on a real UNIX® system from which buxybox is cross-compiled;
  disabling compressed usage was not enough, since the utility
  programme was still built (I'd be glad if you have a better
  fix, since like this you still have to define a variable)

====================================================================== 

---------------------------------------------------------------------- 
 vapier - 07-20-07 15:37  
---------------------------------------------------------------------- 
no, not all systems have /bin/bash, but trylink is a POSIX shell script and
all systems must have a /bin/sh

as for usage, it builds fine for me on OS X so i dont know what your
trouble is, but simply disabling it in the Makefile is incorrect 

---------------------------------------------------------------------- 
 vda - 07-21-07 07:39  
---------------------------------------------------------------------- 
-#!/bin/sh
+#!/usr/bin/env bash

Can you fix bash-isms in trylink instead, so that it runs under your
shell. Which one do you use?

>compressed usage generation does not work

Then proprly #ifdef out relevant pieces conditionally on
FEATURE_COMPRESS_USAGE. (We are a bit lax with it now, yes.) Your patch is
a quick hack 

---------------------------------------------------------------------- 
 mirabilos - 07-21-07 09:09  
---------------------------------------------------------------------- 
I'll see to the bashisms - when looking now, I don't see
them either. Maybe the script changed in the meantime, I
think that part was first done for 1.2.x or so.

Regarding the "compressed help" stuff: even if disabling
the "compressed help" option, it still tries to build a
host programme (helper) which breaks on BSD (but I will
try again without that diff if you think it shouldn't). 

---------------------------------------------------------------------- 
 mirabilos - 07-23-07 03:17  
---------------------------------------------------------------------- 
This is the problem with compressed help:

  gcc -Wp,-MD,applets/.usage.d -Wall -Wstrict-prototypes -O2
-fomit-frame-pointer     
-I/home/.data/tg/svn/trunk/freewrt/build_mipsel/w-busybox-1.4.2-24/busybox-1.4.2/include
-o applets/usage applets/usage.c
applets/usage.c:0: note: someone does not honour COPTS correctly, passed 0
times
In file included from applets/../include/libbb.h:13,
                 from applets/../include/busybox.h:10,
                 from applets/usage.c:5:
applets/../include/platform.h:93:23: byteswap.h: No such file or
directory
applets/../include/platform.h:94:21: endian.h: No such file or directory
In file included from applets/../include/libbb.h:13,
                 from applets/../include/busybox.h:10,
                 from applets/usage.c:5:
applets/../include/platform.h:132: error: conflicting types for
'socklen_t'
/usr/include/sys/types.h:109: error: previous declaration of 'socklen_t'
was here
In file included from applets/../include/libbb.h:20,
                 from applets/../include/busybox.h:10,
                 from applets/usage.c:5:
/usr/include/malloc.h:4:2: warning: #warning "<malloc.h> is obsolete, use
<stdlib.h>"
In file included from applets/../include/busybox.h:10,
                 from applets/usage.c:5:
applets/../include/libbb.h:33:24: sys/statfs.h: No such file or directory
In file included from applets/../include/libbb.h:53,
                 from applets/../include/busybox.h:10,
                 from applets/usage.c:5:
applets/../include/grp_.h:44: error: conflicting types for 'setgroups'
/usr/include/unistd.h:202: error: previous declaration of 'setgroups' was
here
applets/../include/grp_.h:44: error: conflicting types for 'setgroups'
/usr/include/unistd.h:202: error: previous declaration of 'setgroups' was
here
In file included from applets/../include/busybox.h:10,
                 from applets/usage.c:5:
applets/../include/libbb.h:285: warning: "struct sockaddr_in" declared
inside parameter list
applets/../include/libbb.h:296: error: field `sin' has incomplete type
applets/../include/libbb.h:298: error: field `sin6' has incomplete type
gmake[4]: *** [applets/usage] Error 1

That's why I had to disable building that helper programme. 

---------------------------------------------------------------------- 
 mirabilos - 07-23-07 03:31  
---------------------------------------------------------------------- 
ok, the bash issue is indeed no longer present,
I cannot reproduce the problems we had had in
the past any more and don't remember them either...
I guess this is what happens with diffs when they
aren't maintained upstream...

And this works better too:

--- busybox-1.4.2/applets/Kbuild.orig   Sun Mar 18 16:59:13 2007
+++ busybox-1.4.2/applets/Kbuild        Fri Jul 20 12:08:48 2007
@@ -8,6 +8,7 @@ obj-y:=
 obj-y  += applets.o
 obj-y  += busybox.o
 
+ifneq (${CONFIG_FEATURE_COMPRESS_USAGE},)
 # Generated file needs additional love
 
 applets/applets.o: include/usage_compressed.h
@@ -20,3 +21,4 @@ quiet_cmd_gen_usage_compressed = GEN    
       cmd_gen_usage_compressed = $(srctree)/applets/usage_compressed
include/usage_compressed.h applets
 include/usage_compressed.h: $(srctree)/include/usage.h applets/usage
        $(call cmd,gen_usage_compressed)
+endif 

---------------------------------------------------------------------- 
 vapier - 07-23-07 15:29  
---------------------------------------------------------------------- 
the compressed help should already be fixed as well

please use current svn trunk when doing testing and posting patches 

---------------------------------------------------------------------- 
 ulmen - 07-31-07 11:57  
---------------------------------------------------------------------- 
I was the original discoverer of the bashism in the trylink script in our
project. I use dash as my /bin/sh, which is known to be very
POSIX-compilant and not much more.

"function" is not in the IEEE Std 1003.1.

It's fixed in your trunk and 1.5/1.6-branch since rev 17973, but please
change this in the 1.4 branch (if still supported), too. 

--- busybox-1.4.2/scripts/trylink.orig  2007-07-31 20:46:00.000000000
+0200
+++ busybox-1.4.2/scripts/trylink       2007-07-31 20:46:15.000000000
+0200
@@ -2,7 +2,7 @@
 
 debug=false
 
-function try {
+try {
     added="$1"
     shift
     $debug && echo "Trying: $* $added" 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-20-07 05:41  mirabilos      New Issue                                    
07-20-07 05:41  mirabilos      Status                   new => assigned     
07-20-07 05:41  mirabilos      Assigned To               => BusyBox         
07-20-07 05:41  mirabilos      File Added: 950-unportability.patch              
     
07-20-07 15:37  vapier         Note Added: 0002610                          
07-21-07 07:39  vda            Note Added: 0002615                          
07-21-07 09:09  mirabilos      Note Added: 0002622                          
07-23-07 03:17  mirabilos      Note Added: 0002629                          
07-23-07 03:31  mirabilos      Note Added: 0002630                          
07-23-07 15:29  vapier         Note Added: 0002638                          
07-31-07 11:57  ulmen          Note Added: 0002646                          
======================================================================




More information about the busybox-cvs mailing list