public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin exe magic does not understand .com extension?
@ 2013-11-04 23:05 Andrey Repin
  2013-11-05  3:58 ` Christopher Faylor
  0 siblings, 1 reply; 5+ messages in thread
From: Andrey Repin @ 2013-11-04 23:05 UTC (permalink / raw)
  To: All

Greetings, All!

$ mode<Tab>
mode.com     modemui.dll  modex.dll

$ mode
bash: mode: command not found

Now, I see two issues.
First, it is that it see .dll files as executables. Which is true in essence,
but rather suspicious, as .dll files are normally not directly executable.
Would really like an explanation for this behavior.

Second, is that it actually see mode.com, but unable to execute it.

P.S.
$ set | grep PATHEXT
PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1'


-- 
WBR,
Andrey Repin (anrdaemon@yandex.ru) 05.11.2013, <02:48>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin exe magic does not understand .com extension?
  2013-11-04 23:05 Cygwin exe magic does not understand .com extension? Andrey Repin
@ 2013-11-05  3:58 ` Christopher Faylor
  2013-11-05  4:44   ` Cygwin exe magic does not understand .com extension? [or .exe sometimes] cygwin
  2013-11-05  5:22   ` Cygwin exe magic does not understand .com extension? Christopher Faylor
  0 siblings, 2 replies; 5+ messages in thread
From: Christopher Faylor @ 2013-11-05  3:58 UTC (permalink / raw)
  To: cygwin

On Tue, Nov 05, 2013 at 02:52:44AM +0400, Andrey Repin wrote:
>Greetings, All!
>
>$ mode<Tab>
>mode.com     modemui.dll  modex.dll

That would be /bin/sh exe magic from the looks of it.  It is probably
just trying to find anything with an executable bit set, just like on
Linux.

>$ mode
>bash: mode: command not found
>
>Now, I see two issues.
>First, it is that it see .dll files as executables. Which is true in essence,
>but rather suspicious, as .dll files are normally not directly executable.
>Would really like an explanation for this behavior.
>
>Second, is that it actually see mode.com, but unable to execute it.

It's likely that "mode.com" would execute it.

>P.S.
>$ set | grep PATHEXT
>PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1'

