[Mono-bugs] [Bug 76903][Nor] New - DirectoryInfo.Name gives incorrect results

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Dec 3 07:00:57 EST 2005

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 jbytheway at gmail.com.


--- shadow/76903	2005-12-03 07:00:57.000000000 -0500
+++ shadow/76903.tmp.28702	2005-12-03 07:00:57.000000000 -0500
@@ -0,0 +1,81 @@
+Bug#: 76903
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: Debian etch
+Status: NEW   
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: jbytheway at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: DirectoryInfo.Name gives incorrect results
+I'm using the mono packages from Debian/testing:
+$ mcs --version
+Mono C# compiler version
+$ mono --version
+Mono JIT compiler version, (C) 2002-2005 Novell, Inc and
+Contributors. www.mono-project.com
+        TLS:           normal
+        GC:            Included Boehm (with typed GC)
+        SIGSEGV      : normal
+        Globalization: normal
+Description of Problem:
+When a DirectoryInfo object is constructed with a path containing a
+trailing slash (e.g. "/usr/") a subsequent call to DirectoryInfo.Name
+yields the full path, rather than just the name of the innermost directory,
+as it should.
+Steps to reproduce the problem:
+The following code demonstrates the problem:
+using System;
+using System.IO;
+public class TestMain
+  public static void Main(string[] args)
+  {
+    Console.WriteLine(new DirectoryInfo("/usr/share").Name);
+    Console.WriteLine(new DirectoryInfo("/usr/share/").Name);
+    Console.WriteLine(new DirectoryInfo("/usr/share/.").Name);
+    Console.WriteLine(new DirectoryInfo("/usr/share/./").Name);
+  }
+Actual Results:
+The output given is:
+Expected Results:
+The output I expected is:
+How often does this happen? 
+Additional Information:
+Note that care should be taken not to reintroduce bug 75443 when fixing
+this one.

More information about the mono-bugs mailing list