Empty file without "x" permission is successfully executable on Cygwin
Ken Brown
kbrown@cornell.edu
Mon Aug 5 20:01:00 GMT 2019
On 8/5/2019 2:18 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
> Hi,
>
> Please consider the following shell session:
>
> $ cat dummy.c
> #include <stdio.h>
>
> int main()
> {
> return 0;
> }
> $ gcc -o dummy dummy.c
> $ mv dummy.exe dummy
> $ ./dummy
> $ echo $?
> 0
> $ chmod a-x dummy
> $ ./dummy
> -bash: ./dummy: Permission denied
> $ rm dummy
> $ touch dummy
> $ ./dummy
> $ echo $?
> 0
>
> So Cygwin lets the shell to execute a zero-sized file regardless of the "x" perm
> (non-empty files are not executable if they do not have "x", as shown above).
I can't reproduce this on my system. Can you show the permissions and ACL of dummy?
> There's more. If I put some rubbish in a file, Cygwin still tries to execute it even if the "x" is not there:
>
> $ rm dummy
> $ echo "1" > dummy
> $ ./dummy
> ./dummy: line 1: 1: command not found
Again I can't reproduce this.
Ken
ТÒÐÐ¥&ö&ÆVÒ&W÷'G3¢GG¢òö7wvâæ6öÒ÷&ö&ÆV×2æFÖÀФd¢GG¢òö7wvâæ6öÒöfðФFö7VÖVçFFöã¢GG¢òö7wvâæ6öÒöFö72æFÖÀÐ¥Vç7V'67&&Ræfó¢GG¢òö7wvâæ6öÒöÖÂò7Vç7V'67&&R×6×ÆPÐ Ð
More information about the Cygwin
mailing list