public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* cygpath -w and .exe magic
@ 2016-08-26 13:59 Nellis, Kenneth
  2016-08-26 14:30 ` Lee Dilkie
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Nellis, Kenneth @ 2016-08-26 13:59 UTC (permalink / raw)
  To: cygwin

Dear Cygwin Community,

$ ls -l
total 60
-rwxr-x--- 1 knellis Domain Users 60927 Aug 26 08:57 hello.exe
$ ./hello
Hello, world!
$ cygpath -w hello
hello
$

The purpose of cygpath -w, it seems to me, is to provide
to Windows a valid path given a Posix path.

Given executable file foo.exe, which Cygwin allows to be
referenced simply as foo, should not: cygpath -w foo
return: foo.exe
instead of: foo
?

Passing foo to a Windows application will certainly 
be a problem. I recognize this might be considered a
change of scope for the program, but I think the tool
should do the .exe magic rather than pass off this
responsibility to the user. Food for thought.

--Ken Nellis

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

* Re: cygpath -w and .exe magic
  2016-08-26 14:30 ` Lee Dilkie
@ 2016-08-26 14:30   ` Herbert Stocker
  2016-08-26 14:58     ` Nellis, Kenneth
  0 siblings, 1 reply; 11+ messages in thread
From: Herbert Stocker @ 2016-08-26 14:30 UTC (permalink / raw)
  To: cygwin

On 26.08.2016 15:19, Lee Dilkie wrote:
>
>
> On 8/26/2016 9:08 AM, Nellis, Kenneth wrote:
>> Dear Cygwin Community,
>>
>> $ ls -l
>> total 60
>> -rwxr-x--- 1 knellis Domain Users 60927 Aug 26 08:57 hello.exe
>> $ ./hello
>> Hello, world!
>> $ cygpath -w hello
>> hello
>> $
>>
>> The purpose of cygpath -w, it seems to me, is to provide
>> to Windows a valid path given a Posix path.
>>
>> Given executable file foo.exe, which Cygwin allows to be
>> referenced simply as foo, should not: cygpath -w foo
>> return: foo.exe
>> instead of: foo
>> ?
>>
>> Passing foo to a Windows application will certainly
>> be a problem. I recognize this might be considered a
>> change of scope for the program, but I think the tool
>> should do the .exe magic rather than pass off this
>> responsibility to the user. Food for thought.
>
> and break everyone who has existing code to take care of this?

If it is done, it should be done as an additional option, i'd say.

Herbert


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


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

* Re: cygpath -w and .exe magic
  2016-08-26 13:59 cygpath -w and .exe magic Nellis, Kenneth
@ 2016-08-26 14:30 ` Lee Dilkie
  2016-08-26 14:30   ` Herbert Stocker
  2016-08-26 14:45 ` cyg Simple
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Lee Dilkie @ 2016-08-26 14:30 UTC (permalink / raw)
  To: cygwin



On 8/26/2016 9:08 AM, Nellis, Kenneth wrote:
> Dear Cygwin Community,
>
> $ ls -l
> total 60
> -rwxr-x--- 1 knellis Domain Users 60927 Aug 26 08:57 hello.exe
> $ ./hello
> Hello, world!
> $ cygpath -w hello
> hello
> $
>
> The purpose of cygpath -w, it seems to me, is to provide
> to Windows a valid path given a Posix path.
>
> Given executable file foo.exe, which Cygwin allows to be
> referenced simply as foo, should not: cygpath -w foo
> return: foo.exe
> instead of: foo
> ?
>
> Passing foo to a Windows application will certainly
> be a problem. I recognize this might be considered a
> change of scope for the program, but I think the tool
> should do the .exe magic rather than pass off this
> responsibility to the user. Food for thought.

and break everyone who has existing code to take care of this?

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

* Re: cygpath -w and .exe magic
  2016-08-26 13:59 cygpath -w and .exe magic Nellis, Kenneth
  2016-08-26 14:30 ` Lee Dilkie
