design question, why not always use 'cp --remove-destination'?

Krasimir Angelov kr.angelov at gmail.com
Tue Aug 22 11:58:34 EDT 2006


<resend to libraries at haskell.org>

On 8/22/06, Frederik Eaton <frederik at a5.repetae.net> wrote:
> On Tue, Aug 22, 2006 at 06:16:39PM +0300, Krasimir Angelov wrote:
> > On 8/22/06, Frederik Eaton <frederik at a5.repetae.net> wrote:
> > >Perhaps the "Text file busy" error is Unix-specific, but I can imagine
> > >cases where somebody (other than the OS) might open a file with a
> > >well-known name and read from various parts of it, and expect it not
> > >to change underneath them...
> >
> > Then he/she may expect that the file will not be suddenly unlinked
> > while he/she is still reading.
>
> I hardly know anything about Windows. Doesn't it have inodes, so I can
> open a file, unlink it, and continue to read from and write to it?
>
> > The documentation for System.IO says that the implementation should
> > provide single writer - multiple readers locking. When that is the
> > case then copyFile should fail if the target fail is open for
> > reading or writing from someone including the OS. The Unix
> > implementation provides only local locking but the Windows
> > implementation provides system wide locking.

Ah! I understand now. This simply doesn't work under Windows but it
makes sense for Unix. I just think that removeFile should be called
only on non-Windows OSes.


More information about the Libraries mailing list