This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATHEXT is fundamental to Windows and Should be recognised by CYGWIN


On Tue, Aug 9, 2016 at 11:15 AM, cyg Simple wrote:
> On 8/9/2016 10:13 AM, Erik Soderquist wrote:
>> On Tue, Aug 9, 2016 at 8:58 AM, cyg Simple wrote:
>>> I tried "chmod +x foo.txt; ./foo.txt" but that results in Cygwin
>>> assuming the text file is a script and executing each line of the file.
>>> If PATHEXT were used only to determine that the file should be passed to
>>> ShellExecute instead it might be beneficial but since I can easily just
>>> do "cmd /c foo.txt" then probably not so much.
>>
>> That is the behavior I would expect in any *nix environment, and
>> therefore consider the correct behavior within cygwin.
>>
>
> But any text file, regardless of the mode, regardless of #! first line
> will be executed at least by bash; I have tested the other shells.  This
> isn't expected behavior as I see it.

... that should not work, but I've confirmed it does in some shells...

user@localhost /tmp
$ echo echo meow >foo.txt

user@localhost /tmp
$ ls -l foo.txt
-rw-r--r-- 1 user Domain Users 10 Aug  9 12:37 foo.txt

user@localhost /tmp
$ ./foo.txt
meow

user@localhost /tmp
$ chmod a-x foo.txt

user@localhost /tmp
$ ./foo.txt
meow

user@localhost /tmp
$ ksh
user@localhost:/tmp $ ./foo.txt
ksh: ./foo.txt: can't execute: Permission denied
126|user@localhost:/tmp $ ^D

user@localhost /tmp
$ dash
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n$ ./foo.txt
meow
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n$
user@localhost /tmp
$ uname -a ; bash --version
CYGWIN_NT-10.0 localhost 2.5.1(0.297/5/3) 2016-04-21 22:14 x86_64 Cygwin
GNU bash, version 4.3.42(4)-release (x86_64-unknown-cygwin)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

user@localhost /tmp
$



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]