@ 2016-08-26 14:45 ` cyg Simple
  2016-08-26 15:29 ` Doug Henderson
  2016-08-26 16:50 ` Herbert Stocker
  3 siblings, 0 replies; 11+ messages in thread
From: cyg Simple @ 2016-08-26 14:45 UTC (permalink / raw)
  To: cygwin

On 8/26/2016 9:08 AM, Nellis, Kenneth wrote:
> Dear Cygwin Community,
> 
> $ ls -l
> total 60
> -rwxr-x--- 1 knellis Domain Users 60927 Aug 26 08:57 hello.exe
> $ ./hello
> Hello, world!
> $ cygpath -w hello
> hello
> $
> 
> The purpose of cygpath -w, it seems to me, is to provide
> to Windows a valid path given a Posix path.
> 
> Given executable file foo.exe, which Cygwin allows to be
> referenced simply as foo, should not: cygpath -w foo
> return: foo.exe
> instead of: foo
> ?
> 
> Passing foo to a Windows application will certainly 
> be a problem. I recognize this might be considered a
> change of scope for the program, but I think the tool
> should do the .exe magic rather than pass off this
> responsibility to the user. Food for thought.

You say certainly but provide no real proof other than your assumptions.
 Cygpath has been performing for many years without anyone complaining
about the missing .exe.  I don't think we need to change it.

-- 
cyg Simple

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

* RE: cygpath -w and .exe magic
  2016-08-26 14:30   ` Herbert Stocker
@ 2016-08-26 14:58     ` Nellis, Kenneth
  2016-08-26 15:07       ` cyg Simple
  0 siblings, 1 reply; 11+ messages in thread
From: Nellis, Kenneth @ 2016-08-26 14:58 UTC (permalink / raw)
  To: cygwin

From: Herbert Stocker
> On 26.08.2016 15:19, Lee Dilkie wrote:
> > and break everyone who has existing code to take care of this?
> 
> If it is done, it should be done as an additional option, i'd say.

Of course a new option, duh! ☺
But my feeble brain is failing to imagine a case where this
would break anything, unless the user solution would turn
a returned foo.exe into foo.exe.exe, which seems doubtful.

--Ken Nellis

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

* Re: cygpath -w and .exe magic
  2016-08-26 14:58     ` Nellis, Kenneth
@ 2016-08-26 15:07       ` cyg Simple
  2016-08-26 15:34         ` Nellis, Kenneth
  0 siblings, 1 reply; 11+ messages in thread
From: cyg Simple @ 2016-08-26 15:07 UTC (permalink / raw)
  To: cygwin

On 8/26/2016 10:35 AM, Nellis, Kenneth wrote:
> From: Herbert Stocker
>> On 26.08.2016 15:19, Lee Dilkie wrote:
>>> and break everyone who has existing code to take care of this?
>>
>> If it is done, it should be done as an additional option, i'd say.
> 
> Of course a new option, duh! ☺
> But my feeble brain is failing to imagine a case where this
> would break anything, unless the user solution would turn
> a returned foo.exe into foo.exe.exe, which seems doubtful.
> 

We still don't have a valid case of failure without the .exe.  Until
that happens this is a no-go change.

-- 
cyg Simple

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

* Re: cygpath -w and .exe magic
  2016-08-26 13:59 cygpath -w and .exe magic Nellis, Kenneth
  2016-08-26 14:30 ` Lee Dilkie
  2016-08-26 14:45 ` cyg Simple
@ 2016-08-26 15:29 ` Doug Henderson
  2016-08-26 16:50 ` Herbert Stocker
  3 siblings, 0 replies; 11+ messages in thread
From: Doug Henderson @ 2016-08-26 15:29 UTC (permalink / raw)
  To: cygwin

On 26 August 2016 at 07:08, Nellis, Kenneth  wrote:
> Dear Cygwin Community,
>
> $ ls -l
> total 60
> -rwxr-x--- 1 knellis Domain Users 60927 Aug 26 08:57 hello.exe
> $ ./hello
> Hello, world!
> $ cygpath -w hello
> hello
> $
>
> The purpose of cygpath -w, it seems to me, is to provide
> to Windows a valid path given a Posix path.
>

There is no requirement that the any part of the path presented to
cygpath actually exists. Otherwise, you would not be able to pass the
name of a non-existent file or directory to a windows only program
that only understands strictly windows paths.

To do what you want, cygpath would need two new options. One to
specify that the path represents an existing filesystem object, and a
second to specify that the path represents an executable file.

Both of those options would require cygpath to inspect the file
system, rather than current operations which return path format
transformations or static information.

Doug

-- 
Doug Henderson, Calgary, Alberta, Canada

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

* RE: cygpath -w and .exe magic
  2016-08-26 15:07       ` cyg Simple
