delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/07/10/20:50:38

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=2.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_THEBAT,KHOP_DNSBL_BUMP,KHOP_THREADED,RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L3,SPF_SOFTFAIL
X-Spam-Check-By: sourceware.org
Date: Wed, 11 Jul 2012 04:41:56 +0400
From: Andrey Repin <anrdaemon AT freemail DOT ru>
Reply-To: Andrey Repin <cygwin AT cygwin DOT com>
Message-ID: <398013297.20120711044156@mtu-net.ru>
To: Aaron Schneider <notstop AT users DOT sourceforge DOT net>, cygwin AT cygwin DOT com
Subject: Re: Inconsistence on file operation when the name already exists with exe extension
In-Reply-To: <BLU0-SMTP212B1E87711B5FCCCC6A04DCED20@phx.gbl>
References: <BLU0-SMTP193F74A0A7FC396B8160663CED30 AT phx DOT gbl> <20120709154456 DOT GA6696 AT ednor DOT casa DOT cgf DOT cx> <BLU0-SMTP224D901B80815ECFB99E3BCED30 AT phx DOT gbl> <1BBEF94B6B46E54980290D150A6F2EDD20C950F5 AT SN2PRD0610MB396 DOT namprd06 DOT prod DOT outlook DOT com> <BLU0-SMTP97B6AD85F5813BE73A584ACED20 AT phx DOT gbl> <CA+sc5mmri4CSe19uaGig_uwzWruOVzpDmm-xDuYsUapph_Ji4w AT mail DOT gmail DOT com> <BLU0-SMTP212B1E87711B5FCCCC6A04DCED20 AT phx DOT gbl>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

Greetings, Aaron Schneider!

>>> Probably compiling binaries under cygwin without the exe extension, like
>>> unix, is not an alternative, or is it? Cygwin may detect if it is
>>> executable checking if it's PE format; if it is perl script.  Just check
>>> if file is present in path or run. /file 
>>
>> False.  It is wholly possible, you just have to pass the correct flags
>> to the linker process.  Current windows versions since at least XP and
>> maybe before would run files that did not contain a .exe extension.
>>

> I don't see how you can run a PE executable from windows shell (cmd.exe)

You're comparing apples to oranges.
You've been told already that Cygwin doesn't try to emulate windows shells or
anything of that kind.

> directly without the exe extension. I've just tried it in several ways
> and always prompts me the "Open with..." dialog instead of directly 
> running it because treats it as data.

> When you say that Windows XP and above can run an executable without
> extension, you are talking about running it from windows shell.

No, he's talking about CreateProcess[Ex]() function call.
It's possible to execute binary with arbitrary name, since at least Win NT 4.x
if memory serves me well.

> But I was referring in the end to the cygwin terminal
> (C:\cygwin\bin\mintty.exe -) that I believe can run exe without 
> extension even in older versions of windows, because it's bash that 
> launches it as you said before.

You're confusing shell with terminal... don't you?
Try
mintty.exe -h -e C:\WINDOWS\system32\cmd.exe /K

You'll be surprised.

> That's being said because I expect users to run commands from the cygwin
> terminal. The exe extension is needed if you want to run the linux 
> commands directly from the windows shell directly (c:\cygwin\bin\ and 
> other bash PATHs should be exported to the windows PATH to run them 
> directly from windows shell, but you will mix things up)

I do like to mix things. Alot. Life is just not the same without that.


--
WBR,
Andrey Repin (anrdaemon AT freemail DOT ru) 11.07.2012, <04:32>

Sorry for my terrible english...


--
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

- Raw text -


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