[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-devel-list
Subject:    Re: [Mono-dev] Making Open more atomic/consistent
From:       Rodrigo Kumpera <kumpera () gmail ! com>
Date:       2009-02-27 21:26:12
Message-ID: 8cca42d80902271326r3291b1f1u670a8402d546a982 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Tue, Feb 24, 2009 at 7:04 AM, LCID Fire <lcid-fire@gmx.net> wrote:

> Looking at the System.IO.File.Open/System.IO.MonoIO.Copy method I
> noticed some oddities in the implementation.
> First off it does a File.Exists check on the destination file which is
> IMO too early since the destination file is created far later on - there
> is the possibility that the file could be deleted till the actual create
> is attempted. In this case the method would have failed for no reason.
> Furthermore should the file be created after the File.Exists check it
> attempts a file creation via calling open. Open then fails - but looking
> at System.IO.MonoIO.GetException the error message for
> MonoIOError.ERROR_FILE_EXISTS differs from the one that is returned from
> the earlier check ("Could not create file \"{0}\". File already exists."
> vs "{0} already exists").
> So for consistency and to get the actual check more atomic I'd propose
> to just delete the first check in System.IO.MonoIO.Copy.
>

Yes, open should be more atomic, feel free to contribute a patch that fixes
this issue.

[Attachment #5 (text/html)]

<br><br><div class="gmail_quote">On Tue, Feb 24, 2009 at 7:04 AM, LCID Fire <span \
dir="ltr">&lt;<a href="mailto:lcid-fire@gmx.net">lcid-fire@gmx.net</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Looking at the \
System.IO.File.Open/System.IO.MonoIO.Copy method I<br> noticed some oddities in the \
implementation.<br> First off it does a File.Exists check on the destination file \
which is<br> IMO too early since the destination file is created far later on - \
there<br> is the possibility that the file could be deleted till the actual \
create<br> is attempted. In this case the method would have failed for no reason.<br>
Furthermore should the file be created after the File.Exists check it<br>
attempts a file creation via calling open. Open then fails - but looking<br>
at System.IO.MonoIO.GetException the error message for<br>
MonoIOError.ERROR_FILE_EXISTS differs from the one that is returned from<br>
the earlier check (&quot;Could not create file \&quot;{0}\&quot;. File already \
exists.&quot;<br> vs &quot;{0} already exists&quot;).<br>
So for consistency and to get the actual check more atomic I&#39;d propose<br>
to just delete the first check in \
System.IO.MonoIO.Copy.<br></blockquote><div><br>Yes, open should be more atomic, feel \
free to contribute a patch that fixes this issue.<br><br> <br></div></div>



_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic