drivemount_applet brokenness



Hi there...

The logic the drivemount_applet uses for the "non autofs-friendly" is_mounted check is flawed:


      {
      gint b, p;
      b = get_device(dd->mount_base);
      p = get_device(dd->mount_point);
      if (b == p || p == -1 || b == -1)
              return FALSE;
      else
              return TRUE;
      }

dd->mount_base is always set to "/mnt".

This code will only work if (a) Your system conforms perfectly to the FHS and you only mount things in subdirectories of /mnt, and (b) you don't mount anything on /mnt itself. The first of these assumptions is broken on debian linux systems by default:
Debian creates /floppy and /cdrom mount points for floppies and cdroms, leaving /mnt free for other mounts.

The logic here will obviously fail if your floppy mount point is /floppy and you mount something else (like a different hard drive partition) on /mnt.

The problem I have here is that I can't determine what the correct behaviour should be. I can think up several solutions:
1) Remove the non-autofs friendly mount check from the code. I think this is the correct solution - possibly checking /etc/mtab instead would be equally good (is this portable?).
2) Allow mount_base to be configurable. Probably next best.
3) Set mount_base to be "/", always. Not so good.
4) Set mount_base to be mount_point + "/..". This looks good to me...

Suggestions? At the moment, the applet needs fixing...

=)
Peter




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]