making "test" an ash built-in

Rob Landley rob at landley.net
Sun Jun 11 15:46:09 UTC 2006


On Thursday 08 June 2006 6:06 pm, Jason Schoon wrote:
> On 6/8/06, Paul Fox <pgf at brightstareng.com> wrote:
> > oh, one more thing i forgot to mention:
> >
> > CONFIG_FEATURE_SH_STANDALONE_SHELL, which causes applets to be
> > found before commands in the filesystem, also causes them to be
> > found before shell builtins.  (i consider this a bug.)
> >
> > if you have it on, you'll never run the "test" or "echo"
> > builtin -- you'll run them in applet form -- and you won't get
> > the performance gain.
> >
> > (note it's turned on by "make defconfig".)
>
> I'm not sure if this was something specific to my environment or not, but I
> was unable to get switch_root to work when I had STANDALONE_SHELL enabled.

Details?  It's almost certainly this code:

    if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs) ||
        (stfs.f_type != RAMFS_MAGIC && stfs.f_type != TMPFS_MAGIC) ||
        getpid() != 1)
    {
        bb_error_msg_and_die("not rootfs");
    }

And what that sounds like is the shell "exec" command isn't working properly 
when standalone shell is enabled.  (You have to exec switch_root or it 
complains it's not PID 1.  I've thought about improving the error reporting 
so it says _which_ sanity test failed, but that inevitably makes it 
bigger...)

Which shell were you doing this from, by the way?

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list