[Mono-bugs] [Bug 55160][Maj] New - Directory.cs -> delete(path,true) does not throw PathTooLongException
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 4 Mar 2004 10:28:19 -0500 (EST)
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 nrathna@novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=55160
--- shadow/55160 2004-03-04 10:28:19.000000000 -0500
+++ shadow/55160.tmp.23714 2004-03-04 10:28:19.000000000 -0500
@@ -0,0 +1,145 @@
+Bug#: 55160
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 8.0
+OS Details:
+Status: NEW
+Resolution:
+Severity: Unknown
+Priority: Major
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: nrathna@novell.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Directory.cs -> delete(path,true) does not throw PathTooLongException
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. try deleting a directory with path having 286 chars or u can use the
+below code snippet
+
+//CODE SNIPPET BEGIN
+using NUnit.Framework;
+using System;
+using System.IO;
+
+namespace MonoTests.System.IO
+{
+ [TestFixture]
+
+ //Testing Directory Class with Maximum chars - 286 chars considered
+
+ public class PathTooLongExceptionTest: Assertion
+ {
+ string TempFolder = Path.Combine (Path.GetTempPath
+(), "MonoTests.System.IO.Tests/");
+ string path ;
+
+ [SetUp]
+ protected void SetUp() {
+ path ="abcdefghijklmnopqrstuvwxyz";
+
+ DeleteDirectory (TempFolder);
+ CreateDirectory (TempFolder);
+ DeleteDirectory(path);
+
+ path=path+path+path+path+path+path+path+path+path+path+path;
+
+ }
+
+ [TearDown]
+ protected void TearDown() {
+ DeleteDirectory(TempFolder);
+ DeleteDirectory(path);
+ }
+
+
+ [Test]
+ // [ExpectedException (typeof (PathTooLongException))]
+ public void DirectoryDeleteDirRecursTrue()
+ {
+ try
+ {
+ Directory.Delete(path,true);
+ }
+ finally {}
+ }
+
+ private void CreateDirectory(string path)
+ {
+ if (!Directory.Exists (path))
+ Directory.CreateDirectory(path);
+ }
+
+ private void DeleteDirectory (string path)
+ {
+ if (Directory.Exists (path))
+ Directory.Delete (path, true);
+ }
+
+}
+//CODE SNIPPET END
+
+
+Actual Results:
+returns DirectoryNotFoundException
+
+//TRACE BEGIN
+MonoTests.System.IO.PathTooLongExceptionTest.DirectoryDeleteDirRecursTrue :
+ System.IO.DirectoryNotFoundException :
+Directory 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl
+mnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi
+jklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef
+ghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
+not found.
+
+in [0x000d1]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.IO/Directory.cs:371)
+System.IO.Directory:GetFileSystemEntries
+(string,string,System.IO.FileAttributes,System.IO.FileAttributes)
+in [0x00006]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.IO/Directory.cs:198)
+System.IO.Directory:GetDirectories (string,string)
+in [0x00006]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.IO/Directory.cs:193)
+System.IO.Directory:GetDirectories (string)
+in [0x00001]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.IO/Directory.cs:111)
+System.IO.Directory:RecursiveDelete (string)
+in [0x00018]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.IO/Directory.cs:129)
+System.IO.Directory:Delete (string,bool)
+in <0x0002a>
+MonoTests.System.IO.PathTooLongExceptionTest:DirectoryDeleteDirRecursTrue
+()
+in (unmanaged) /usr/local/lib/libmono.so.0 [0x40043d53]
+in (unmanaged) /usr/local/lib/libmono.so.0(mono_runtime_invoke+0x23)
+[0x4007c763]
+in (unmanaged) /usr/local/lib/libmono.so.0
+(mono_runtime_invoke_array+0x119) [0x4007d4b5]
+in (unmanaged) /usr/local/lib/libmono.so.0 [0x4008344c]
+in [0x00033]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.Reflection/MonoMethod.cs:9
+8) System.Reflection.MonoMethod:Invoke
+(object,System.Reflection.BindingFlags,System.Reflection.Binder,object
+[],System.Globalization.CultureInfo)
+
+//TRACE END
+
+
+Expected Results:
+Should throw PathTooLongException
+
+
+How often does this happen?
+Continuous
+
+Additional Information:
+Check for range or max length is not done