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: HEADSUP maintainers: Packages install scripts without execute permissions


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


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