(fwd) busybox mount -a fix.

Rob Landley rob at landley.net
Sat Jun 24 22:33:57 UTC 2006


On Wednesday 21 June 2006 12:17 pm, Paul Fox wrote:
> the tricky part is that any EBUSY error will cause "mount -a" to
> always report success.  so if you have an fstab with one entry
> that's already mounted, and another that can't be mounted (e.g.,
> non-existent mountpoint), you'll get success.  (and since most
> fstabs usually contain at least one entry that's already mounted,
> what we usually see from "mount -a" is success.)

Is this still a problem after svn 15455?

Rob

> except that i believe it's broken now.  now the mount exit code
> is indistinguishably either a count of failed mounts, or an
> errno.

For -a it's a count of failed mounts.  Without -a, it's an errno.  What's 
indistinguishable about this, you don't know whether you passed in -a?

You can't return an errno for -a because you could have different mounts fail 
for different reasons, and a count for the non-a case is always going to 
be "1".

In both cases, zero is success.

> this was part of the confusion that was cleaned up considerably 
> by adding the additional singlemount/do_singlemount layer in
> the original patch.  i really think it was cleaner that way, than
> with all the gotos, but if that's what you prefer, here's one
> more patch.  also makes the exit code more manpage-compatible.
> (you've spent so much time trying to make mount "right", seems a
> shame to stop now.  :-)

I looked at that, but there are a _seven_ different mount return code bits and 
saying that we support 2 of those 7 flags is a bit silly.  Also, there's the 
problem you just bumped into:

> -	return rc;
> +	return rc ? 32 : 64;

This means you're returning nonzero if nothing failed.  Is that really what 
you want to do?  You have to distinguish "no mounts failed", "some mounts 
failed", and "all mounts failed", and the current code doesn't, and as long 
as I was restructuring it to handle that I thought I might as well return the 
count of failures, which is actually _more_ information than the other one 
gives.  (Neither return code can tell you _which_ mounts failed, which is 
generally the interesting info.)

> +	if (rc == 64) rc = 0; /* had nothing but success */

Ah, I see you're doing it at another level.

So you want to support bits 32 and 64, but not bits 1, 2, 4, 8, or 16?  Why do 
bits 32 and 64 make sense in isolation?

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list