HEADSUP maintainers: Packages install scripts without execute permissions

Dave Korn dave.korn.cygwin@googlemail.com
Mon Jun 22 14:35:00 GMT 2009


Corinna Vinschen wrote:
> Hi,
> 
> 
> Here's the problem:  If you exec shell scripts, they should only be run
> if the user trying to run the script has execute permissions on the
> script.  

  Shell scripts don't _have_ to be executable, only if you want to launch one
as if it were a command, rather than sourcing it.

  Why don't we just remove the "-c" and get setup.exe to use the simple "bash
<filename>" syntax meaning "treat <filename> as a text file, open it and pipe
it to stdin"?

[davek@ubique src]$ cat happy-script-file.txt
echo "I am a happy script file!"
[davek@ubique src]$ ls -la happy-script-file.txt
-rw-rw-r-- 1 davek davek 33 2009-06-22 14:35 happy-script-file.txt
[davek@ubique src]$ ./happy-script-file.txt
bash: ./happy-script-file.txt: Permission denied
[davek@ubique src]$ bash -c ./happy-script-file.txt
bash: ./happy-script-file.txt: Permission denied
[davek@ubique src]$ bash  ./happy-script-file.txt
I am a happy script file!
[davek@ubique src]$

  AFAIK this final syntax is equivalent to writing "cat happy-script-file.txt
| bash", where of course the execute bits couldn't make any difference.

    cheers,
      DaveK


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



More information about the Cygwin mailing list