[Mono-bugs] [Bug 37755][Nor] New - Wrong behaviour in several System.IO.Directory and System.IO.DirectoryInfo methods
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Sat, 8 Feb 2003 11:08:33 -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 gontanon@able.es.
http://bugzilla.ximian.com/show_bug.cgi?id=37755
--- shadow/37755 Sat Feb 8 11:08:33 2003
+++ shadow/37755.tmp.31644 Sat Feb 8 11:08:33 2003
@@ -0,0 +1,99 @@
+Bug#: 37755
+Product: Mono/Class Libraries
+Version: unspecified
+OS: other
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: gontanon@able.es
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Wrong behaviour in several System.IO.Directory and System.IO.DirectoryInfo methods
+
+The Directory and DirectoryInfo classes behave in a way that seems wrong to
+me. These are the issues I've found:
+
+DirectoryInfo.Name returns an empty string if the string from which I
+created the DirectoryInfo object ends in a '/', it returns the actual name
+if the string is the same but does not end in a '/'.
+
+Directory.Move() and DirectoryInfo.MoveTo() always cause an
+FileNotFoundException, no matter whether the directory actually existed or not.
+
+Steps to reproduce the problem:
+1. Create a directory named "/tmp/testdir/
+2. Run the following code:
+
+using System.IO;
+using System;
+
+
+public class DirectoryTest {
+ public static void Main() {
+ /* /tmp/testdir/ has been created previously */
+ string path = "/tmp/testdir/";
+ bool b = Directory.Exists(path);
+ Console.WriteLine("Exists(): " + b);
+ DirectoryInfo dir = new DirectoryInfo(path);
+ Console.WriteLine("dir.Name: " + dir.Name);
+ Console.WriteLine("dir.FullName: " + dir.FullName);
+ dir.MoveTo("/tmp/testdirmoved");
+ }
+}
+
+Actual Results:
+
+The output produced by the code above is the following:
+
+$ ./DirectoryTest.exe
+Exists(): True
+dir.Name:
+dir.FullName: /tmp/testdir/
+
+Unhandled Exception: System.IO.FileNotFoundException: /tmp/testdir/ does
+not exist
+in <0x0021a> 00 System.IO.File:Move (string,string)
+in <0x00043> 00 System.IO.DirectoryInfo:MoveTo (string)
+in <0x00154> 00 .DirectoryTest:Main ()
+
+Expected Results:
+
+I expected this output, plus having the directory name being changed to
+/tmp/testdirmoved/:
+
+$ ./DirectoryTest.exe
+Exists(): True
+dir.Name: testdir
+dir.FullName: /tmp/testdir/
+
+
+How often does this happen?
+
+Always
+
+
+Additional Information:
+
+I'm running these versions of the mono packages for Debian 3.0 on x86:
+
+$ dpkg -l libmono-dev mono-assemblies mono-common mono-interpreter mono-jit
+mono-mcs mono-utils
+
+Desired=Unknown/Install/Remove/Purge/Hold
+| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
+|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
+||/ Name Version Description
++++-===============-===============-==============================================
+ii libmono-dev 0.19-1 Mono libraries - Development files
+ii mono-assemblies 0.19-1 the Mono .NET class libraries
+ii mono-common 0.19-1 common files for the Mono CLI runtimes
+ii mono-interprete 0.19-1 the Mono interpreter
+ii mono-jit 0.19-1 a .NET runtime environment
+ii mono-mcs 0.19-1 the Mono C# compiler
+ii mono-utils 0.19-1 Mono utilities