[Toybox] Commit 897: size reduction, and new warning

Isaac Dunham idunham at lavabit.com
Tue May 14 06:38:08 PDT 2013


On Mon, 13 May 2013 23:15:48 -0500
Rob Landley <rob at landley.net> wrote:

> On 05/12/2013 01:58:12 AM, idunham at lavabit.com wrote:
> > I'm impressed:
> > -rwxr-xr-x 1 143640 May 11 23:16 toybox
> > -rwxr-xr-x 1 252748 May 10 21:32 toybox-895
> > -rwxr-xr-x 1 166499 May 11 23:16 toybox_unstripped
> > (Coincidentally, this is the output of ls -lgo with coreutils;
> > toybox appears to have no way to do a full ls with neither group nor
> > owner...but I'd expect that one could deal with that via pipes.)

> > So a change of less than 30 lines nearly halved size.
> 
> Odd. I'm not seeing that here. Have you tried Have you tried  
> scripts/bloat-o-meter?

Oops, I think I forgot that I built the first one static with musl and
the second shared.
 
> hg checkout -r 896
> make allyesconfig
> make baseline
> hg checkout -r 897
> make bloatcheck
> 
> name                                           old       new
> delta
> -----------------------------------------------------------------------
> xgetmountlist                                   0       243
> 243 df_main                                       299
> 294         -5 getmountlist
> 343         0       -343
> -----------------------------------------------------------------------
> -105 total

Sounds much more reasonable.

> > But gcc is warning about line 21 of lib/getmountlist.c:
> >   for (mtlist = 0; me = getmntent(fp); mtlist = mt) {
> 
> Yeah it wants an extra parentheses to confirm I really MEAN an  
> assignment in the middle there. On the todo list...
> 
> > Output of make:
> > scripts/make.sh
> > Make generated/config.h from .config.
> > Extract configuration information from toys/*.c files...
> > Generate headers from toys/*/*.c...
> > generated/newtoys.h
> > generated/globals.h
> > generated/help.h
> > Extract help text from Config.in.
> > Library probe...
> > Compile toybox...
> > lib/getmountlist.c: In function 'xgetmountlist':
> > lib/getmountlist.c:21: warning: suggest parentheses around
> > assignment used as truth value
> > toys/pending/stat.c: In function 'check_type_file':
> > toys/pending/stat.c:84: warning: control reaches end of non-void  
> > function
> > 
> > The latter warning is GCC nonsense, I know.
> 
> My allyesconfig is also giving warnings from mke2fs and toysh, but
> both of those need to essentially be restarted...

This is a custom config including everything I find useful (find xzcat
ifconfig stat, IIRC-on a different laptop right now, so not certain) as
well as pretty much all of defconfig. 
toysh is not included for obvious reasons, and I didn't enable  mke2fs
this time-is it functional?

> > So gcc seems to be assuming that the condition is
> > "While assigning the result of getmntent(fp) to me succeeds."
> > Am I missing something here, or should that have been "=="?
> 
> No, it's actually an assignment. It reads in the next entry, saving
> it to the variable, and stops if the entry was null. The test
> condition is run the first time through the loop and after every
> increment, so putting it there avoids duplicating it.
> 
> I should probably have a comment about that...

Ah, thanks for clarifying.



 1368538688.0


More information about the Toybox mailing list