Richard W.M. Jones wrote:
 On Wed, Aug 12, 2009 at 10:14:51AM +0200, Jim Meyering wrote:
> Here's one final (I hope) question without a complete patch.
> Given that I already ensure that stubs.c invokes
> REQUIRE_ROOT_OR_RESOLVE_DEVICE just before calling do_umount,
> does this new version of do_umount look ok?
>
> /* Again, use the external /bin/umount program, so that /etc/mtab
>  * is kept updated.
>  */
> int
> do_umount (const char *pathordevice)
> {
>   int r;
>   char *err;
>
>   char *buf = sysroot_path (pathordevice);
>   if (buf == NULL) {
>     reply_with_perror ("malloc");
>     return -1;
>   }
 I think the problem here is you'll end up with a buf like
 '/sysroot/dev/vda'.
 In the original code:
   if (strncmp (pathordevice, "/dev/", 5) == 0) {
     buf = pathordevice;
     IS_DEVICE (buf, -1);
   } else {
     buf = sysroot_path (pathordevice);
     if (buf == NULL) {
       reply_with_perror ("malloc");
       return -1;
     }
     freeit = 1;
   }
 it avoids prefixing /dev paths.
 If Pathname args turn into two parameters (the original path, and the
 sysroot-prefixed path), then maybe Pathname_or_device args should turn
 into several parameters too, like:
   int is_device, const char *original_pathordevice, const char *sysroot_pathordevice
 (That's just an idea ...  maybe not a good one) 
If do_umount is the only case like that (and it seems to be),
a more local change is possible: if pathordevice starts with
/sysroot/dev, remove the "/sysroot" part.
Not terribly pretty to add the prefix, and then to remove it
right afterwards, but...