@ 2016-08-26 15:34         ` Nellis, Kenneth
  2016-08-26 17:55           ` Erik Soderquist
  2016-08-26 19:50           ` cyg Simple
  0 siblings, 2 replies; 11+ messages in thread
From: Nellis, Kenneth @ 2016-08-26 15:34 UTC (permalink / raw)
  To: cygwin

From: cyg Simple
> On 8/26/2016 10:35 AM, Nellis, Kenneth wrote:
> > From: Herbert Stocker
> >> On 26.08.2016 15:19, Lee Dilkie wrote:
> >>> and break everyone who has existing code to take care of this?
> >>
> >> If it is done, it should be done as an additional option, i'd say.
> >
> > Of course a new option, duh! ☺
> > But my feeble brain is failing to imagine a case where this
> > would break anything, unless the user solution would turn
> > a returned foo.exe into foo.exe.exe, which seems doubtful.
> >
> 
> We still don't have a valid case of failure without the .exe.  Until
> that happens this is a no-go change.

Here is a contrived example:

$ cmd /c DIR $(cygpath -w hello.exe)
 Volume in drive C has no label.
 Volume Serial Number is 6A15-FFB2

 Directory of C:\cygwin\home\knellis\dev\c\hello

08/26/2016  10:47            60,927 hello.exe
               1 File(s)         60,927 bytes
               0 Dir(s)  218,673,360,896 bytes free
$ cmd /c DIR $(cygpath -w hello)
 Volume in drive C has no label.
 Volume Serial Number is 6A15-FFB2

 Directory of C:\cygwin\home\knellis\dev\c\hello

File Not Found
$

As I originally said, "Food for thought."
I thought it might be worth a discussion.
Appreciate the comments.

--Ken Nellis

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

* Re: cygpath -w and .exe magic
  2016-08-26 13:59 cygpath -w and .exe magic Nellis, Kenneth
                   ` (2 preceding siblings ...)
  2016-08-26 15:29 ` Doug Henderson
@ 2016-08-26 16:50 ` Herbert Stocker
  3 siblings, 0 replies; 11+ messages in thread
From: Herbert Stocker @ 2016-08-26 16:50 UTC (permalink / raw)
  To: cygwin

On 26.08.2016 15:08, Nellis, Kenneth wrote:
> Dear Cygwin Community,
>
> $ ls -l
> total 60
> -rwxr-x--- 1 knellis Domain Users 60927 Aug 26 08:57 hello.exe
> $ ./hello
> Hello, world!
> $ cygpath -w hello
> hello
> $
>
> The purpose of cygpath -w, it seems to me, is to provide
> to Windows a valid path given a Posix path.
>
> Given executable file foo.exe, which Cygwin allows to be
> referenced simply as foo, should not: cygpath -w foo
> return: foo.exe
> instead of: foo
> ?
>
> Passing foo to a Windows application will certainly
> be a problem. I recognize this might be considered a
> change of scope for the program, but I think the tool
> should do the .exe magic rather than pass off this
> responsibility to the user. Food for thought.
>

