[Mono-bugs] [Bug 42631][Cri] Changed - Path.GetFullPath adds duplicate drive ("c:\c:\") on win32

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 8 May 2003 17:02:43 -0400 (EDT)


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 bmaurer@users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=42631

--- shadow/42631	Thu May  8 16:05:38 2003
+++ shadow/42631.tmp.30728	Thu May  8 17:02:43 2003
@@ -3,20 +3,19 @@
 Version: unspecified
 OS: unknown
 OS Details: win 2000
 Status: NEW   
 Resolution: 
 Severity: Unknown
-Priority: Major
+Priority: Critical
 Component: CORLIB
-AssignedTo: mono-bugs@ximian.com                            
+AssignedTo: bmaurer@users.sf.net                            
 ReportedBy: pelle.johnsen@mail.dk               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
-Cc: 
 Summary: Path.GetFullPath adds duplicate drive ("c:\c:\") on win32
 
 Description of Problem:
 
 Path.GetFullPath returns wrong result on win32 with paths containing drive 
 letter. The drive letter is duplicated e.g. "C:\" becomes "C:\C:\"
@@ -48,6 +47,57 @@
 Path.GetFullPath
 
 ------- Additional Comments From pelle.johnsen@mail.dk  2003-05-08 16:05 -------
 Ups, the expected result should of course be:
 
 C:\dir\subdir
+
+------- Additional Comments From bmaurer@users.sf.net  2003-05-08 17:02 -------
+Yep, this would be my bug. I am going to copy an explaniation that I
+got via email from Gert Driesen
+
+>>
+In mono 0.24, when the C:\TestDirectory\TestFile.txt Windows path is
+passed
+to the Path.GetFullPath method, I get the following result :
+
+C:\C:\TestDirectory\TestFile.txt
+
+I saw that you have updated the Path class since the Mono 0.24
+release, and
+I haven't been able to get Mono to build from cvs on Windows (grrrrr), but
+I'm sure the updates you did would still not correct this issue.
+
+Because, in the CanonicalizePath method, the root (in this case C:\)
+is also
+returned by the Path.GetDirectoryName (in this case C:\TestDirectory),
+so it
+will still be added twice to the return value, because it's also in
+the dirs
+array :
+
+if (target == 0)
+    ....
+else
+    return root + String.Join (DirectorySeparatorChar.ToString (),
+dirs, 0,
+target) + DirectorySeparatorChar + file;
+
+    // which translates to :
+
+    return
+            "C:\" +                                            // the root
+            "C:" + "\" +                                     // result of
+String.Join on first element of dirs array
+            "TestDirectory" + "\"  +                   // result of
+String.Join on second element of dirs array
+            "\" +                                               // the
+DirectorySeparatorChar for Windows
+            "TestFile.txt";                                 // the
+filename
+
+which is C:\C:\TestDirectory\TestFile.txt !
+<<
+
+I think this is a big enough problem that we may want to refresh 0.24
+for Windows. I talked to Miguel about this, he said he might be able
+to do it tomorrow. However, testing _must_ be done first.