[Mono-bugs] [Bug 68566][Nor] New - GetFullPath mangles unix escapes
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 19 Oct 2004 19:00:32 -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 foser@gentoo.org.
http://bugzilla.ximian.com/show_bug.cgi?id=68566
--- shadow/68566 2004-10-19 19:00:32.000000000 -0400
+++ shadow/68566.tmp.22568 2004-10-19 19:00:32.000000000 -0400
@@ -0,0 +1,45 @@
+Bug#: 68566
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details: Gentoo
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: foser@gentoo.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: GetFullPath mangles unix escapes
+
+Path.GetFullPath mangles unix filename escapes. This leads to eg.
+"/path/to/some\\file" being returned as "/path/to/some/file" . This is
+because in Path.cs GetFullPath uses CanonicalizePath which Split's the
+string on both DirectorySeparatorChar & AltDirectorySeparatorChar ('/' &
+'\') . The following testcase demonstrates :
+
+using System;
+using System.IO;
+class GetFilesBug {
+ static void Main()
+ {
+ string[] folders = {"test1", "test2\\\\file"};
+
+ foreach (string folder in folders) {
+ Console.WriteLine(Path.GetFullPath (folder));
+ }
+ }
+}
+
+
+The output is :
+$ ./getfilesunix.exe
+/home/foser/test1
+/home/foser/test2/file
+
+The simple fix on unix is to only split on DirectorySeperatorChar (attached
+patch vs mcs-1.0.2), but I'm not sure how this would work out on windows.