[Mono-bugs] [Bug 55347][Maj] New - Directory.Copy(srcPath,destPath) & Copy(srcPath,destPath,true/false) does not throw PathTooLongException
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 9 Mar 2004 05:37:10 -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=55347
--- shadow/55347 2004-03-09 05:37:10.000000000 -0500
+++ shadow/55347.tmp.28576 2004-03-09 05:37:10.000000000 -0500
@@ -0,0 +1,143 @@
+Bug#: 55347
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 8.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: nrathna@novell.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Directory.Copy(srcPath,destPath) & Copy(srcPath,destPath,true/false) does not throw PathTooLongException
+
+Description of Problem:
+Directory.Copy(srcPath,destPath) & Copy(srcPath,destPath,true/false) does
+not throw PathTooLongException
+
+Steps to reproduce the problem:
+1. call Directory.Copy(srcPath,destPath) & Copy
+(srcPath,destPath,true/false) with src/dest path having more than 286 chars
+
+string path ="abcdefghijklmnopqrstuvwxyz"
+path=path+path+path+path+path+path+path+path+path+path+path;
+
+[Test]
+ [ExpectedException(typeof(PathTooLongException))]
+ public void FileCopySrcLong(){
+ string destDir ="smallPath";
+ try
+ {
+ File.Copy(path,destDir);
+ }
+ finally
+ {
+ DeleteDirectory(destDir);
+ }
+ }
+
+
+ [Test]
+ [ExpectedException(typeof(PathTooLongException))]
+ public void FileCopyDestLong(){
+ string srcDir ="smallPath";
+ try
+ {
+ File.Copy(srcDir,path);
+ }
+ finally
+ {
+ DeleteFile(srcDir);
+ }
+ }
+
+ [Test]
+ [ExpectedException(typeof(PathTooLongException))]
+ public void FileCopySrcLongFalse(){
+ string destDir ="smallPath";
+ try
+ {
+ File.Copy(path,destDir, false);
+ }
+ finally
+ {
+ DeleteDirectory(destDir);
+ }
+ }
+ [Test]
+ [ExpectedException(typeof(PathTooLongException))]
+ public void FileCopySrcLongTrue(){
+ string destDir ="smallPath";
+ try
+ {
+ File.Copy(path,destDir, true);
+ }
+ finally
+ {
+ DeleteDirectory(destDir);
+ }
+ }
+
+ [Test]
+ [ExpectedException(typeof(PathTooLongException))]
+ public void FileCopyDestLongFalse(){
+ string srcDir ="smallPath";
+ try
+ {
+ File.Copy(srcDir,path, false);
+ }
+ finally
+ {
+ DeleteFile(srcDir);
+ }
+ }
+ [Test]
+ [ExpectedException(typeof(PathTooLongException))]
+ public void FileCopyDestLongTrue(){
+ string srcDir ="smallPath";
+ try
+ {
+ File.Copy(srcDir,path,true);
+ }
+ finally
+ {
+ DeleteFile(srcDir);
+ }
+ }
+
+Actual Results:
+throws FileNotFoundException
+
+Expected Results:
+Should throw PathTooLongException
+
+How often does this happen?
+Continous
+
+Additional Information:
+Should check for the path length
+
+
+Stack Trace :
+
+in [0x0009f]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.IO/File.cs:52)
+System.IO.File:Copy (string,string,bool)
+in <0x00026>
+MonoTests.System.IO.PathTooLongExceptionTest:FileCopyDestLongFalse ()
+in (unmanaged) /usr/local/lib/libmono.so.0 [0x4004415b]
+in (unmanaged) /usr/local/lib/libmono.so.0(mono_runtime_invoke+0x23)
+[0x4007db9f]
+in (unmanaged) /usr/local/lib/libmono.so.0
+(mono_runtime_invoke_array+0x119) [0x4007e8f1]
+in (unmanaged) /usr/local/lib/libmono.so.0 [0x400848d4]
+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)