Stas Bekman wrote:
William A. Rowe, Jr. wrote:

I don't think the reporter understood the concept of

#!/usr/bin/perl
eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
  if \$running_under_some_shell;

which is a noop under perl, and invokes a shell exec command under shell.  Perl
never invokes the exec ($running_under_some_shell is undef and  therefore noop).

In this case, /usr/bin/perl is running their script, even if perlpath pointed
to /usr/local/perl5.8/bin/perl - and that's the last possible scenario we want.

If the reporter wanted this hack to work, #!/bin/sh  was the proper line one.

You mean:

sub make_shebang {
    # if perlpath is longer than 62 chars, some shells on certain
    # platforms won't be able to run the shebang line, so when seeing
    # a long perlpath use the eval workaround.
    # see: http://en.wikipedia.org/wiki/Shebang
    # http://homepages.cwi.nl/~aeb/std/shebang/
    my $shebang = length $Config{perlpath} < 62
        ? "#!$Config{perlpath}\n"
        : <<EOI;
#bin/sh
    eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
        if \$running_under_some_shell;
EOI

    return $shebang;
}

Should probably be: $Config{sh}

Good point ;-)

In any case, this sort of hack should be left to the value of $Config{startperl}
where it belongs, not a dozen workarounds in a dozen different projects.

I'm not following you, how $Config{startperl} solves the problem of the long path, if just as you say it makes the script run under the wrong perl?

$Config{sh}, $Config{perlpath}, and $Config{perl} comes from -this- perl, right?
#/usr/bin/perl is a hardcode to an arbitrary perl installed at that location.

What I'm trying (failing?) to point out is that on BSD and other platforms, if
they have a bug, they can munge *PERL*, not ApacheTest, not each and every perl
script which creates perl files, with an effective value of $Config{startperl}.
I don't have a BSD box in front of me; but if ApacheTest used $Config{startperl}
rather than all of this other mechanics, then it would be up to BSD folks
to help the entire Perl community by fixing this ONCE with MakeMaker, and be
done with it.  By messing with constructing what MakeMaker's done since 5.0005
we are putting more work on ourselves, no?

Bill, mind to post a patch of what you think should work?

Yes, revert this patch, and replace these lines with = $Config{startperl}.
When I have a clean patch against head I'll post it.  I'll also look at the
state of MakeMaker to see if this issue -was- addressed there.

Bill

Reply via email to