delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/01/04/11:32:18

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4D234B82.3000204@redhat.com>
Date: Tue, 04 Jan 2011 09:32:02 -0700
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin-1.7.7: mv appends .exe to directory if matching .exe exists
References: <alpine DOT LRH DOT 2 DOT 00 DOT 1101040857070 DOT 8516 AT druid DOT colorado DOT edu>
In-Reply-To: <alpine.LRH.2.00.1101040857070.8516@druid.colorado.edu>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------enig94A7322AEE22EB505E5A07FF
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 01/04/2011 09:27 AM, David Mastronarde wrote:
>=20
> When there is a directory and an executable with the same name, mv adds
> .exe when renaming the directory:
>=20
> % mkdir test2
> % cd test2
> % mkdir package-3.1.1
> % touch package-3.1.1.exe
> % mv package-3.1.1 package-3.1.2
> % ls
> package-3.1.1.exe  package-3.1.2.exe/
>=20
> There is also a problem when there is an executable matching the name
> being moved to:
>=20
> % mv package-3.1.2.exe package-3.1.2
> % ls
> package-3.1.1.exe  package-3.1.2/
> % mv package-3.1.2 package-3.1.1
> mv: cannot move `package-3.1.2' to `package-3.1.1': Not a directory
>=20
> This happens with the latest snapshot of cygwin1.dll.

You CAN'T have a directory and an executable sharing the same name on
Linux, so why should you try the same thing on cygwin?  Given that
cygwin attempts to handle '.exe' as a necessary evil, and tries to
recognize executables when the suffix is omitted, you are basically
confusing cygwin by creating a directory and an executable with the same
name.

That said, there's probably room for improvement for recognizing the
situation, and trying to be smarter when both directory and .exe
executable exist; and the patch may need to be in coreutils rather than
in cygwin1.dll (since cp is doing some extra legwork for .exe magic in
the first place).  Good thing I'm building coreutils 8.9 today :)

--=20
Eric Blake   eblake AT redhat DOT com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


--------------enig94A7322AEE22EB505E5A07FF
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJNI0uCAAoJEKeha0olJ0NqSBQH/3cEwaDRk3KOF7SxhvprBY9Q
vvh8TBZNmgfqjiejHE1ovnxAu/UnMpQlgTqSxQBXznIF/xxaUGUg5vmw9QlTvfhb
vWHIEwCvt/Pl5GMGW9Vj/5zObrB+bQpvdnybYQwCv3+OiUK2hQk8rKsibRxU/1JU
P1cobC7R34+ADSD3uc6J0gLaYMBMfx/miWW+9K625G20QQlPEI3pB29MP3MRDlbq
GGjX2JmPLKINXSvf1Thr4YO324Purs/fH5uurXTLfYRlu0OWH1oDOXni+hBOb0ta
5vCcwkxSvVf6AHl6cHPanjC6MbCcy3ooPX6WmnaxQYHPQ0CSbuLhgZwa8Jcy0TY=
=zDVu
-----END PGP SIGNATURE-----

--------------enig94A7322AEE22EB505E5A07FF--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019