delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/06/22/09:26:43

X-Recipient: archive-cygwin AT delorie DOT 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 DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: HEADSUP maintainers: Packages install scripts without execute permissions
References: <4A3D1570 DOT 5020506 AT aim DOT com> <20090622094310 DOT GN5039 AT calimero DOT vinschen DOT de> <20090622131144 DOT GR5039 AT calimero DOT vinschen DOT de>
In-Reply-To: <20090622131144.GR5039@calimero.vinschen.de>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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 AT ubique src]$ cat happy-script-file.txt
echo "I am a happy script file!"
[davek AT 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 AT ubique src]$ ./happy-script-file.txt
bash: ./happy-script-file.txt: Permission denied
[davek AT ubique src]$ bash -c ./happy-script-file.txt
bash: ./happy-script-file.txt: Permission denied
[davek AT ubique src]$ bash  ./happy-script-file.txt
I am a happy script file!
[davek AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019