Subject: Re: Changing exec's #! behavior
To: Jason R Thorpe <>
From: Andrew Brown <>
List: tech-kern
Date: 06/13/2000 16:08:25
>The problem is that BSD and Solaris are defining [arg] differently
>in the #! specification.  In BSD, [arg] is defined as "until the end
>of the line" whereas in Solaris, it's defined as "until the first

isn't there also a limit on the length of "arg"?  i seem to remember a
32 from somewhere...

>Now, the reason that the -w is seen by perl in the Solaris case is
>because perl *itself* looks at the script for a line that has "#!" and
>"perl" in it, and upon finding it, parses the command line args to
>perl located there itself.

perl *is* wicked, isn't it?  :)

>I've changed NetBSD's exec_script.c to have the Solaris behavior and
>am using it that way in our environment here.  But I'd like to get
>comments on this before I commit the change to the master NetBSD

that seem fine to me.  it ought not to break anything that worked so
far.  but i do have a related question:

how hard would it be to have interpreters that used other interpreters
that were not binaries?  eg...why does the following not work?

   % file part2
   part2: a /home/andrew/rot13 script text
   % cat part2
   this is 
   a test

   % file /home/andrew/rot13
   /home/andrew/rot13: perl commands text
   % cat rot13
   #!/usr/local/bin/perl -p

   % file /usr/local/bin/perl
   /usr/local/bin/perl: NetBSD/i386 demand paged dynamically linked executable not stripped

   % ./part2
   this: Command not found.
   a: Command not found.

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."