Skip Menu |

This queue is for tickets about the Filesys-SamFS CPAN distribution.

Report information
The Basics
Id: 34535
Status: open
Priority: 0/
Queue: Filesys-SamFS

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

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



Subject: Use prompt() in Makefile.PL to Allow Automated Tests
Dear Lupe Christoph, Hi. This is imacat from Taiwan. I'm currently helping to run smoke tests for CPAN modules. I found that the Makefile.PL of Filesys-SamFS-0.035 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 SamFS 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 Filesys-SamFS-0.035, 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: Filesys-SamFS-0.035-prompt.diff
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 diff -u -r Filesys-SamFS-0.035.orig/Makefile.PL Filesys-SamFS-0.035/Makefile.PL - --- Filesys-SamFS-0.035.orig/Makefile.PL 2000-02-23 17:46:00.000000000 +0800 +++ Filesys-SamFS-0.035/Makefile.PL 2008-03-30 01:23:56.000000000 +0800 @@ -32,9 +32,12 @@ $SamFS_dir = '/opt/LSCsamfs'; do {{ - - print "Where is SamFS located [$SamFS_dir]: "; - - $answer = <STDIN>; - - chomp $answer; + $answer = prompt("Where is SamFS located [$SamFS_dir]: "); + unless (length($answer) + && (-d $SamFS_dir && "$SamFS_dir/include" && "$SamFS_dir/lib")) { + print "Sorry, you must specify the SamFS location.\n"; + exit 0; + } $answer = $SamFS_dir unless length($answer); unless (-d $answer) { print "Sorry, but $answer is not a directory. Please try again.\n"; @@ -54,10 +57,7 @@ print "\n"; do {{ - - print "A directory in a SamFS filesystem writable by this user [$dir]: "; - - $answer = <STDIN>; - - chomp $answer; - - $answer = $dir unless length($answer); + $answer = prompt("A directory in a SamFS filesystem writable by this user [$dir]: "); unless (length($answer)) { print "Sorry, but you have to provide an answer. There is no default.\n"; next; @@ -76,10 +76,7 @@ print "\n"; do {{ - - print "The equipment ordinal of a tape drive or MO drive [$eq]: "; - - $answer = <STDIN>; - - chomp $answer; - - $answer = $eq unless length($answer); + $answer = prompt("The equipment ordinal of a tape drive or MO drive [$eq]: "); unless (length($answer)) { print "Sorry, but you have to provide an answer. There is no default.\n"; next; @@ -94,9 +91,7 @@ $catalog = '/etc/fs/samfs/sam_historian' unless defined $catalog; do {{ - - print "The location of a catalog file [$catalog]: "; - - $answer = <STDIN>; - - chomp $answer; + $answer = prompt("The location of a catalog file [$catalog]: "); $answer = $catalog unless length($answer); unless (-e $answer) { print "Sorry, but $answer does not exist. Please try again.\n"; -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkfue0cACgkQi9gubzC5S1yoPwCfb1GemCNy7l+acN7ZOy0xCxfl c6UAoJiXaNZGKPcrGQu2lzqlAsaRJLXk =HRqz -----END PGP SIGNATURE-----
Subject: Re: [rt.cpan.org #34535] Use prompt() in Makefile.PL to Allow Automated Tests
Date: Mon, 31 Mar 2008 14:16:44 +0200
To: Yi Ma Mao via RT <bug-Filesys-SamFS [...] rt.cpan.org>
From: Lupe Christoph <lupe [...] lupe-christoph.de>
On Saturday, 2008-03-29 at 13:28:06 -0400, Yi Ma Mao via RT wrote: Show quoted text
> Hi. This is imacat from Taiwan. I'm currently helping to run smoke > tests for CPAN modules. I found that the Makefile.PL of > Filesys-SamFS-0.035 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.
I'm afraid your patch does not remove the looping. There is an explicit loop that refuses to exit until it has obtained useable input. Show quoted text
> <<ExtUtils::MakeMaker>> > Other Handy Functions > http://search.cpan.org/perldoc?ExtUtils::MakeMaker#Other_Handy_Functions
I have converted the Makefile.PL to use prompt() as suggested. To solve the looping problem, I just removed the loops. That seems easier than trying to determine if STDIN is connected to a terminal and loop only then. Show quoted text
> Also, I would suggest you to exit() with 0 from the Makefile.PL if > SamFS fails, as suggested by this article:
Show quoted text
> I made a simple patch to Filesys-SamFS-0.035, in the hope that it > helps. Please tell me if you have any question, or if I could be of any > help. Thank you.
I used your patch as a basis but then modified the Makefile.PL heavily. As I had produced a new version on the request of people from the DamFS mailing list, and nobody had negative comments (in fact, I received no comments at all :-( ), I put the Makefile.PL changes in that release. I will now upload a version 0.1 to CPAN. Thanks for alerting me, Lupe Christoph -- | The whole aim of practical politics is to keep the populace alarmed | | (and hence clamorous to be led to safety) by menacing it with an | | endless series of hobgoblins, all of them imaginary. | | H. L. Mencken, "In Defense of Women", 1918 |