[Mono-bugs] [Bug 575813] New: FileStream doesn't handle errors on Close (disk full, generic error, etc.)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Feb 1 12:27:22 EST 2010


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

http://bugzilla.novell.com/show_bug.cgi?id=575813#c0


           Summary: FileStream doesn't handle errors on Close (disk full,
                    generic error, etc.)
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: alexander.shulgin at yessoftware.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.5
(KHTML, like Gecko) Chrome/4.0.249.43 Safari/532.5

When writing to a FileStream or using File.WriteAll* methods, or otherwise
writing data to a file, if a error condition occurs at the point close(2)
system call it is silently ignored.  The trailing data in the file is lost.

The error can happen on conditions like "disk is full", exceeding user's quota,
etc.


Reproducible: Always

Steps to Reproduce:
One way to expose this (on Linux):

$ dd if=/dev/zero of=vdisk bs=1024 count=1000
$ mkfs.vfat ./vdisk
$ mkdir mnt
$ sudo -s

# mount -o loop,defaults ./vdisk ./mnt
# csharp

csharp> var bytes = new byte[1024*1024];
csharp> bytes.Length;
1048576
csharp> System.IO.File.WriteAllBytes("test", bytes);
^D

# ls -l
total 980
-rwxr-xr-x 1 root root 1003520 2010-02-01 16:30 test

So not all the data is written to disk and no error message is given.  I'd
expect some diagnostics from Mono (in form of exception) in this case.

The root cause for this seems to be that close(2) return value is ignored in
void file_close() in mono/io-layer/io.c.

The problem must also happen with SVN trunk, as this function is unchanged from
2.4.

-- 
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