% cd /cygwin/sources
% grep -B17 PATHEXT *(.)
environ.cc-/* Minimal list of Windows vars which must be converted to uppercase.
environ.cc-   Either for POSIX compatibility of for backward compatibility with
environ.cc-   existing applications. */
environ.cc-static struct renv {
environ.cc-	const char *name;
environ.cc-	const size_t namelen;
environ.cc-} renv_arr[] = {
environ.cc-	{ NL("ALLUSERSPROFILE=") },		// 0
environ.cc-	{ NL("COMMONPROGRAMFILES=") },		// 1
environ.cc-	{ NL("COMPUTERNAME=") },
environ.cc-	{ NL("COMSPEC=") },
environ.cc-	{ NL("HOME=") },			// 4
environ.cc-	{ NL("HOMEDRIVE=") },
environ.cc-	{ NL("HOMEPATH=") },
environ.cc-	{ NL("NUMBER_OF_PROCESSORS=") },	// 7
environ.cc-	{ NL("OS=") },				// 8
environ.cc-	{ NL("PATH=") },			// 9
environ.cc:	{ NL("PATHEXT=") },


i.e., the only thing Cygwin does with PATHEXT is convert it to upper case.

cgf

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin exe magic does not understand .com extension? [or .exe sometimes]
  2013-11-05  3:58 ` Christopher Faylor
@ 2013-11-05  4:44   ` cygwin
  2013-11-05  5:25     ` Christopher Faylor
  2013-11-05  5:22   ` Cygwin exe magic does not understand .com extension? Christopher Faylor
  1 sibling, 1 reply; 5+ messages in thread
From: cygwin @ 2013-11-05  4:44 UTC (permalink / raw)
  To: cygwin

Christopher Faylor wrote:

> On Tue, Nov 05, 2013 at 02:52:44AM +0400, Andrey Repin wrote:
> >Greetings, All!
> >
> >$ mode<Tab>
> >mode.com     modemui.dll  modex.dll
> 
> That would be /bin/sh exe magic from the looks of it.  It is probably
> just trying to find anything with an executable bit set, just like on
> Linux.
> 
> >$ mode
> >bash: mode: command not found
> >
> >Now, I see two issues.
> >First, it is that it see .dll files as executables. Which is true in essence,
> >but rather suspicious, as .dll files are normally not directly executable.
> >Would really like an explanation for this behavior.
> >
> >Second, is that it actually see mode.com, but unable to execute it.
> 
> It's likely that "mode.com" would execute it.

this sounds like the problem i posted about the other day that trying to
execute gcc doesn't work but gcc.exe does. it's a pity. i wish someone had
an explanation why it happens with some programs like gcc (and mode) but not
others. a solution would be even better. but i've given up trying to compile
python modules so i can live with the failure.


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin exe magic does not understand .com extension?
  2013-11-05  3:58 ` Christopher Faylor
  2013-11-05  4:44   ` Cygwin exe magic does not understand .com extension? [or .exe sometimes] cygwin
@ 2013-11-05  5:22   ` Christopher Faylor
  1 sibling, 0 replies; 5+ messages in thread
From: Christopher Faylor @ 2013-11-05  5:22 UTC (permalink / raw)
  To: cygwin

On Mon, Nov 04, 2013 at 10:58:21PM -0500, Christopher Faylor wrote:
>On Tue, Nov 05, 2013 at 02:52:44AM +0400, Andrey Repin wrote:
>>Greetings, All!
>>
>>$ mode<Tab>
>>mode.com     modemui.dll  modex.dll
>
>That would be /bin/sh exe magic from the looks of it.  It is probably
>just trying to find anything with an executable bit set, just like on
>Linux.
>
>>$ mode
>>bash: mode: command not found
>>
>>Now, I see two issues.
>>First, it is that it see .dll files as executables. Which is true in essence,
>>but rather suspicious, as .dll files are normally not directly executable.
>>Would really like an explanation for this behavior.
>>
>>Second, is that it actually see mode.com, but unable to execute it.
>
>It's likely that "mode.com" would execute it.
>
>>P.S.
>>$ set | grep PATHEXT
>>PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1'
>
>% cd /cygwin/sources
>% grep -B17 PATHEXT *(.)
>environ.cc-/* Minimal list of Windows vars which must be converted to uppercase.
>environ.cc-   Either for POSIX compatibility of for backward compatibility with
>environ.cc-   existing applications. */
>environ.cc-static struct renv {
>environ.cc-	const char *name;
>environ.cc-	const size_t namelen;
>environ.cc-} renv_arr[] = {
>environ.cc-	{ NL("ALLUSERSPROFILE=") },		// 0
>environ.cc-	{ NL("COMMONPROGRAMFILES=") },		// 1
>environ.cc-	{ NL("COMPUTERNAME=") },
>environ.cc-	{ NL("COMSPEC=") },
>environ.cc-	{ NL("HOME=") },			// 4
>environ.cc-	{ NL("HOMEDRIVE=") },
>environ.cc-	{ NL("HOMEPATH=") },
>environ.cc-	{ NL("NUMBER_OF_PROCESSORS=") },	// 7
>environ.cc-	{ NL("OS=") },				// 8
>environ.cc-	{ NL("PATH=") },			// 9
>environ.cc:	{ NL("PATHEXT=") },
>
>
>i.e., the only thing Cygwin does with PATHEXT is convert it to upper
>case.

Further clarification: I went to the effort of checking the source for
PATHEXT but didn't do so for .com.  I thought we'd gotten rid of .com
processing but we hadn't.

Cygwin will execute mode on the path using execvp.  It won't
automatically add a .com extension to an open or stat call.  Only .exe
is really treated specially wrt filename lookups so if bash is doing its
own PATH scanning it won't find 'mode' with no extension.  However, if
you type /path/to/mode it will work without the extension.

.com files are a dying breed so please don't ask to further complicate
Cygwin's path logic to add support.

cgf

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin exe magic does not understand .com extension? [or .exe sometimes]
  2013-11-05  4:44   ` Cygwin exe magic does not understand .com extension? [or .exe sometimes] cygwin
@ 2013-11-05  5:25     ` Christopher Faylor
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Faylor @ 2013-11-05  5:25 UTC (permalink / raw)
  To: cygwin

On Tue, Nov 05, 2013 at 03:44:35PM +1100, <someone who insists on putting "cygwin" in their email address without using their real name> wrote:
>Christopher Faylor wrote:
>
>> On Tue, Nov 05, 2013 at 02:52:44AM +0400, Andrey Repin wrote:
>> >Greetings, All!
>> >
>> >$ mode<Tab>
>> >mode.com     modemui.dll  modex.dll
>> 
>> That would be /bin/sh exe magic from the looks of it.  It is probably
>> just trying to find anything with an executable bit set, just like on
>> Linux.
>> 
>> >$ mode
>> >bash: mode: command not found
>> >
>> >Now, I see two issues.
>> >First, it is that it see .dll files as executables. Which is true in essence,
>> >but rather suspicious, as .dll files are normally not directly executable.
>> >Would really like an explanation for this behavior.
>> >
>> >Second, is that it actually see mode.com, but unable to execute it.
>> 
>> It's likely that "mode.com" would execute it.
>
>this sounds like the problem i posted about the other day that trying to
>execute gcc doesn't work but gcc.exe does. it's a pity. i wish someone had
>an explanation why it happens with some programs like gcc (and mode) but not
>others. a solution would be even better. but i've given up trying to compile
>python modules so i can live with the failure.

No, this isn't the same thing at all.  It is perfectly understandable
why you'd need to type 'mode.com'.  The only reason why you'd need to
add .exe to gcc is if you either have a gcc without an extension
somewhere or you aren't using a cygwin program to start gcc.

cgf

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-05  5:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04 23:05 Cygwin exe magic does not understand .com extension? Andrey Repin
2013-11-05  3:58 ` Christopher Faylor
2013-11-05  4:44   ` Cygwin exe magic does not understand .com extension? [or .exe sometimes] cygwin
2013-11-05  5:25     ` Christopher Faylor
2013-11-05  5:22   ` Cygwin exe magic does not understand .com extension? Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).