Skip Menu |

This queue is for tickets about the Net-DHCP-Control CPAN distribution.

Report information
The Basics
Id: 34536
Status: open
Priority: 0/
Queue: Net-DHCP-Control

People
Owner: Nobody in particular
Requestors: imacat [...] mail.imacat.idv.tw
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.09
Fixed in: (no value)



Subject: Use prompt() in Makefile.PL to Allow Automated Tests
Dear Mark Jason Dominus, Hi. This is imacat from Taiwan. I'm currently helping to run smoke tests for CPAN modules. I found that the Makefile.PL of Net-DHCP-Control-0.09 goes into infinite loop if nothing is read from keyboard. I would suggest that you use prompt() instead of directly obtain input from the STDIN, as suggested in the ExtUtils::MakeMaker document, so that the it won't go into infinite loop. <<ExtUtils::MakeMaker>> Other Handy Functions http://search.cpan.org/perldoc?ExtUtils::MakeMaker#Other_Handy_Functions Also, I would suggest you to exit() with 0 from the Makefile.PL if the required answer fails, as suggested by this article: <<Notes For CPAN Authors> "How can I stop getting FAIL reports for missing libraries or other non-Perl dependencies?" http://cpantest.grango.org/wiki/CPANAuthorNotes I made a simple patch to Net-DHCP-Control-0.09, in the hope that it helps. Please tell me if you have any question, or if I could be of any help. Thank you.
Subject: Net-DHCP-Control-0.09-prompt.diff
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 diff -u -r Net-DHCP-Control-0.09.orig/config-tests Net-DHCP-Control-0.09/config-tests - --- Net-DHCP-Control-0.09.orig/config-tests 2004-03-10 01:09:37.000000000 +0800 +++ Net-DHCP-Control-0.09/config-tests 2008-03-30 01:55:39.000000000 +0800 @@ -1,6 +1,7 @@ #!perl use Data::Dumper; +use ExtUtils::MakeMaker; system("pwd"); @@ -33,9 +34,8 @@ } write_data() if $CHANGED; - -print "Hit ENTER to continue, or anything else to manually edit - -the configuration file.\n"; - -chomp(my $resp = <STDIN>) ; +$resp = prompt("Hit ENTER to continue, or anything else to manually edit +the configuration file.\n"); exit 0 if $resp eq ""; my $editor = $ENV{VISUAL} || $ENV{EDITOR} || "/bin/ed"; system($editor, $RESULT); @@ -51,8 +51,7 @@ } prompt: { my $prompt = defined($default) ? "$k [$default]> " : "$k> "; - - print $prompt; - - chomp(my $resp = <STDIN>); + $resp = prompt($prompt); $resp =~ s/^\s+//; $resp =~ s/\s+$//; @@ -63,7 +62,7 @@ if (defined $default) { $dhcpCONFIG{$k} = $default; } else { - - redo prompt; + exit 1; } } else { $dhcpCONFIG{$k} = $resp; diff -u -r Net-DHCP-Control-0.09.orig/Makefile.PL Net-DHCP-Control-0.09/Makefile.PL - --- Net-DHCP-Control-0.09.orig/Makefile.PL 2004-03-11 07:40:00.000000000 +0800 +++ Net-DHCP-Control-0.09/Makefile.PL 2008-03-30 01:53:24.000000000 +0800 @@ -2,12 +2,10 @@ use ExtUtils::MakeMaker; use Config; - -print qq{ +$resp = prompt(qq{ Part of the test suite performs possibly intrusive tests on the DHCP server. Would you like me to perform the intrusive tests? - -(Default is YES) >> }; - -chomp(my $resp = <STDIN>); - -$resp ||= "yes"; +(Default is YES) >>}, "yes"); if ($resp =~ /^[yY]/) { open F, ">", ".risky_tests" or die "Couldn't touch .risky_tests: $!\n"; close F; @@ -15,8 +13,13 @@ 1 while unlink ".risky_tests"; } - -system("$Config{perlpath} ./config-tests") == 0 - - or die "Couldn't run configurator; return status $?\n"; +if (system("$Config{perlpath} ./config-tests") != 0) { + if ($? >> 8 == 1) { + print "Configurator failed without required answer.\n"; + exit 0; + } + die "Couldn't run configurator; return status $?\n"; +} # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkfugqkACgkQi9gubzC5S1zYHQCeKqsGRh0Mz79LDuqgvjOsqk2x IV8AoKfN5TuGdDb+GvMysNM4Tc2Hp45u =xFPL -----END PGP SIGNATURE-----
On Sat Mar 29 13:57:40 2008, IMACAT wrote: Show quoted text
> Dear Mark Jason Dominus, > > Hi. This is imacat from Taiwan. I'm currently helping to run smoke > tests for CPAN modules. I found that the Makefile.PL of > Net-DHCP-Control-0.09 goes into infinite loop if nothing is read from > keyboard. I would suggest that you use prompt() instead of directly > obtain input from the STDIN, as suggested in the ExtUtils::MakeMaker > document, so that the it won't go into infinite loop. > > <<ExtUtils::MakeMaker>> > Other Handy Functions > http://search.cpan.org/perldoc?ExtUtils::MakeMaker#Other_Handy_Functions > > Also, I would suggest you to exit() with 0 from the Makefile.PL if > the required answer fails, as suggested by this article: > > <<Notes For CPAN Authors> > "How can I stop getting FAIL reports for missing libraries or other > non-Perl dependencies?" > http://cpantest.grango.org/wiki/CPANAuthorNotes > > I made a simple patch to Net-DHCP-Control-0.09, in the hope that it > helps. Please tell me if you have any question, or if I could be of any > help. Thank you.
This problem persists 9-1/2 years later. I am conducting automated tests of CPAN libraries against the most recent monthly development release of Perl 5. When the program gets to this code: ##### 940-Configuring Net-DHCP-Control-0.09 941-Running Makefile.PL 942- 943-Part of the test suite performs possibly intrusive tests on 944-the DHCP server. Would you like me to perform the intrusive tests? 945-(Default is YES) >> /home/jkeenan/var/bbc/testing/.cpanm/work/1511139219.12944/Net-DHCP-Control-0.09 946-This is the configurator for the test suite. 947-If you don't know what something is, type '?'. 948-To take the default, type ENTER. ##### ... the string 'host >' is printed tens of thousands of time on a single line. Needless to say, this causes severe bloat of the log files we use to analyze failures in tests. Please revise this so that, at the above location and all such locations, the default is 'no'. Thank you very much. Jim Keenan