Apache-Test has a problem on OpenBSD when perl's shebang is too long. This patch uses the old eval trick to workaround the problem when we see a perl path > 62 chars.

The only reason I didn't commit it right away is because I'm not sure whether this workaround works on win32. Can someone on win32 confirm that?

I'd suggest to change the patch to not check the length of $Config{perlpath}, just so that you certainly test the right thing.

Thank you.

-------- Original Message --------
Subject: Here's the patch for shebang lines over 64 characters long
Date: Thu, 15 Dec 2005 14:24:22 -0800
From: Mike Smith <[EMAIL PROTECTED]>
To: Stas Bekman <[EMAIL PROTECTED]>

Index: lib/Apache/TestConfig.pm
===================================================================
--- lib/Apache/TestConfig.pm    (revision 356832)
+++ lib/Apache/TestConfig.pm    (working copy)
@@ -1027,7 +1027,8 @@
     my $fh = $self->genfile($file, undef, 1);

     # shebang
-    print $fh "#!$Config{perlpath}\n";
+    my $shebang = make_shebang();
+    print $fh $shebang;

     $self->genfile_warning($file, undef, $fh);

@@ -1037,6 +1038,18 @@
     chmod 0755, $file;
 }

+sub make_shebang {
+    my $shebang = length $Config{perlpath} < 62
+                  ?  "#!$Config{perlpath}\n"
+                  : <<EOI;
+#!/usr/bin/perl
+    eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
+    if \$running_under_some_shell;
+EOI
+
+    return $shebang;
+}
+
 sub cpfile {
     my($self, $from, $to) = @_;
     File::Copy::copy($from, $to);

--
Mike Smith                   | MailChannels: Assured Messaging
mailto:[EMAIL PROTECTED] |   http://www.mailchannels.com

--
_____________________________________________________________
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The "Practical mod_perl" book       http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to