[Toybox] make menuconfig

Rob Landley rob at landley.net
Sun May 3 11:27:42 PDT 2015


On 05/02/2015 02:54 PM, enh wrote:
> anyone else having trouble with "make menuconfig"? getprop and setprop
> aren't showing up for me, and i don't see where to set
> CONFIG_TOYBOX_ON_ANDROID and generated/mkflags segfaults if i have ls
> configured and...
> 
> actually, downloading a clean toybox git repo, "make defconfig &&
> make" reproduces the segfault, so at least it's not Android-specific.
> posting early in case anyone's already debugged this...

FYI I had a test wrong in the config parser. It was triggered by
configuring out a command line option that was the last (leftmost) short
option in a config that also had bare longopts.

The option parsing gets an option string for the current config, and
another option string for allyesconfig (so it can stick in #define
FLAG_switchedoff 0" for the disabled stuff). It parses each one into its
own linked list (flist for flag list, alist for allyesconfig flag list),
and then traverses the two lists together comparing them to see whether
a config entry is enabled or disabled.

When it got to the above case, flist wasn't NULL because there were
still longopts, but flist->command was null because those longopts
weren't an alias for a shortopt. (They were bare --longopts with no
corresponding -x shortopt.)

The segfaulting line was:

if (flist && (alist->command && *flist->command==*alist->command))

Which is wrong because flist->command was NULL and got dereferenced. The
middle test there should be flist->command, not alist->command. (You
should never have alist->command null when flist->command isn't, because
allyesconfig should never be _missing_ anything that's in the current
config.)

So yeah, strightforward outright bug. Just took a bit to track down. Fix
checked in now.

Rob

 1430677662.0


More information about the Toybox mailing list