Sounds reasonable, but why shouldn't one have to say .exe
if they mean .exe?
That principle makes things easy.

Just to illustrate a complication of that approach:
Imagine you want to tell a program to safe its data to file foo
and cygpath sees that there is a file Foo.exe, it will make the
Windows program overwrite Foo.exe instead.


And as far as i understand, the reason why Cygwin added this
automatic addition of .exe is not to safe the user 4 key strokes,
but because some programs cannot live without it - i remember
Corinna saying that one cannot run Cygwin programs from cmd.exe
if they don't have the .exe appended - and requiring to specify
the exact name of an executable, i.e. with the .exe would break
each and every script or executable that were written with only
POSIX in mind. They say cp or bash, but not cp.exe or bash.exe .

So Cygwin did this not to make it easy for users,
but out of a dilemma:
   make Cygwin executables available to the Windows world
   vs. not breaking all POSIX programs.

And if you use cygpath, you are writing code for the Windows
environment, and then you can add the .exe where its needed
i think.


best regards,

Herbert Stocker













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


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

* Re: cygpath -w and .exe magic
  2016-08-26 15:34         ` Nellis, Kenneth
@ 2016-08-26 17:55           ` Erik Soderquist
  2016-08-26 19:50           ` cyg Simple
  1 sibling, 0 replies; 11+ messages in thread
From: Erik Soderquist @ 2016-08-26 17:55 UTC (permalink / raw)
  To: cygwin

On Fri, Aug 26, 2016 at 10:58 AM, Nellis, Kenneth wrote:
> Here is a contrived example:
>
> $ cmd /c DIR $(cygpath -w hello.exe)
>  Volume in drive C has no label.
>  Volume Serial Number is 6A15-FFB2
>
>  Directory of C:\cygwin\home\knellis\dev\c\hello
>
> 08/26/2016  10:47            60,927 hello.exe
>                1 File(s)         60,927 bytes
>                0 Dir(s)  218,673,360,896 bytes free
> $ cmd /c DIR $(cygpath -w hello)
>  Volume in drive C has no label.
>  Volume Serial Number is 6A15-FFB2
>
>  Directory of C:\cygwin\home\knellis\dev\c\hello
>
> File Not Found
> $

That isn't really a failure, as "dir foo" in CMD.EXE should (and does)
return file not found if file "foo" (no extension) does not exist.

-- Erik

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

* Re: cygpath -w and .exe magic
  2016-08-26 15:34         ` Nellis, Kenneth
  2016-08-26 17:55           ` Erik Soderquist
@ 2016-08-26 19:50           ` cyg Simple
  1 sibling, 0 replies; 11+ messages in thread
From: cyg Simple @ 2016-08-26 19:50 UTC (permalink / raw)
  To: cygwin

On 8/26/2016 10:58 AM, Nellis, Kenneth wrote:
> $ cmd /c DIR $(cygpath -w hello)

But
$ cmd /c $(cygpath -w hello)
will execute hello.exe

The fact that you get file not found error tells me that cmd is doing
what it does.  The purpose of the .exe magic is for executing the file
from the Cygwin shell.  My opinion is that we shouldn't rely on the .exe
magic; there are hidden dangers and some use those dangers to a benefit.

-- 
cyg Simple

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

end of thread, other threads:[~2016-08-26 17:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-26 13:59 cygpath -w and .exe magic Nellis, Kenneth
2016-08-26 14:30 ` Lee Dilkie
2016-08-26 14:30   ` Herbert Stocker
2016-08-26 14:58     ` Nellis, Kenneth
2016-08-26 15:07       ` cyg Simple
2016-08-26 15:34         ` Nellis, Kenneth
2016-08-26 17:55           ` Erik Soderquist
2016-08-26 19:50           ` cyg Simple
2016-08-26 14:45 ` cyg Simple
2016-08-26 15:29 ` Doug Henderson
2016-08-26 16:50 ` Herbert Stocker

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