[BusyBox] My mount rewrite.

Rob Landley rob at landley.net
Wed Feb 9 04:43:53 UTC 2005


On Tuesday 08 February 2005 09:51 am, Tito wrote:
> On Tuesday 08 February 2005 07:18, Rob Landley wrote:
> > Okay, it builds again, and seems to work.  It needs one more cleanup
> > pass, but here it is in case anybody wants to point and laugh in the
> > meantime.
>
> snip
>
> > Oh yeah, and it should now accept --bind and --move syntax (and for that
> > matter --remount and any other thing you could pass with -o).
>
> Hi, Rob,
> I discovered a little problem in your new mount:

Not at all suprising.  It's still pink in the center, as it were.  (The 
changes to the TODO file shouldn't be in there, some commented out code 
should be cleaned up, the comment at the end of mount.c probably needs to 
turn into a checkin comment or something, I need to do SOMETHING intelligible 
with loop.c...)

> If you use both --options and -o something you get a segfault:
> ./busybox mount -o rw -t ext3 /dev/fd0 /mnt/floppy --remount
> Segmentation fault (core dumped)
>
> ./busybox mount -o rw -t ext3 /dev/fd0 /mnt/floppy --bind
> Segmentation fault (core dumped)
>
> ( I know that the examples make not much sense......)

I reproduced it with "./busybox mount --realloc -o rw", it's the parsing that 
went "boing"...

Sigh.  The first fix is to change the for loop in parse_mount_options() to 
read:
        for(i=0;i<sizeof(mount_options)/sizeof(*mount_options);i++) {

Since sizeof() returns bytes, not array elements.  Ahem.  Right.

The _second_ fix is in mount_mount, where I need to change:
  argv[opt]=0;
to:
    argc=opt;

Thanks for the bug report, dunno how I missed that.  (It worked at some point, 
before I broke it.)  I'll try to whip up a new (somewhat cleaned up) patch 
tomorrow.

Rob



More information about the busybox mailing list