delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/25/15:03:26

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
To: cygwin AT cygwin DOT com
From: Robert Schmidt <rschm AT broadpark DOT no>
Subject: Re: bash/sh program interpreter problems...
Date: Mon, 25 Oct 2004 20:42:17 +0200
Lines: 77
Message-ID: <417D4909.7000103@broadpark.no>
References: <clh1tp$ajj$1 AT sea DOT gmane DOT org> <417D19BB DOT 6090101 AT x-ray DOT at>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
Cc: rurban AT x-ray DOT at
X-Gmane-NNTP-Posting-Host: dhcp-068-210.oslo.eur.slb.com
User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913)
In-Reply-To: <417D19BB.6090101@x-ray.at>
X-IsSubscribed: yes

Reini Urban wrote:
> Robert Schmidt schrieb:
> 
>> I have the following two programs in /usr/local/bin:
>>
>> --- test.btm
>> #!/usr/local/bin/testint.sh
>> echo hello from test.btm
> 
> 
> naming a shell script .btm is not a good idea, since .btm files are 
> usually 4NT batch files.

This is exactly what I'm doing.  I want to be able to run 4NT batch 
files from e.g. bash.

Just to make it clear, the above *is* a 4NT batch file - not a shell 
script.  I assumed talking about 4NT would just confuse matters, but 
here it is:

I've defined a 4NT alias "#!" for "rem", which makes 4NT ignore the 
interpreter spec.  Further, testint.sh is actually my "4NT interpreter", 
4ntsh.sh:

#!/bin/sh
FILE=`cygpath -w $1`
shift
/usr/local/bin/4nt/4nt.exe /c "$FILE" $@

Next, any 4NT batch file I want to run from bash should do so if I put 
this line in it:

#!/usr/local/bin/4ntsh.sh
...

And as I said, this works often, and often not at all.

> same for .h files.
> windows has some internal registry key which extensions are executable.

I'm aware of this, but that has no impact on how cygwin runs executable 
files (AFAIK).

> chmod +x /usr/local/bin/test.btm
> chmod +x /usr/local/bin/test.h
> 
> does the explicit path help?

No...  all files that should be +x, are.

> --- test.h
> #!/bin/bash
> /usr/local/bin/test.btm
> 
> One should not assume that test.btm is executable.

On my setup, I do.  I regularly run a "fix permissions" script which 
gives +x to all *.sh, *.btm, *.pl, etc. under /usr/local/bin (typically 
after synchronizing with unison, which does not yet propagate permissions).

> BTW: I have the same problems, with some php or java wrappers. The first 
> call gives this error message "bad interpreter", the seconds works fine 
> then.

All right - that sounds like the problem I'm trying to describe!  It's 
good to hear that I'm not alone.  Any useful info?  google gave me 
3-year old threads which left me in the dark.

The fact that the error message occurs at rather random times make me 
suspect a bug in cygwin.  I wonder if it can be the same problem as the 
"PID reuse" problem mentioned in several parallel threads?  I don't yet 
have the guts to start building and patching bash myself - maybe later 
this week.


Thanks,
Rob


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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