[Mono-bugs] [Bug 55355][Maj] New - File.Open(path,FileMode) does not throw PathTooLongException
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 9 Mar 2004 08:12:43 -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=55355
--- shadow/55355 2004-03-09 08:12:43.000000000 -0500
+++ shadow/55355.tmp.31500 2004-03-09 08:12:43.000000000 -0500
@@ -0,0 +1,140 @@
+Bug#: 55355
+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: File.Open(path,FileMode) does not throw PathTooLongException
+
+Description of Problem:
+File.Open(path,FileMode) does not throw PathTooLongException
+
+Steps to reproduce the problem:
+1. call File.Open(path,FileMode) with 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 FileOpenAppend()
+ {
+ try
+ {
+ FileStream fStream = File.Open
+(path,FileMode.Append);
+ }
+ finally {}
+ }
+
+ [Test]
+ [ExpectedException (typeof (PathTooLongException))]
+ public void FileOpenCreate()
+ {
+ try
+ {
+ FileStream fStream = File.Open
+(path,FileMode.Create);
+ }
+ finally {}
+ }
+
+ [Test]
+ [ExpectedException (typeof (PathTooLongException))]
+ public void FileCreateNew()
+ {
+ try
+ {
+ FileStream fStream = File.Open
+(path,FileMode.CreateNew);
+ }
+ finally {}
+ }
+
+ [Test]
+ [ExpectedException (typeof (PathTooLongException))]
+ public void FileOpen()
+ {
+ try
+ {
+ FileStream fStream = File.Open
+(path,FileMode.Open);
+ }
+ finally {}
+ }
+
+ [Test]
+ [ExpectedException (typeof (PathTooLongException))]
+ public void FileOpenOrCreate()
+ {
+ try
+ {
+ FileStream fStream = File.Open
+(path,FileMode.OpenOrCreate);
+ }
+ finally {}
+ }
+
+ [Test]
+ [ExpectedException (typeof (PathTooLongException))]
+ public void FileTruncate()
+ {
+ try
+ {
+ FileStream fStream = File.Open
+(path,FileMode.Truncate);
+ }
+ finally {}
+ }
+ }
+Actual Results:
+throws ArgumentException
+
+Expected Results:
+Should throw PathTooLongException
+
+How often does this happen?
+Continous
+
+Additional Information:
+Should check for the path length before passing it to a method
+
+Stack Trace:
+
+in [0x000e6]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.IO/FileStream.cs:114)
+System.IO.FileStream:.ctor
+(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,boo
+l)
+in [0x0000c]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.IO/FileStream.cs:74)
+System.IO.FileStream:.ctor
+(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
+in <0x00081> (wrapper remoting-invoke-with-check)
+System.IO.FileStream:.ctor
+(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
+in [0x00004]
+(at /home/rathna/monoCVS/mcs/class/corlib/System.IO/File.cs:246)
+System.IO.File:Open (string,System.IO.FileMode)
+in <0x0001c> MonoTests.System.IO.PathTooLongExceptionTest:FileOpenAppend ()
+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)