[Mono-bugs] [Bug 65727][Nor] Changed - DirectoryInfo.GetFiles() doesn't correctly return a funky filename

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 21 Sep 2004 11:52:48 -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 dick@ximian.com.

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

--- shadow/65727	2004-09-13 13:04:21.000000000 -0400
+++ shadow/65727.tmp.17608	2004-09-21 11:52:48.000000000 -0400
@@ -10,13 +10,12 @@
 Component: CORLIB
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: joeshaw@novell.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
-Cc: 
 Summary: DirectoryInfo.GetFiles() doesn't correctly return a funky filename
 
 I have a file on my filesystem which has a ^M at the end of it.  Don't ask
 me, it was in a CVS checkout.  Anyway, this file shows up as "Icon?" in ls,
 but when I tab complete it in bash I get "Icon^M".  In nautilus sometimes
 it shows a linebreak and sometimes the unicode value.
@@ -96,6 +95,54 @@
 		foreach (FileInfo file in di.GetFiles()) {
                         Console.WriteLine("Found [{0}]", file.Name);
                 }
         }
 }
 
+
+------- Additional Comments From dick@ximian.com  2004-09-21 11:52 -------
+The culprit seems to be Path.GetFullPath().  Irritatingly, the ms
+behaviour also strips trailing whitespace here.  See:
+
+                                                                     
+          
+using System;
+using System.IO;
+                                                                     
+          
+public class foo {
+        public static void Main() {
+                string path = "/tmp/joe/Icon ^M ";
+                                                                     
+          
+                Console.WriteLine("path is [{0}]", path);
+                Console.WriteLine("Fullpath is [{0}]",
+Path.GetFullPath(path));
+        }
+}
+
+
+.net 1.1:
+
+dick@w2k /tmp
+$ ./paths.exe
+ ]th is [/tmp/joe/Icon
+Fullpath is [D:\tmp\joe\Icon]
+ 
+
+.net 2.0 beta 1:
+
+dick@w2k-net20b1 /tmp
+$ ./paths.exe
+ ]th is [/tmp/joe/Icon
+Fullpath is [D:\tmp\joe\Icon]
+                                                                     
+          
+
+
+I would call this an ms bug - GetFullPath() is supposed to return the
+fully qualified location of a path, which it plainly isn't doing if
+the filename ends in whitespace.
+
+CCing Miguel for an opinion on what to do here - fix it in mono, or
+retain strict compatibility?
+