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

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Apr 13 22:56:57 EDT 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 dsilva at ccs.neu.edu.

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

--- shadow/80701	2007-02-03 18:28:05.000000000 -0500
+++ shadow/80701.tmp.15878	2007-04-13 22:56:57.000000000 -0400
@@ -64,6 +64,52 @@
 
 ------- Additional Comments From miguel at ximian.com  2007-02-03 18:28 -------
 The support was only partial, and it is too expensive to emulate.
 
 Try the strict emulation (its some environment variable documented in
 the man page).
+
+------- Additional Comments From dsilva at ccs.neu.edu  2007-04-13 22:56 -------
+This behavior is still confusing.  Here's an IronPython session under
+Mono:
+
+>>> os.getenv("MONO_STRICT_IO_EMULATION")
+>>> os.getenv("MONO_STRICT_IO_EMULATION") is None
+True
+>>> f1 = open("/tmp/test1","w")
+>>> f2 = open("/tmp/test1", "r")
+>>> f3 = open("/tmp/test1", "w")
+>>> f1
+<open file '/tmp/test1', mode 'w' at 0xFCFEE100>
+>>> f4 = System.IO.File.Open("/tmp/test1",System.IO.FileMode.Write)
+Traceback (most recent call last):
+AttributeError: type object 'FileMode' has no attribute 'Write'
+>>> f4 = System.IO.File.Open("/tmp/test1",System.IO.FileMode.Append)
+Traceback (most recent call last):
+  File mscorlib, line unknown, in Open
+  File mscorlib, line unknown, in .ctor
+  File mscorlib, line unknown, in .ctor
+IOError: Sharing violation on path /tmp/test1
+>>> f4 = System.IO.File.Open("/tmp/test2",System.IO.FileMode.Append)
+>>> f5 = System.IO.File.Open("/tmp/test2",System.IO.FileMode.Append)
+Traceback (most recent call last):
+  File mscorlib, line unknown, in Open
+  File mscorlib, line unknown, in .ctor
+  File mscorlib, line unknown, in .ctor
+IOError: Sharing violation on path /tmp/test2
+>>> f6 = open("/tmp/test2", "r")
+Traceback (most recent call last):
+  File mscorlib, line unknown, in .ctor
+  File mscorlib, line unknown, in .ctor
+IOError: Sharing violation on path /tmp/test2
+
+
+Why are files only locked sometimes?  Or why are they being locked at
+all under unix?  There's still no guarantee that the file won't
+change, since the OS isn't locking the file as Win32 does -- you can
+still modify and/or delete the file from unix itself.  Note also that
+this is all being checked dynamically, so there's not even any safety
+benefit from static analysis.
+
+The environment variable MONO_STRICT_IO_EMULATION was not set either.
+ Maybe there could be a MONO_IO variable that can be set to
+POSIX/unix/native or Win32?


More information about the mono-bugs mailing list