[Mono-bugs] [Bug 666225] New: System.IO.Directory.GetFiles throws IOException ERROR_NO_MORE_FILES
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Jan 21 12:10:17 EST 2011
https://bugzilla.novell.com/show_bug.cgi?id=666225
https://bugzilla.novell.com/show_bug.cgi?id=666225#c0
Summary: System.IO.Directory.GetFiles throws IOException
ERROR_NO_MORE_FILES
Classification: Mono
Product: Mono: Runtime
Version: 2.8.x
Platform: x86-64
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: P5 - None
Component: io-layer
AssignedTo: lupus at novell.com
ReportedBy: bassam at symform.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13)
Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729; .NET4.0E)
There seems to be a race condition where if a file is enumerated in
System.IO.GetFiles and then immediately deleted, an IOException is thrown as
follows:
System.IO.IOException : Win32 IO returned ERROR_NO_MORE_FILES. Path: /tmp
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
Looking at FindFirstFile in mono/io-layer/io.c:
if (handle != INVALID_HANDLE_VALUE &&
!FindNextFile (handle, find_data)) {
FindClose (handle);
SetLastError (ERROR_NO_MORE_FILES);
handle = INVALID_HANDLE_VALUE;
}
So it looks like if a file is enumerated but disappears, FindFirstFile sets the
last error to ERROR_NO_MORE_FILES. The wrapper code in mono/metadata/file-io.c
in ves_icall_System_IO_MonoIO_GetFileSystemEntries, checks for
ERROR_FILE_NOT_FOUND and returns an empty array. It does not however check for
ERROR_NO_MORE_FILES.
One suggestion is to check for ERROR_NO_MORE_FILES in
ves_icall_System_IO_MonoIO_GetFileSystemEntries and return an empty array.
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list