[Mono-bugs] [Bug 78239][Min] Changed - Directory.Exists() wrongly throwing exception when access is denied

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon May 1 11:56:13 EDT 2006


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 robertj at gmx.net.

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

--- shadow/78239	2006-04-29 19:55:50.000000000 -0400
+++ shadow/78239.tmp.31560	2006-05-01 11:56:13.000000000 -0400
@@ -52,6 +52,36 @@
 should it be done? The only way I can think of is using
 Mono.Unix.Native.Syscall.chmod in the test suite, which would break
 the compile for .NET systems
 
 Or am I misunderstanding how this works? I am aware of the NotDotNet
 category thing but don't think that would cut it..?
+
+------- Additional Comments From robertj at gmx.net  2006-05-01 11:56 -------
+Daniel, it's easier to use the shell that reflecting
+on Mono.Posix. At least for a simple test case.
+
+[Test]
+[Category("NotDotNet")]
+void Bug_78239 ()
+{
+    string dir = Path.Combine (Path.GetTempPath (),
+Guid.NewGuid.ToString ("N"));
+
+    RunCmd ("/bin/chmod", String.Format ("000 {0}", dir));
+
+    try {
+
+       Assert whatever ...
+
+    } finally {
+        // clean up
+        RunCmd ("/bin/chmod", String.Format ("777 {0}", dir));
+        Directory.Delete (dir);
+    }
+}
+
+static void RunCmd (string cmd, string args)
+{
+    System.Diagnostics.Process.Start (cmd, args).WaitForExit ();
+}
+


More information about the mono-bugs mailing list