delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/30/10:13:31

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Tue, 30 Mar 2004 09:12:14 -0600
Message-Id: <200403301512.i2UFCEHu027969@tigris.pounder.sol.net>
X-Authentication-Warning: tigris.pounder.sol.net: rodmant set sender to nicebounce AT trodman DOT com using -f
From: nicebounce AT trodman DOT com (Tom Rodman)
Reply-to: nicebounce AT trodman DOT com (Tom Rodman)
To: cygwin AT cygwin DOT com
X-note: 1G0!G/usr/sbin/sendmail -v -t -fnicebounce AT trodman DOT com
Subject: Re: bash bad interpreter - a new twist!
In-reply-to: <20040326061538.GB17139@redhat.com>
References: <BAY10-F5x0r5dHaNGDR00011ab5 AT hotmail DOT com> <200403260502 DOT i2Q52OZs022291 AT tigris DOT pounder DOT sol DOT net> <20040326061538 DOT GB17139 AT redhat DOT com>

On Fri 3/26/04 1:15 EST :
>>The "#!" construct must always refer to a binary, never to another
>>script (to avoid loops?).  I ran into the same issue.  The UNIX
>>standard is what I just said, but earlier (and current?) cygwin
>>versions (wrongly) sorta supported a script.  In 1.3.20 it works about
>>2 out of 5 times or so - if you try a similar approach on a UNIX box it
>>will fail *every* time.
>
>Actually, no.  It won't.  The #! can refer to a script.  Just tried it
>on Tru64 and on linux.

<no help wanted, just commenting>

I just tried it on redhat 9, and on HPUX 10 and your right it worked.
I have a definite memory of it failing repeatedlt under UNIX.., my tests months
back must have been flawed.

I was convinced that the interpreter must be a binary,partly
because of this redhat 9 execve man page snippet:

  execve() executes the program pointed to by filename.  filename must be
  either  a  binary  executable,  or a script starting with a line of the
  form "#! interpreter [arg]".  In the latter case, the interpreter  must
  be  a  valid  pathname  for an executable which is not itself a script

Under 1.3.20, I still can get my script that has '#!' pointing to another
script, to fail intermittently - see example at end of e-mail.  I have a fair
number of aliases and functions in my profile; I've found that
if I run the script with "env -i" as wrapper that it seems to fail less (I have
yet to make it fail).

--
regards,
Tom

--v-v------------------C-U-T---H-E-R-E-------------------------v-v--
<sorry about my ugly two-line bash prompts!>

> 13:20:07 Mon Mar 29 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > /adm/bin/sys/s/find_ls2 >/dev/null || echo oops
> 13:20:09 Mon Mar 29 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > /adm/bin/sys/s/find_ls2 >/dev/null || echo oops
> 13:20:12 Mon Mar 29 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > /adm/bin/sys/s/find_ls2 >/dev/null || echo oops
> 13:20:14 Mon Mar 29 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > /adm/bin/sys/s/find_ls2 >/dev/null || echo oops
> 13:20:17 Mon Mar 29 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > /adm/bin/sys/s/find_ls2 >/dev/null || echo oops
> 13:20:19 Mon Mar 29 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > /adm/bin/sys/s/find_ls2 >/dev/null || echo oops
> 13:20:42 Mon Mar 29 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > /adm/bin/sys/s/find_ls2 >/dev/null || echo oops
-bash: /adm/bin/sys/s/find_ls2: /adm/bin/sys/s/_debash: bad interpreter: No such file or directory
oops
> 08:57:18 Tue Mar 30 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > head -1 /adm/bin/sys/s/find_ls2
#!/adm/bin/sys/s/_debash /bin/aperl
> 08:57:30 Tue Mar 30 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > ls -ld /adm/bin/sys/s/_debash /bin/aperl
-rwxr-xr-x    1 adm_tsr  SCM_ES_S     1497 May 29  2003 /adm/bin/sys/s/_debash*
lrwxrwxrwx    1 build    Domain U      120 Nov 26  2002 /bin/aperl -> /aut/perl5/bin/perl*
> 08:57:47 Tue Mar 30 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > head -1 /adm/bin/sys/s/_debash
#!/bin/sh -
> 08:58:15 Tue Mar 30 0j tty0 5752 /tmp
> c7mkes109 adm_tsr > /bin/aperl -v

This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2001, Larry Wall

Binary build 635 provided by ActiveState Corp. http://www.ActiveState.com
Built 15:34:21 Feb  4 2003
<snip>

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