[Mono-bugs] [Bug 318853] UnixDriveInfo broken

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 3 14:28:28 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=318853#c3


Jonathan Pryor <jonpryor at vt.edu> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |jonpryor at vt.edu




--- Comment #3 from Jonathan Pryor <jonpryor at vt.edu>  2007-10-03 12:28:28 MST ---
As mentioned on 2005-09-01, UnixDriveInfo is layered atop POSIX, and POSIX
doesn't support what you want (afaik, please direct me to the appropriate POSIX
APIs if I'm wrong).

So, UnixDriveInfo.IsReady returns `true' for unmounted filesystems because
there's still a filesystem on the unmounted directory, the filesystem for the
parent directory.  (Example: statvfs("/tmp", &statvfsbuf) is still valid, and
if /tmp isn't a separate filesystem it'll return information about the /
filesystem.)

A sane workaround, I suppose, would be for UnixDriveInfo.IsReady to _also_ get
the Statvfs info for the parent directory, and compare the Statvfs.f_fsid
fields between the "mount point" and the parent directory; if they're the same,
then they should be the same filesystem and thus IsReady should return false. 
(Pity I didn't think of this until now...)

However, I'm not sure if this f_fsid comparison is actually sane (I haven't
tried it).  Opinions?

That leaves UnixDriveInfo.GetDrives() not returning all drives.  This is
currently impossible, as GetDrives() is implemented by using getfsent(3), which
reads e.g. /etc/fstab and /etc/mtab.  If the drive isn't mounted, and isn't
listed in /etc/fstab, there is no POSIX-portable way (that I know of) to know
that the drive exists.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list