Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Wed, 12 Feb 2003 09:26:23 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: "linda w (cyg)" cc: cygwin AT cygwin DOT com Subject: Re: strange mv behavior: mv In-Reply-To: <000001c2d256$1fafa3a0$1403a8c0@sc.tlinx.org> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 11 Feb 2003, linda w (cyg) wrote: > I stumbled onto this trying to rename a dir from > "Mydir" to "mydir" (w/o capital "M") > > > mv Mydir mydir > starts copying "Mydir" into Mydir/mydir. > > But it's not just the 'caps' that are the issue since: > > > mv mydir mydir > will start copying mydir into itself > > On lnx, I get: > mv: cannot move `mydir' to a subdirectory of itself, `mydir/mydir' > > Shouldn't I get a similar error on Windows? > > Note to do the original, desired mv, I can use: > > mv Mydir foo; mv foo mydir > > Which (unfortunately), would be correct windows behavior since > you can't rename a file or dir to a different name that varies only > in capitalization (ignore case "feature"). > > The problem is 'mv' isn't recognizing that source and target are > the same name (even when case matches), so it is behaving like 'cp'. > > linda Linda, Note that 'mv' and 'cp' share code (copy.c) that does the actual move/copy. That file does have the message you refer to above, conditional on errno==EINVAL after rename(). Apparently, Cygwin's (or, rather, newlib's) rename doesn't have that behavior. That's where I'd start tracking it down. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk! -- /usr/games/fortune -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/