[Mono-bugs] [Bug 683203] New: Directory.GetFiles error or crash if pattern is unusual

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Mar 28 16:45:03 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=683203

https://bugzilla.novell.com/show_bug.cgi?id=683203#c0


           Summary: Directory.GetFiles error or crash if pattern is
                    unusual
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.10.x
          Platform: i386
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: integral22003 at yahoo.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=421762)
 --> (http://bugzilla.novell.com/attachment.cgi?id=421762)
sample for show Directory.GetFiles crash or error when pattern is unusual

User-Agent:       Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101
Firefox/4.0


For this program:
/***************************/
using System;
using System.Windows.Forms;
using System.IO;

namespace GetFiles
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] files = Directory.GetFiles(Application.StartupPath,
"subfolder/*.*");
            foreach(string s in files)
                Console.WriteLine(s);
        }
    }
}
/***************************/

and compile by:
Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1

-----------------
if run in windows 7 with .NET,we have (correct output).Like: 
E:\>GetFiles.exe
E:\subfolder\1.1
E:\subfolder\2.2

-----------------
if run in windows XP (Whitout SP) with Mono version 2.10.1 Build 2,we have
error.Like  : 
E:\>mono GetFiles.exe
E:\1.1
E:\2.2

-----------------
if run in linux ubuntu 10.10 with Mono version 2.6.7,throw Exception.we have : 
smah1 at manager:~/GF$ mono GetFiles.exe 

Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a
part of the path "/home/smah1/GF/subfolder"
  at System.IO.Directory.GetFileSystemEntries (System.String path,
System.String searchPattern, FileAttributes mask, FileAttributes attrs)
[0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String
searchPattern) [0x00000] in <filename unknown>:0 
  at GetFiles.Program.Main (System.String[] args) [0x00000] in <filename
unknown>:0 

-----------------
if "subfolder/*.*" replace by "subfolder\\*.*" and run in windows 7 by .NET or
windows XP with mono 2.10.1,we have corrected output:
E:\>mono GetFiles.exe
E:\subfolder\1.1
E:\subfolder\2.2

Reproducible: Always

-- 
Configure bugmail: https://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