[Mono-bugs] [Bug 80701][Nor] New - File can be deleted while opened

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Feb 1 19:37:25 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by gert.driesen at pandora.be.

http://bugzilla.ximian.com/show_bug.cgi?id=80701

--- shadow/80701	2007-02-01 19:37:25.000000000 -0500
+++ shadow/80701.tmp.12647	2007-02-01 19:37:25.000000000 -0500
@@ -0,0 +1,56 @@
+Bug#: 80701
+Product: Mono: Runtime
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: io-layer
+AssignedTo: dick at ximian.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: File can be deleted while opened
+
+If a file is opened using a FileStream with FileShare.Read, then that file 
+can still be deleted (using File.Delete).
+
+To reproduce, compile and run the following code snippet:
+
+using System;
+using System.IO;
+
+public class Test
+{
+  [STAThread]
+  static void Main (string [] args)
+  {
+    using (FileStream fs = new FileStream ("tmp.txt", FileMode.Create, 
+      FileAccess.Write, FileShare.Read)) {
+      fs.WriteByte (5);
+      fs.Close ();
+    }
+
+    FileStream fs2 = new FileStream ("tmp.txt", FileMode.Open, 
+      FileAccess.Read, FileShare.Read);
+    File.Delete ("tmp.txt");
+  }
+}
+
+Expected result:
+
+IOException reporting a sharing violation
+
+Actual result:
+
+No error.
+
+Important:
+Fixing this issue might (will) introduce test failures on Linux
+
+Note:
+It works fine on Windows.


More information about the mono-bugs mailing list