'cp' utility bug when <dest-name>.exe file exist.

Eric Blake eblake@redhat.com
Tue Jun 8 14:52:00 GMT 2010


On 06/08/2010 08:43 AM, Steven Collins wrote:
> directory as can be demonstrated by a simple "touch foo foo.exe"
> command. Both files will be created.

Arguably, both should NOT be created, for the same reasons.  That is, it
is probably worth a patch to make open("foo.exe",O_CREAT|O_EXCL,mode)
fail if "foo" exists, and open("foo.exe",O_CREAT,mode) delete "foo" if
it exists, effectively renaming "foo" to "foo.exe".

> which the magic gets applied and "foo.exe", "foo.bat",

You are misunderstanding the magic.  It only happens for .exe, and that
is because the Unix world is steeped in the tradition of suffix-less
executables, but Windows insists on having the .exe suffix for cmd to be
able to run an executable.  Cygwin goes to various lengths to try to
support both, at the expense that you shouldn't have both exist in the
same directory.  .bat has nothing to do with .exe magic.

> There certainly appear to be
> inconsistencies within the tools.

Yes, and as they get pointed out, we try to make them more consistent.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20100608/61964f85/attachment.sig>


More information about the Cygwin mailing list