all files are executable in cygwin?

1

It seems cygwin considers all files to be executable:

/tmp> echo "echo abc" > a
/tmp> ls -l a
-rw-r--r-- 1 I063510 Domain Users 9 Apr  9 15:39 a
/tmp> ./a
abc
/tmp> cygcheck -c base-cygwin
Cygwin Package Information
Package              Version        Status
base-cygwin          3.8-1          OK

I am pretty sure this behavior has changed recently. Is it configurable so that I such files do not execute?

I even seem to remember having to change permission of a .bat file created inside cygwin so that it can be executed from windows command prompt, but I could be wrong about that.

Miserable Variable

Posted 2017-04-09T22:47:53.890

Reputation: 759

Answers

0

the problem is the lack of she-bang, so the file is loaded by the shell itself.
https://en.wikipedia.org/wiki/Shebang_%28Unix%29

$  echo 'echo abc' > a
$ ls -l a
-rw-r--r-- 1 marco Administrators 9 Apr 10 13:28 a
$ ./a
abc

$  echo '#!/bin/bash\recho abc' > a
$ ls -l a
-rw-r--r-- 1 marco Administrators 22 Apr 10 13:29 a
$ ./a
-bash: ./a: Permission denied

matzeri

Posted 2017-04-09T22:47:53.890

Reputation: 1 662