Empty file without "x" permission is successfully executable on Cygwin

Ken Brown kbrown@cornell.edu
Tue Aug 6 19:35:00 GMT 2019


On 8/6/2019 3:09 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
>> zero-sized? Irrelevant.
> 
> It is actually very relevant.  Because executing an empty script results in "success" (exit code 0) -- that creates a false-positive.

You were absolutely right on your first complaint, that Cygwin allows a script 
without execute permission to be executed.  Corinna has already fixed that:

 
https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=98669a24760a84bfef498fedeef7fa7ecc518e6c

But what's your basis for saying that an empty script shouldn't be executable? 
As long as it has execute permission, you're asking the shell to do nothing.  It 
happily does nothing and reports success.

It works that way on Linux also:

$ touch dummy

$ chmod +x dummy

$ ./dummy

$ echo $?
0

Ken
B‹KCB”›Ø›[H™\ܝΈ‹ËØÞYÝÚ[‹˜ÛÛKܛ؛[\Ëš[B‘TNˆ‹ËØÞYÝÚ[‹˜ÛÛKÙ˜\KÃB‘ØÝ[Y[][ÛŽˆ‹ËØÞYÝÚ[‹˜ÛÛKÙØÜËš[B•[œÝXœØÜšX™H[™›Îˆ‹ËØÞYÝÚ[‹˜ÛÛKÛ[ÈÝ[œÝXœØÜšX™K\Ú[\CBƒB


More information about the Cygwin mailing list