Stas Bekman wrote:
Philippe M. Chiasson wrote:

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.


for the future, this belongs to the httpd-test list, not here :)

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.


-t STDOUT should work just as well, no need for \*. we already use that in TestTrace.pm.

+        if ((lc($ans) eq 'skip' || !-t \*STDIN) && !$optional) {
             Apache::TestRun::skip_test_suite();
             next; # in case they change their mind


         my $ans = ExtUtils::MakeMaker::prompt($prompt, $default);
-        return if lc($ans) =~ /no/;
+        return if lc($ans) =~ /no/ && -t \*STDIN;
     }


but why entering these functions at all, in the !-t mode? makes the logic complicated.

Max, how about this patch?

Index: lib/Apache/TestRun.pm
===================================================================
--- lib/Apache/TestRun.pm       (revision 106304)
+++ lib/Apache/TestRun.pm       (working copy)
@@ -1284,6 +1284,9 @@
 sub skip_test_suite {
     my $no_doubt = shift;

+    # we can't prompt when there is no STDIN;
+    $no_doubt = 1 unless -t STDIN;
+
     print qq[

 Running the test suite is important to make sure that the module that
Index: lib/Apache/TestConfig.pm
===================================================================
--- lib/Apache/TestConfig.pm    (revision 106304)
+++ lib/Apache/TestConfig.pm    (working copy)
@@ -2090,6 +2090,11 @@
     my $self = shift;
     my $conf_opts = shift;

+    unless (-t STDIN) {
+        error "STDIN is closed, can't run interactive config";
+        Apache::TestRun::skip_test_suite();
+    }
+
     my $vars = $self->{vars};

     print qq[


-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

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



Reply via email to