[Purdue-pm] Problem with she-bang and PERL5OPT
Rick Westerman
westerman at purdue.edu
Thu Nov 20 19:27:25 PST 2014
Mark: Your link from stack overflow is exactly the one I got my program idea from. The best answer — marked up 10 times — was from March 2010 so I thought that it would be correct. It is interesting that the ‘Zed’ you quoted who said the solution doesn’t work posted his comment only 5 hours ago. This stack overflow link is something to keep an eye on to see if someone counters ‘Zed’.
Others: Yes, I know that setting PERL5OPT outside the program will carry through. That isn’t possible in my scenario — executing Perl programs via Apache (the only real reason to use taint in the first place) unless we make all programs use taint. If someone has a suggestion on how to run individual web programs using taint I am all ears. Or if people think that I should turn on taint for all of our web programs — not a bad idea — then speak up … just be aware that Dave is already gnashing his teeth over my recent suggestions; I’d hate to see it get worse. :-)
As for /bin/env vs. /usr/bin/env … on RCAC the latter is a link to the former. Ergo at least on the RCAC system the former is the “real” program. Perhaps for Linux as a whole this is not true but I have what I have and portability per se is not a big concern for us aside from Solaris to Linux. I will keep the /bin/env vs. /bin/usr/env in mind.
--
Rick Westerman
westerman at purdue.edu
> On Nov 20, 2014, at 9:04 PM, Mark Senn <mark at ecn.purdue.edu> wrote:
>
> Rick Westerman <westerman at purdue.edu> wrote on 2014-11-20 at 14:52
> From all I have read the following program should work:
> | #!/bin/env PERL5OPT=-T perl
> |
> | warn 'Taint mode is '.(${^TAINT} ? 'on' : 'off');
> |
> | # End
> |
> | But when I run it, at least on the RCAC and on the Genomics systems, the
> | program just hangs. Take away PERL5OPT and it works. Put in '-w'
> | instead of '-T' and it fails in the same manner. Quoting does not seem
> | to matter. Just running from the command line:
> |
> | /bin/env PERL5OPT=-T perl program.file
> |
> | Works fine.
> |
> | I am mystified. Anyone have an idea?
>
> From
> http://stackoverflow.com/questions/2528959/how-do-i-set-the-taint-mode-in-a-perl-script-with-a-usr-bin-env-perl-sheba
>
> You cannot actually specify a variable in a shebang with
> /usr/bin/env. Doing so will cause env to execve itself in an infinite
> loop, never even getting to the command requested. I tested this against
> both Linux and FreeBSD. – Zed
>
>
> Rick, I got the sme results with these scripts that you got with yours
> #!/bin/env /bin/cat
> hello there
> and
> #!/bin/env TEMPVAR=hello /bin/cat
> hello there
> (I wanted to try it with something simpler than perl.)
>
> -mark
More information about the Purdue-pm
mailing list