X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com MIME-Version: 1.0 Subject: Re: 'cp' utility bug when .exe file exist. X-KeepSent: F145E76E:EB43EC60-8525773C:005639A6; type=4; name=$KeepSent Message-ID: From: RISINGP1 AT nationwide DOT com Date: Tue, 8 Jun 2010 11:42:48 -0400 Content-Type: text/plain; charset="US-ASCII" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 On 06/08/2010 10:52 AM, Eric Blake wrote: >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". > I disagree. This seems to me to be adopting the Microsoft policy of doing the user's thinking for them: "I don't care what they want - we know what's best for them." If a person wants to have "foo" and "foo.exe" in the same directory, that should be allowed. A few times getting tripped up by the wrong thing executing will be a good life lesson for the person, and teach about how different operating systems work to boot. Should I create "foo" as an executable, and "foo.exe" exists, then if I want to run "foo.exe", I should have to call it out specifically. I can see this might cause some confusion should, unbeknownst to the user, "foo.exe" exists earlier in the path than "foo", but that would become an education on how to use the PATH variable. This confusion arises from Cygwin's kowtowing to Microsoft's dubious idea of using extensions to control the handling of files. As to the automatic deletion/renaming of a file - DON'T EVER DO THIS! As to the "cp" issue, while IMHO, it should go ahead and do the copy, a more instructive error message would be helpful: cp: cannot create regular file `my': File 'my.exe' exists >> 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 AT redhat DOT com +1-801-349-2682 >Libvirt virtualization library http://libvirt.org Phil Rising risingp1 AT nationwide DOT com -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple