public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: Inconsistence on file operation when the name already exists with exe extension
@ 2012-07-09 15:23 notstop
  2012-07-09 15:45 ` Christopher Faylor
  0 siblings, 1 reply; 20+ messages in thread
From: notstop @ 2012-07-09 15:23 UTC (permalink / raw)
  To: cygwin

You must be right in some points, but that is not the exact behavior of 
windows command although you pretend it to be (the powershell has a 
different behavior). In fact, I can independently operate file while 
file.exe exists:

copy file.exe file
Now there are file and file.exe

-- windows cmd.exe behaves like that:

del file: removes file only regardless of file.exe existence
del file.exe: removes file.exe only regardless of file existence

-- Cygwin behaves differently:

rm file.exe: will remove only file.exe if exists
rm file: will remove file if exists, and if not will remove file.exe


Considering this, may be be an issue when untaring a tarfile whose 
contents will match an already existing file in the directory with the 
exe extension. If both thefile and thefile.exe are packed in the tar, 
won't be an issue since thefile is alphabetically precedent to 
thefile.exe so both will be untared, but is just a mere coincidence that 
it works. Would be an issue if where the opposite.


--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-09 15:23 Inconsistence on file operation when the name already exists with exe extension notstop
@ 2012-07-09 15:45 ` Christopher Faylor
  2012-07-09 16:47   ` Steven Hartland
  2012-07-09 17:20   ` Aaron Schneider
  0 siblings, 2 replies; 20+ messages in thread
From: Christopher Faylor @ 2012-07-09 15:45 UTC (permalink / raw)
  To: cygwin

On Mon, Jul 09, 2012 at 05:23:13PM +0200, notstop wrote:
>You must be right in some points, but that is not the exact behavior of 
>windows command although you pretend it to be (the powershell has a 
>different behavior). In fact, I can independently operate file while 
>file.exe exists:
>
>copy file.exe file
>Now there are file and file.exe

Common email practice is to include the text of the email you are
responding to so that we can know who you are accusing of "pretending".

Nevertheless, FYI, powershell is not Cygwin and no one is saying that
the behavior you're seeing is mandated by Windows.  What you are seeing
is a Cygwin accommodation for the fact that .exe is a special extension.
Cygwin is not a new project.  Its handling of .exe has been hashed and
rehashed throughout the life of the project.  The current behavior is
the compromise that we've settled on.

So, what you are seeing is expected.  Continuing to argue without
familiarizing yourself with past discussions is not likely to expose
anything new.

--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-09 15:45 ` Christopher Faylor
@ 2012-07-09 16:47   ` Steven Hartland
  2012-07-09 17:20   ` Aaron Schneider
  1 sibling, 0 replies; 20+ messages in thread
From: Steven Hartland @ 2012-07-09 16:47 UTC (permalink / raw)
  To: cygwin

----- Original Message ----- 
From: "Christopher Faylor"

> On Mon, Jul 09, 2012 at 05:23:13PM +0200, notstop wrote:
>>You must be right in some points, but that is not the exact behavior of 
>>windows command although you pretend it to be (the powershell has a 
>>different behavior). In fact, I can independently operate file while 
>>file.exe exists:
>>
>>copy file.exe file
>>Now there are file and file.exe
> 
> Nevertheless, FYI, powershell is not Cygwin and no one is saying that
> the behavior you're seeing is mandated by Windows.  What you are seeing
> is a Cygwin accommodation for the fact that .exe is a special extension.
> Cygwin is not a new project.  Its handling of .exe has been hashed and
> rehashed throughout the life of the project.  The current behavior is
> the compromise that we've settled on.

This is a change which causes us pain regularly. The defaults in previous
cygwin versions worked well and where predicatable from both a coding
and user perspective.

So we would have to agree with the author here that the current behavour
should be reviewed and reverted to the much safer and more expected
defaults where by only execution is a special case nothing more.

> So, what you are seeing is expected.  Continuing to argue without
> familiarizing yourself with past discussions is not likely to expose
> anything new.

Take the example of a tar archive which has a windows .exe and say
a Linux binary of the same name excluding the .exe. The current behaviour
will have random results depending on the order of the files in the
archive. So its likely that even though the archive extracted a working
.exe file once the extract is actually complete the .exe will not be
present.

I appreciate that the idea was to make cygwin more internally consistent
however surely predictable vs. random behaviour (as far as the user
is concerned) is preferable is it not?

    Regards
    Steve


--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-09 15:45 ` Christopher Faylor
  2012-07-09 16:47   ` Steven Hartland
@ 2012-07-09 17:20   ` Aaron Schneider
  2012-07-10  5:38     ` Matt Seitz
  1 sibling, 1 reply; 20+ messages in thread
From: Aaron Schneider @ 2012-07-09 17:20 UTC (permalink / raw)
  To: cygwin

On 09/07/2012 17:44, Christopher Faylor wrote:
> On Mon, Jul 09, 2012 at 05:23:13PM +0200, notstop wrote:
>> You must be right in some points, but that is not the exact behavior of
>> windows command although you pretend it to be (the powershell has a
>> different behavior). In fact, I can independently operate file while
>> file.exe exists:
>>
>> copy file.exe file
>> Now there are file and file.exe
>
> Common email practice is to include the text of the email you are
> responding to so that we can know who you are accusing of "pretending".
>
> Nevertheless, FYI, powershell is not Cygwin and no one is saying that
> the behavior you're seeing is mandated by Windows.  What you are seeing
> is a Cygwin accommodation for the fact that .exe is a special extension.
> Cygwin is not a new project.  Its handling of .exe has been hashed and
> rehashed throughout the life of the project.  The current behavior is
> the compromise that we've settled on.
>
> So, what you are seeing is expected.  Continuing to argue without
> familiarizing yourself with past discussions is not likely to expose
> anything new.
>
> --
> 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
>
>

Sorry for not quoting, server was including raw email addresses in reply 
and got several bounces.

About the issue

-- There is something I need to clarify about what I am referring to 
with windows shells --:

* Windows command is %SystemRoot%\System32\cmd.exe
* Windows Powershell is included by default in Windows 7 at 
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe

I believe that Cygwin tries to emulate cmd.exe

-- They both behave differently --.

For example when typing file.exe on a directory:

* powershell tries to locate the executable in PATH at any costs 
regardless if exists in present directory. In fact if exists, won't 
execute it directly, will give error "Suggestion [3,General]: The 
command file.exe was not found, but does exist in the current location. 
Windows PowerShell doesn't load commands from the current location by 
default. If you trust this command, instead type ".\file.exe"." and will 
force you to run .\file.exe

* cmd.exe will run the file.exe if exists in present directory, without 
the need to run it as .\file.exe ; if not will run from path environment 
variable.

** Other differences may exist.

--
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] 20+ messages in thread

* RE: Inconsistence on file operation when the name already exists with exe extension
  2012-07-09 17:20   ` Aaron Schneider
@ 2012-07-10  5:38     ` Matt Seitz
  2012-07-10  8:45       ` Aaron Schneider
  0 siblings, 1 reply; 20+ messages in thread
From: Matt Seitz @ 2012-07-10  5:38 UTC (permalink / raw)
  To: Aaron Schneider, cygwin

> On Behalf Of Aaron Schneider
> 
> I believe that Cygwin tries to emulate cmd.exe

No, Cygwin does not try to emulate the cmd.exe shell.  Cygwin tries to emulate a shell running on Linux, usually the "bash" shell.

That's why you have to use "./file.exe" or "./file" to run a program from the current directory (if the current directory is not included in PATH).

If you want to use "cmd.exe" as your shell, you can try running "cmd.exe", and then execute the other Cygwin programs you want directly (C:\cygwin\bin\file.exe) from cmd.exe.  But that may run into problems.



--
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] 20+ messages in thread

* RE: Inconsistence on file operation when the name already exists with exe extension
  2012-07-10  5:38     ` Matt Seitz
@ 2012-07-10  8:45       ` Aaron Schneider
  2012-07-10 15:25         ` Earnie Boyd
  0 siblings, 1 reply; 20+ messages in thread
From: Aaron Schneider @ 2012-07-10  8:45 UTC (permalink / raw)
  To: cygwin

Matt Seitz <mseitz@mhseitz.onmicrosoft.com> escribió:

>> On Behalf Of Aaron Schneider
>>
>> I believe that Cygwin tries to emulate cmd.exe
>
>No, Cygwin does not try to emulate the cmd.exe shell.  Cygwin tries to
>emulate a shell running on Linux, usually the "bash" shell.
>
>That's why you have to use "./file.exe" or "./file" to run a program
>from the current directory (if the current directory is not included in
>PATH).
>
>If you want to use "cmd.exe" as your shell, you can try running
>"cmd.exe", and then execute the other Cygwin programs you want directly
>(C:\cygwin\bin\file.exe) from cmd.exe.  But that may run into problems.
>
>
>
>--
>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

You're right that cygwin shell tries to emulate bash, I just twisted things.

The problem is that in unix executables don't have extension but they actually do in cygwin so I think that's the root of the problem.

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

--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-10  8:45       ` Aaron Schneider
@ 2012-07-10 15:25         ` Earnie Boyd
  2012-07-10 16:23           ` Larry Hall (Cygwin)
  2012-07-10 16:54           ` Aaron Schneider
  0 siblings, 2 replies; 20+ messages in thread
From: Earnie Boyd @ 2012-07-10 15:25 UTC (permalink / raw)
  To: notstop, cygwin

On Tue, Jul 10, 2012 at 4:34 AM, Aaron Schneider
<notstop@users.sourceforge.net> wrote:
> You're right that cygwin shell tries to emulate bash, I just twisted things.
>

You're still wrong.  Cygwin is a POSIX library for Windows.  Bash is a
shell capable of being built with that POSIX library for use on
Windows but it isn't an emulation of Bash, it *is* Bash.  Other shells
available on *nix is also available for Cygwin.

> The problem is that in unix executables don't have extension but they actually do in cygwin so I think that's the root of the problem.
>

They don't need one in Cygwin either; as a matter of fact it was an
addition to binutils in the second generation of Cygwin that added the
.exe to the executable because it was more natural for Windows and
Windows at the time wouldn't execute the binary without the .exe
extension.

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

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-10 15:25         ` Earnie Boyd
@ 2012-07-10 16:23           ` Larry Hall (Cygwin)
  2012-07-10 16:54           ` Aaron Schneider
  1 sibling, 0 replies; 20+ messages in thread
From: Larry Hall (Cygwin) @ 2012-07-10 16:23 UTC (permalink / raw)
  To: cygwin

On 7/10/2012 11:24 AM, Earnie Boyd wrote:
> On Tue, Jul 10, 2012 at 4:34 AM, Aaron Schneider wrote:
>> You're right that cygwin shell tries to emulate bash, I just twisted things.
>>
>
> You're still wrong.  Cygwin is a POSIX library for Windows.  Bash is a
> shell capable of being built with that POSIX library for use on
> Windows but it isn't an emulation of Bash, it *is* Bash.  Other shells
> available on *nix is also available for Cygwin.
>
>> The problem is that in unix executables don't have extension but they
>> actually do in cygwin so I think that's the root of the problem.
>
>
> They don't need one in Cygwin either; as a matter of fact it was an
> addition to binutils in the second generation of Cygwin that added the
> .exe to the executable because it was more natural for Windows and
> Windows at the time wouldn't execute the binary without the .exe
> extension.
>
>> 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.

All true.  And all discussed before, as Chris pointed out earlier.
Earnie and others are being very helpful to the OP by reviewing this
stuff again.

It's great to ask questions and explore boundaries but what's better
is to explore new boundaries and ask new questions.  I'd also encourage
that those interested in this area (and I am certainly one) review what's
been said on this subject so far so that any further discussions will be
engaging for all.

-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-10 15:25         ` Earnie Boyd
  2012-07-10 16:23           ` Larry Hall (Cygwin)
@ 2012-07-10 16:54           ` Aaron Schneider
  2012-07-10 17:03             ` Christopher Faylor
                               ` (2 more replies)
  1 sibling, 3 replies; 20+ messages in thread
From: Aaron Schneider @ 2012-07-10 16:54 UTC (permalink / raw)
  To: cygwin

On 10/07/2012 17:24, Earnie Boyd wrote:
> On Tue, Jul 10, 2012 at 4:34 AM, Aaron Schneider
>> You're right that cygwin shell tries to emulate bash, I just twisted things.
>>
>
> You're still wrong.  Cygwin is a POSIX library for Windows.  Bash is a
> shell capable of being built with that POSIX library for use on
> Windows but it isn't an emulation of Bash, it *is* Bash.  Other shells
> available on *nix is also available for Cygwin.
>
>> The problem is that in unix executables don't have extension but they actually do in cygwin so I think that's the root of the problem.
>>
>
> They don't need one in Cygwin either; as a matter of fact it was an
> addition to binutils in the second generation of Cygwin that added the
> .exe to the executable because it was more natural for Windows and
> Windows at the time wouldn't execute the binary without the .exe
> extension.
>
>> 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) 
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. 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.

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)

--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-10 16:54           ` Aaron Schneider
@ 2012-07-10 17:03             ` Christopher Faylor
  2012-07-10 18:59             ` Earnie Boyd
  2012-07-11  0:50             ` Andrey Repin
  2 siblings, 0 replies; 20+ messages in thread
From: Christopher Faylor @ 2012-07-10 17:03 UTC (permalink / raw)
  To: cygwin

On Tue, Jul 10, 2012 at 06:54:06PM +0200, Aaron Schneider wrote:
>On 10/07/2012 17:24, Earnie Boyd wrote:
>> On Tue, Jul 10, 2012 at 4:34 AM, Aaron Schneider
>>> You're right that cygwin shell tries to emulate bash, I just twisted things.
>>>
>>
>> You're still wrong.  Cygwin is a POSIX library for Windows.  Bash is a
>> shell capable of being built with that POSIX library for use on
>> Windows but it isn't an emulation of Bash, it *is* Bash.  Other shells
>> available on *nix is also available for Cygwin.
>>
>>>The problem is that in unix executables don't have extension but they
>>>actually do in cygwin so I think that's the root of the problem.
>>
>>They don't need one in Cygwin either; as a matter of fact it was an
>>addition to binutils in the second generation of Cygwin that added the
>>.exe to the executable because it was more natural for Windows and
>>Windows at the time wouldn't execute the binary without the .exe
>>extension.
>>
>>>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) 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.  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.
>
>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)

Yes.  This observation is one of many on the subject which is
rediscovered every few months when someone notices that Cygwin treats
.exe specially.

Obviously we need a FAQ on this subject so that we can have something
obvious to point to for people to ignore.

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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-10 16:54           ` Aaron Schneider
  2012-07-10 17:03             ` Christopher Faylor
@ 2012-07-10 18:59             ` Earnie Boyd
  2012-07-11  0:50             ` Andrey Repin
  2 siblings, 0 replies; 20+ messages in thread
From: Earnie Boyd @ 2012-07-10 18:59 UTC (permalink / raw)
  To: cygwin

On Tue, Jul 10, 2012 at 12:54 PM, Aaron Schneider wrote:
> I don't see how you can run a PE executable from windows shell (cmd.exe)
> 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.
>

Ok, it did work but for some reason with XP SP2 a file with out an
extension isn't being executed.  If I copy for example
c:\windows\system32\ping.exe to myping.ping and execute it searching
for google.com then it works as expected.  If I remove .ping the
myping doesn't execute, so much for consistency.

> When you say that Windows XP and above can run an executable without
> extension, you are talking about running it from windows shell. 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.

Mintty is a terminal.  Bash, Csh, Ksh, Ash, etc all would run in the
Mintty terminal as the shell, you still don't understand the
difference.  The terminal is the interface providing fonts, keyboard
and mouse interactions responding to the window events.  Bash, Csh,
Ksh, etc are shells that act on the commands given it and each has its
own syntax for those commands.

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

The .exe isn't needed on the command line.  It is found by the Cygwin
runtime without it and the full file path given to CreateProcess when
it executes it.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-10 16:54           ` Aaron Schneider
  2012-07-10 17:03             ` Christopher Faylor
  2012-07-10 18:59             ` Earnie Boyd
@ 2012-07-11  0:50             ` Andrey Repin
  2 siblings, 0 replies; 20+ messages in thread
From: Andrey Repin @ 2012-07-11  0:50 UTC (permalink / raw)
  To: Aaron Schneider, cygwin

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@freemail.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

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

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-08 20:37     ` Aaron Schneider
@ 2012-07-09 12:36       ` Earnie Boyd
  0 siblings, 0 replies; 20+ messages in thread
From: Earnie Boyd @ 2012-07-09 12:36 UTC (permalink / raw)
  To: cygwin

On Sun, Jul 8, 2012 at 4:37 PM, Aaron Schneider wrote:
>
>
>
> -- This way works to have the two files simultaneously --:
> touch file
> touch file.exe
>
> -- This way doesn't --:
> touch file.exe
> touch file

Add a period character to the file name without extension.  Cygwin
will consider file.exe to be the same as file but file. is not the
same.

>
> -- This works again and is similar to 1st --:
> touch file.exe && bzip2 file.exe
> touch file
> bzip2 -d file.exe.bz2
> ----
> How can this be?

Since file.exe is specific it isn't the same as file as Cygwin sees
them.  However, the file without the extension will mask file.exe so
that file.exe will not be executed by Cygwin unless you specify the
full file name.

So in essence file is a pseudo symbolic link to file.exe; you cannot
overwrite the pseudo symbolic link.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-08 20:19 ` Aaron Schneider
  2012-07-08 20:27   ` marco atzeri
  2012-07-08 22:43   ` Buchbinder, Barry (NIH/NIAID) [E]
@ 2012-07-08 23:20   ` Andrey Repin
  2 siblings, 0 replies; 20+ messages in thread
From: Andrey Repin @ 2012-07-08 23:20 UTC (permalink / raw)
  To: Aaron Schneider, cygwin

Greetings, Aaron Schneider!


> --On an empty dir--:

> touch file.exe

> touch file.img

> touch file doesn't create the corresponding file.

> --Then--

> touch helpp

> cp helpp file

> cp: can't create regular file «file»: File exists

> On rm file it removes the file.exe instead of saying file not found.

> Is this behavior intended?

Yes. For more information, read about Cygwin .exe files handling magic.

> This is not unix like, the filename should be preserved as is

Complain to Microsoft...


--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 09.07.2012, <03:15>

Sorry for my terrible english...

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

* RE: Inconsistence on file operation when the name already exists with exe extension
  2012-07-08 20:19 ` Aaron Schneider
  2012-07-08 20:27   ` marco atzeri
@ 2012-07-08 22:43   ` Buchbinder, Barry (NIH/NIAID) [E]
  2012-07-08 23:20   ` Andrey Repin
  2 siblings, 0 replies; 20+ messages in thread
From: Buchbinder, Barry (NIH/NIAID) [E] @ 2012-07-08 22:43 UTC (permalink / raw)
  To: cygwin, 'Aaron Schneider'

Aaron Schneider wrote: on July 08, 2012 at 4:19 PM
> Is this behavior intended? This is not unix like, the filename should be preserved as is.

This may help explain this behavior:
http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-exe


--
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] 20+ messages in thread

* RE: Inconsistence on file operation when the name already exists with exe extension
  2012-07-08 20:27   ` marco atzeri
  2012-07-08 20:37     ` Aaron Schneider
@ 2012-07-08 20:49     ` Aaron Schneider
  1 sibling, 0 replies; 20+ messages in thread
From: Aaron Schneider @ 2012-07-08 20:49 UTC (permalink / raw)
  To: cygwin


Since for creating file and file.exe in cygwin, the file without exe must be created first to have both, under windows you can follow any order:


Using Windows 7 PowerShell:
-- This works --

fsutil file createnew file.exe 0
fsutil file createnew file 0


-- This works as well --

fsutil file createnew file 0

fsutil file createnew file.exe 0

 		 	   		  

--
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] 20+ messages in thread

* RE: Inconsistence on file operation when the name already exists with exe extension
  2012-07-08 20:27   ` marco atzeri
@ 2012-07-08 20:37     ` Aaron Schneider
  2012-07-09 12:36       ` Earnie Boyd
  2012-07-08 20:49     ` Aaron Schneider
  1 sibling, 1 reply; 20+ messages in thread
From: Aaron Schneider @ 2012-07-08 20:37 UTC (permalink / raw)
  To: cygwin




-- This way works to have the two files simultaneously --:
touch file
touch file.exe

-- This way doesn't --:
touch file.exe
touch file

