From: Garance A Drosehn Date: 2008-06-30T12:59:46+09:00 Subject: Re: changing the shebang of ruby files best way ? ------=_Part_6615_3413909.1214798548699 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Sat, Jun 28, 2008 at 3:41 PM, Ryan Davis wrote: > > On Jun 27, 2008, at 13:22 , Une B=E9vue wrote: > > actual shebang is : >> #!/usr/bin/ruby -w >> >> and i need to change it to : >> #! /usr/bin/env ruby -w >> > > the problem is that /usr/bin/env absolutely sucks on linux. -w is not onl= y > NOT passed as an argument to "ruby", it is considered part of ruby (eg "r= uby > -w") and horks the exec. > FWIW, the problem here is not 'env', it's the way that '#!' lines are parsed. The 'env' will do the correct thing if it is given separate parameters, but the kernel-level exec processor does not parse out all the individual fields in a '#!'-line. It parses "the executable" and "everything else", and then passes "everything else" as a single parameter to "the executable". And at this point, it would be much too incompatible = a change to have the exec processor parse it in any other way. There's even some logic to the way that parsing is done, although I don't remember it at the moment. The 'env' command in FreeBSD provides a way around this, by adding some mor= e options to 'env' so it can parse out the individual options, but I don't know if any other OS's will notice that and pick up the options. (note: I'm the guy who added those options to 'env' in FreeBSD...) --=20 Garance Alistair Drosehn =3D drosihn@gmail.com Senior Systems Programmer Rensselaer Polytechnic Institute; Troy, NY; USA ------=_Part_6615_3413909.1214798548699--