Max Maischein via RT wrote:

This message about Apache-Test was sent to you by [EMAIL PROTECTED] <[EMAIL 
PROTECTED]> via rt.cpan.org

Full context and any attached attachments can be found at:
<URL: https://rt.cpan.org/Ticket/Display.html?id=8418 >

Hello,

the Apache::Test Makefile.PL enters an infinite loop when it is running without a connected terminal and can't find the path to httpd. This is very bad for CPAN testers who maybe don't have a httpd binary somewhere to be found, and where the testing runs unattended. Please use the prompt() function in ExtUtils::MakeMaker and don't enter a loop if the default is accepted, or detect that Makefile.PL is run in unattended mode and don't enter the loop at all.


We are already using ExtUtils::MakeMaker::prompt(), but the problem is that we don't quite
handle non-console TTYs proprely and do indeed loop infinitely. Easy to reproduce on a
system without httpd/apxs

Following patch fixes the problem for me.
Index: Apache-Test/lib/Apache/TestConfig.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.254
diff -u -I$Id -r1.254 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm        28 Oct 2004 23:03:29 -0000      
1.254
+++ Apache-Test/lib/Apache/TestConfig.pm        13 Nov 2004 23:55:26 -0000
@@ -2230,7 +2230,7 @@
 
         # stop the test suite without an error (so automatic tools
         # like CPAN.pm will be able to continue)
-        if (lc($ans) eq 'skip' && !$optional) {
+        if ((lc($ans) eq 'skip' || !-t \*STDIN) && !$optional) {
             Apache::TestRun::skip_test_suite();
             next; # in case they change their mind
         }
Index: Apache-Test/lib/Apache/TestRun.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.184
diff -u -I$Id -r1.184 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm   4 Nov 2004 05:05:00 -0000       1.184
+++ Apache-Test/lib/Apache/TestRun.pm   13 Nov 2004 23:55:27 -0000
@@ -1297,7 +1297,7 @@
         my $default = 'No';
         my $prompt = 'Skip the test suite?';
         my $ans = ExtUtils::MakeMaker::prompt($prompt, $default);
-        return if lc($ans) =~ /no/;
+        return if lc($ans) =~ /no/ && -t \*STDIN;
     }
 
     error "Skipping the test suite execution, while returning success status";

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to