-- This works again and is similar to 1st --:
touch file.exe && bzip2 file.exe
touch file
bzip2 -d file.exe.bz2
----
How can this be?

 		 	   		  

--
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] 20+ messages in thread

* Re: Inconsistence on file operation when the name already exists with exe extension
  2012-07-08 20:19 ` Aaron Schneider
@ 2012-07-08 20:27   ` marco atzeri
  2012-07-08 20:37     ` Aaron Schneider
  2012-07-08 20:49     ` Aaron Schneider
  2012-07-08 22:43   ` Buchbinder, Barry (NIH/NIAID) [E]
  2012-07-08 23:20   ` Andrey Repin
  2 siblings, 2 replies; 20+ messages in thread
From: marco atzeri @ 2012-07-08 20:27 UTC (permalink / raw)
  To: cygwin

On 7/8/2012 10:19 PM, Aaron Schneider wrote:
>
> --On an empty dir--:
>
> touch file.exe
>
> touch file.img
>
> touch file doesn't create the corresponding file.
>
> --Then--
>
> touch helpp
>
> cp helpp file
>
> cp: can't create regular file «file»: File exists
>
> On rm file it removes the file.exe instead of saying file not found.
>
> Is this behavior intended? This is not unix like, the filename should be preserved as is
>   		 	   		

In a normal unix, programs do not need the exe suffix so on cygwin
  "file.exe" can be referred as  "file".

"file" is the unix way
"file.exe" is the windows way

Try:
$ cd /bin
$ ls -l bash
$ ls -l bash*

as such you can not have a second file or directory with the same name.

Regards
Marco





--
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] 20+ messages in thread

* RE: Inconsistence on file operation when the name already exists with exe extension
  2012-07-08 20:03 Aaron Schneider
@ 2012-07-08 20:19 ` Aaron Schneider
  2012-07-08 20:27   ` marco atzeri
                     ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Aaron Schneider @ 2012-07-08 20:19 UTC (permalink / raw)
  To: cygwin


--On an empty dir--:

touch file.exe

touch file.img

touch file doesn't create the corresponding file.

--Then--

touch helpp

cp helpp file

cp: can't create regular file «file»: File exists

On rm file it removes the file.exe instead of saying file not found.

Is this behavior intended? This is not unix like, the filename should be preserved as is
 		 	   		  

--
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] 20+ messages in thread

* Inconsistence on file operation when the name already exists with exe extension
@ 2012-07-08 20:03 Aaron Schneider
  2012-07-08 20:19 ` Aaron Schneider
  0 siblings, 1 reply; 20+ messages in thread
From: Aaron Schneider @ 2012-07-08 20:03 UTC (permalink / raw)
  To: cygwin


On an empty dir:

touch file.exetouch file.imgtouch file doesn't create the corresponding file.
Then
touch helppcp helpp file
cp: can't create regular file «file»: File exists
On rm file it removes the file.exe instead of saying file not found.
Is this behavior intended? This is not unix like, the filename should be preserved as is. 		 	   		  

--
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] 20+ messages in thread

end of thread, other threads:[~2012-07-11  0:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-09 15:23 Inconsistence on file operation when the name already exists with exe extension notstop
2012-07-09 15:45 ` Christopher Faylor
2012-07-09 16:47   ` Steven Hartland
2012-07-09 17:20   ` Aaron Schneider
2012-07-10  5:38     ` Matt Seitz
2012-07-10  8:45       ` Aaron Schneider
2012-07-10 15:25         ` Earnie Boyd
2012-07-10 16:23           ` Larry Hall (Cygwin)
2012-07-10 16:54           ` Aaron Schneider
2012-07-10 17:03             ` Christopher Faylor
2012-07-10 18:59             ` Earnie Boyd
2012-07-11  0:50             ` Andrey Repin
  -- strict thread matches above, loose matches on Subject: below --
2012-07-08 20:03 Aaron Schneider
2012-07-08 20:19 ` Aaron Schneider
2012-07-08 20:27   ` marco atzeri
2012-07-08 20:37     ` Aaron Schneider
2012-07-09 12:36       ` Earnie Boyd
2012-07-08 20:49     ` Aaron Schneider
2012-07-08 22:43   ` Buchbinder, Barry (NIH/NIAID) [E]
2012-07-08 23:20   ` Andrey Repin

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