How to change a text look in a message?
[Apache-Test patch] for shebang lines over 64 characters long
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > Apache HTTP Server > [Apache-Test patch] for shebang lines over 64 characters long 19 December 2005 22:30:16

  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

[Apache-Test patch] for shebang lines over 64 characters long

Stas Bekman 19 December 2005 22:30:16
 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 <mike@mailchannels.­com>
To: Stas Bekman <stas@stason.org>

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

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

$self->genfile_warn­ing($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_som­e_shell;
+EOI
+
+ return $shebang;
+}
+
sub cpfile {
my($self, $from, $to) = @_;
File::Copy::copy($f­rom, $to);

--
Mike Smith | MailChannels: Assured Messaging
mailto:mike@mailcha­nnels.com | http://www.mailchan­nels.com

--
___________________­____________________­____________________­__
Stas Bekman mailto:stas@stason.­org 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­/
Add comment
Stas Bekman 16 December 2005 01:38:53 permanent link ]
 Stas Bekman wrote:> 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.

Oops, I forgot the most important part: Mike Smith <mike@mailchannels.­com>
wrote the patch :)­ Sorry, Mike.


--
___________________­____________________­____________________­__
Stas Bekman mailto:stas@stason.­org 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­/
Add comment
Stas Bekman 17 December 2005 10:03:35 permanent link ]
 Stas Bekman wrote:

I guess if there are no objections I'll commit it on Monday.

--
___________________­____________________­____________________­__
Stas Bekman mailto:stas@stason.­org 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­/
Add comment
Randy Kobes 18 December 2005 01:38:46 permanent link ]
 On Fri, 16 Dec 2005, Stas Bekman wrote:
Stas Bekman wrote:>
I guess if there are no objections I'll commit it on Monday.

Sounds good to me - I tested the patch out on Win32 with the
Apache-Test tests and also the apreq tests (which involve
some cgi tests), and these worked fine.

--
best regards,
randy
Add comment
Stas Bekman 18 December 2005 19:02:44 permanent link ]
 Randy Kobes wrote:> On Fri, 16 Dec 2005, Stas Bekman wrote:>
Stas Bekman wrote:>>
I guess if there are no objections I'll commit it on Monday.>
Sounds good to me - I tested the patch out on Win32 with the> Apache-Test tests and also the apreq tests (which involve> some cgi tests), and these worked fine.

Thanks Randy, but did you try removing the < 62 check? It's only different
from the current implementation if that exec trick is used (i.e. if you
have a very long path to perl.exe). So try to s/62/2/ or something like
that. Thanks!



--
___________________­____________________­____________________­__
Stas Bekman mailto:stas@stason.­org 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­/
Add comment
Randy Kobes 18 December 2005 22:27:38 permanent link ]
 On Sun, 18 Dec 2005, Stas Bekman wrote:
Randy Kobes wrote:>> On Fri, 16 Dec 2005, Stas Bekman wrote:>>
Stas Bekman wrote:>>>
I guess if there are no objections I'll commit it on Monday.>>
Sounds good to me - I tested the patch out on Win32 with the>> Apache-Test tests and also the apreq tests (which involve>> some cgi tests), and these worked fine.>
Thanks Randy, but did you try removing the < 62 check? It's only different > from the current implementation if that exec trick is used (i.e. if you have > a very long path to perl.exe). So try to s/62/2/ or something like that. > Thanks!

Thanks for pointing that out, Stas - I just did a s/62/2/ in
the check, to force the exec trick, and both the Apache-Test
and apreq tests still all passed.

--
best regards,
randy
Add comment
Stas Bekman 19 December 2005 22:30:16 permanent link ]
 Randy Kobes wrote:> On Sun, 18 Dec 2005, Stas Bekman wrote:>
Randy Kobes wrote:>>
On Fri, 16 Dec 2005, Stas Bekman wrote:>>>
Stas Bekman wrote:>>>>
I guess if there are no objections I'll commit it on Monday.>>>
Sounds good to me - I tested the patch out on Win32 with the>>> Apache-Test tests and also the apreq tests (which involve>>> some cgi tests), and these worked fine.>>
Thanks Randy, but did you try removing the < 62 check? It's only >> different from the current implementation if that exec trick is used >> (i.e. if you have a very long path to perl.exe). So try to s/62/2/ or >> something like that. Thanks!>
Thanks for pointing that out, Stas - I just did a s/62/2/ in> the check, to force the exec trick, and both the Apache-Test> and apreq tests still all passed.

Thanks a lot, Randy. Now committed.


--
___________________­____________________­____________________­__
Stas Bekman mailto:stas@stason.­org 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­/
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > Apache HTTP Server > [Apache-Test patch] for shebang lines over 64 characters long 19 December 2005 22:30:16

see also:
[Performance Tuning] - Re: JBoss Hang
[Beginners Corner] - Re: JSPs not…
[Installation & Configuration] - what…
пройди тесты:
What is Your Temperament?
see also:
Not until we see there fear !!!
Blackfriday&Cybermonday special…
'Jasper' Xbox 360s finally availabl...

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .