First impressions of the "getopt.h forrest"

Bernhard Fischer rep.dot.nop at gmail.com
Wed Mar 28 20:51:06 UTC 2007


On Wed, Mar 28, 2007 at 09:25:31PM +0200, Mats Erik Andersson wrote:
>tis 2007-03-27 klockan 23:26 +0200 skrev Denis Vlasenko:
>
>> To me it looks like bbox with CONFIG_GETOPT_LONG=n and without
>> run_parts, dumpleases, getopt is already can be compiled with
>> susv3 getopt.

Please let's not depend applets that use getopt_long() on
CONFIG_GETOPT_LONG=n but rather fix them!

I've fixed run-parts (by rewriting it; it's now half the size it was
before) already. Please update.
>
>Today I have rewritten run_parts.c and dumpleases.c to use getopt32,
>and both compile with the standard setting of Eriksen's buildroot
>and Busybox 1.5.0. I also successfully tested run-parts in all
>conceivable ways.

I will not look at dumpleases, so if you can fix that, that would be
great. Keep in mind that about any code you touch should be smaller
afterwards. This holds especially true when removing stuff like direct
getopt() calls et al.

The only excuse for adding to the size is IMO bugfixes. One could argue
that getopt_long is a bug in itself, but still, dropping it is supposed
to make the affected applet smaller, not bigger.

>
>My next step was to reconfigure uClibc 0.9.28.3 in various ways,
>including a switch to getopt-susv3. I did reduce my configuration
>for Busybox somewhat, but made sure to set CONFIG_GETOPT_LONG=n
>and include the applets run-parts (tested) and dumplease (could not
>test due to lacking net card), but excluded the applet getopt.
>Using this setting and I built a floppy based system from the root file
>system and a linux kernel 2.6.20.4. I ended up with a size of 370k
>for Busybox and 212k for uClibc, and a configuration without libgcc_s.
>
>There was exactly one point where I had to intervene by hand:
>the choice of getopt-susv3 excluded the header include/getopt.h
>whence I had to arrange it by hand as
>
>   ln -s bits/getopt.h include/getopt.h

hm. Good to know, i'll have a look if time permits (please file a bug
against buildroot/uClibc, where approriate; should be uClibc).

>Then the whole build process could be completed to a running system.
>My conclusion is that one should ask the uClibc people to create such
>a soft link in case the choice of GNU-getopt is made in the
>configuration of uClibc.



More information about the busybox mailing list