bugDotGNU Portable.NET - Bugs: bug #10485, File.Delete(string) throws an...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #10485: File.Delete(string) throws an exception when the file does not exist

Submitted by:  Marcus Urban <mathpup>
Submitted on:  Fri 24 Sep 2004 12:38:19 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri 24 Sep 2004 02:52:22 AM UTC, comment #1:

Fix committed to CVS - 24 Sep 2004. The "gen_errno.sh"
script will now use the output of "gcc -dD -E" to find the
error codes, which should handle definitions in multiple
/usr/include header files. If the compiler does not support
"-dD", it will fall back to the current "assume that they
are all in one file" method.

Rhys Weatherley <rweather>
Project Administrator
Fri 24 Sep 2004 12:38:19 AM UTC, original submission:

File.Delete(string) throws an exception when the file does not exist. I think that it has something to do with the mapping of error codes.

File.Delete() invokes a helper method, which returns an error code. If the error code is that the file does not exist, everything is okay. Otherwise, an exception is thrown.

The problem is that eventually ILDelete() is called, which first tries the rmdir() function and then tries unlink(). If the file does not exist unlink() returns ENOENT, which is the integer 2 on my system. However, ILSysIOConvertErrno() converts this value to 1 (EPERM). So eventually File.Delete() receives an error code corresponding to EPERM, when it should instead receive ENOENT.

Marcus Urban <mathpup>

 

Attached Files
file #1795:  test-delete.cs added by mathpup (114B - text/x-csharp - Test case)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Fri 24 Sep 2004 02:52:22 AM UTCrweatherStatusNone=>Fixed
  Open/ClosedOpen=>Closed
Fri 24 Sep 2004 12:38:19 AM UTCmathpupAttached File-=>Added test-delete.cs, #1700

Back to the top


Powered by Savane 3.1-cleanup1