bash bad interpreter - a new twist!

Tom Rodman nicebounce@trodman.com
Tue Mar 30 19:17:00 GMT 2004


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/



More information about the Cygwin mailing list