[Mono-bugs] [Bug 643910] New: DriveInfo.GetDrives returns incorrect values

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Oct 5 14:55:26 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=643910

https://bugzilla.novell.com/show_bug.cgi?id=643910#c0


           Summary: DriveInfo.GetDrives returns incorrect values
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: jbevain at novell.com
        ReportedBy: johnl at johnlabovitz.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=393154)
 --> (http://bugzilla.novell.com/attachment.cgi?id=393154)
Test code (example code from MS's site), and patch to fix the problem.

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us)
AppleWebKit/534.10+ (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5

When calling DriveInfo.GetDrives(), the returned DriveInfo object contains
values that are vastly different than the actual values from the system.

I've attached both a test file and a patch (originally done on a nightly
tarball, but applied to 2.6.7).

Reproducible: Always

Steps to Reproduce:
1. Call DriveInfo.GetDrives()
2. Enumerate through each drive as a DriveInfo object.
3. Examine AvailableFreeSpace, TotalFreeSpace, TotalSize members.
4. Compare against actual system values.



The problem seems to be an assumption that statvfs() and statfs() are
compatible, and that the structs they return are interchangeable. This is not
correct. On Mac OS X 10.6 at least, statvfs() returns the block size in the
f_frsize member, where statfs() returns it in the f_bsize member.

I fixed it in the patch by defining a new variable to save the effective block
size. I ran into problems getting the values expressed correctly in
64-integers, so I also added a cast to solve that.

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


More information about the mono-bugs mailing list