[Mono-bugs] [Bug 493294] New: Mono.CSharp.CodeGen.Basename() mishandles pathnames with mixed directory separators

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Apr 8 12:58:05 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=493294


           Summary: Mono.CSharp.CodeGen.Basename() mishandles pathnames
                    with mixed directory separators
    Classification: Mono
           Product: Mono: Compilers
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tlillqvist at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


The code works incorrectly if the file name contains both / and \ directory
separators (as happens on Windows), and the \ ones are after the / ones.

Patch against 1.2.6, but the function is identical in trunk.

--- ../1.2.6.orig/mcs/mcs/codegen.cs    2007-11-09 00:08:58.000000000 +0200
+++ mcs/mcs/codegen.cs    2009-04-08 19:32:35.652625000 +0300
@@ -56,11 +56,11 @@
         public static string Basename (string name)
         {
             int pos = name.LastIndexOf ('/');
+            int pos2 = name.LastIndexOf ('\\');

-            if (pos != -1)
-                return name.Substring (pos + 1);
+            if (pos2 > pos)
+              pos = pos2;

-            pos = name.LastIndexOf ('\\');
             if (pos != -1)
                 return name.Substring (pos + 1);

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list