[Mono-bugs] [Bug 513477] New: DriveInfo TotalSize, AvailableFreeSpace, TotalFreeSpace returns wrong values

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jun 16 05:59:45 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=513477


           Summary: DriveInfo TotalSize, AvailableFreeSpace,
                    TotalFreeSpace returns wrong values
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: PC
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: marc.gur at continental-corporation.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=298345)
 --> (http://bugzilla.novell.com/attachment.cgi?id=298345)
project

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 2.0.50727; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR
3.5.30729)


When running code snippet below

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace fstest
{
    class Program
    {
        static void Main(string[] args)
        {
            foreach (DriveInfo info in DriveInfo.GetDrives())
            {
                try
                {
                    Console.WriteLine("{0} total {1} totalFree {2} Available
{3} ({4}%)", info.Name, info.TotalSize, info.TotalFreeSpace,
info.AvailableFreeSpace, (int)((float)info.TotalFreeSpace/info.TotalSize*100));
                }
                catch(System.Exception) {}
            }
            Console.WriteLine("End of enumeration");
        }
    }
}




DriveInfo TotalSize, AvailableFreeSpace, TotalFreeSpace returns wrong values :
either long.MaxValue , either 0.




Reproducible: Always

Steps to Reproduce:
1. Run the attached C# program
2. 
3.
Actual Results:  
/sys total 9223372036854775807 totalFree 0 Available 0 (0%)
/proc total 9223372036854775807 totalFree 0 Available 0 (0%)
/dev total 9223372036854775807 totalFree 0 Available 0 (0%)
/ total 9223372036854775807 totalFree 9223372036854775807 Available
9223372036854775807 (100%)
/lib/init/rw total 9223372036854775807 totalFree 0 Available 0 (0%)
/sys/fs/fuse/connections total 9223372036854775807 totalFree 0 Available 0 (0%)
/var/run total 9223372036854775807 totalFree 0 Available 0 (0%)
/var/lock total 9223372036854775807 totalFree 0 Available 0 (0%)
/lib/modules/2.6.28-11-generic/volatile total 9223372036854775807 totalFree 0
Available 0 (0%)
/dev/shm total 9223372036854775807 totalFree 0 Available 0 (0%)
/dev/pts total 9223372036854775807 totalFree 0 Available 0 (0%)
/sys/kernel/security total 9223372036854775807 totalFree 0 Available 0 (0%)
/proc/sys/fs/binfmt_misc total 9223372036854775807 totalFree 0 Available 0 (0%)
/home/marcgur/.gvfs total 9223372036854775807 totalFree 0 Available 0 (0%)
/media/MEMORYBIRD total 9223372036854775807 totalFree 9223372036854775807
Available 9223372036854775807 (100%)
End of enumeration

Expected Results:  
on MEMORYBIRD (a 512 MB USB key) we should get
total 518742016 totalFree 48136192 Available 48136192 (9%)

on the hard drive (where all other "logical drives" are located), there is 14.9
GB free, and 3.4 GB used.


host Linux version : Ubuntu 9.04 (Jaunty), kernel 2.6.28.11 - generic, GNOME
2.26.1

Running the same project on PC on WindowsXP SP2 (with MonoDevelop 2.1.0) works
perfectly.

-- 
Configure bugmail: http://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