Subject: Re: B20, Win95: cp destroys file
From: [email-masked] (Mumit Khan)

16 Nov 1998 05:19:38 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
To: [email-masked]
Cc: "Henry S. Warren, Jr." <[email-masked]>, [email-masked]

Earnie Boyd <[email-masked]> writes:
> ---"Henry S. Warren, Jr." <[email-masked]> wrote:
> >
> > If you copy, using cp, a file to itself, and the target and source
> files
> > differ in capitalization, then the content of the file is wiped out;
> it
> > becomes a file of 0-length.  Example: "cp hilbert.c hilbert.C" trashes
> > file hilbert.c.  
> >    The Win95 "copy" command gives the error message "File cannot be
> > copied onto itself" in this situation (much preferable)
> 
> Hmm.  It used to do it that way in b19.  Is it possible that inode or
> stat routine has become buggy?

Are you by any chance doing this on a SMB mounted filesystem? I remember
playing with this a while back, and it worked on FAT and NTFS, but not
on SAMBA disk (didn't try SMB disks from non-SAMBA server, such as NT).

I believe that the problem is in MoveFileEx (WIN API), which doesn't do 
the right thing. However, the rename in MSVC runtime does somehow do
it correctly on all filesystems, so it's doing something more than using
MoveFileEx. (fyi, mv uses the rename runtime routine in winsup that in
turn uses MoveFileEx to do the actual renaming).

Comments from win32 savvy folks?

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".