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: Empty file without "x" permission is successfully executable on Cygwin


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

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