X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 	tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4A3F8955.3080407@gmail.com>
Date: Mon, 22 Jun 2009 14:38:29 +0100
From: Dave Korn <dave.korn.cygwin@googlemail.com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: HEADSUP maintainers: Packages install scripts without execute  	permissions
References: <4A3D1570.5020506@aim.com> <20090622094310.GN5039@calimero.vinschen.de> <20090622131144.GR5039@calimero.vinschen.de>
In-Reply-To: <20090622131144.GR5039@calimero.vinschen.de>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

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

