[Mono-bugs] [Bug 79733][Maj] New - Nasty recursive directory delete behaviour with symlinks

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Oct 24 14:11:15 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 colin at breame.net.

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

--- shadow/79733	2006-10-24 14:11:15.000000000 -0400
+++ shadow/79733.tmp.7925	2006-10-24 14:11:15.000000000 -0400
@@ -0,0 +1,57 @@
+Bug#: 79733
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: colin at breame.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Nasty recursive directory delete behaviour with symlinks
+
+When using Directory.Delete(path, true) the contents of symlink'd 
+directories are deleted and an exception is thrown[1].
+
+Consider the directory layout:
+.
+|-- test
+|   `-- test1 -> ../test1
+`-- test1
+    `-- hello
+
+After running the testcase[2] (which does a Directory.Delete("test", 
+true)), you get:
+
+.
+|-- test
+|   `-- test1 -> ../test1
+`-- test1
+
+and the exception[1].
+
+I believe this to not only be wrong but dangerous.
+
+[1]:
+Unhandled Exception: System.IO.DirectoryNotFoundException: 
+Directory 'test/test1' doesnt exists.
+  at System.IO.Directory.Delete (System.String path) [0x00000]
+  at System.IO.Directory.RecursiveDelete (System.String path) [0x00000]
+  at System.IO.Directory.RecursiveDelete (System.String path) [0x00000]
+  at System.IO.Directory.Delete (System.String path, Boolean recurse) 
+[0x00000]
+  at test_t.Main () [0x00000]
+
+[2]:
+Please see attachment.
+public class test_t {
+        public static void Main() {
+                System.IO.Directory.Delete("test", true);
+        }
+}


More information about the mono-bugs mailing list