Skip Menu |

This queue is for tickets about the Term-ReadLine-Gnu CPAN distribution.

Maintainer(s)' notes

When you report a bug, please provide the following information;

- output of
	perl -V
	perl Makefile.PL verbose
	make test TEST_VERBOSE=1
	perl -Mblib t/00checkver.t
	echo $TERM
- terminal emulator which you are using
- compiler which is used to compile the GNU Readline Library (libreadline.a) if you can know.
Read INSTALL in the distribution for more details.

Report information
The Basics
Id: 128806
Status: patched
Priority: 0/
Queue: Term-ReadLine-Gnu

People
Owner: HAYASHI [...] cpan.org
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.36
Fixed in: (no value)



Subject: Test suite fails if TERM environment variable is unset
See subject. This can be easily reproduced: ... (unset TERM; perl5.26.2 -Mblib t/00checkver.t) 1..4 ok 1 - load done Use of uninitialized value $Term::ReadLine::Gnu::VERSION in concatenation (.) or string at t/00checkver.t line 29. # I'm testing Term::ReadLine::Gnu version not ok 2 - An object of class 'Term::ReadLine::Stub' isa 'Term::ReadLine' # Failed test 'An object of class 'Term::ReadLine::Stub' isa 'Term::ReadLine'' # at t/00checkver.t line 32. # The object of class 'Term::ReadLine::Stub' isn't a 'Term::ReadLine' not ok 3 - 'Attribs' isa 'Term::ReadLine' # Failed test ''Attribs' isa 'Term::ReadLine'' # at t/00checkver.t line 34. # 'Attribs' isn't a 'Term::ReadLine' # OS: linux # Perl version: 5.026002 Use of uninitialized value in concatenation (.) or string at t/00checkver.t line 38. Use of uninitialized value in printf at t/00checkver.t line 38. # GNU Readline Library version: , 0x0 Use of uninitialized value $ENV{"TERM"} in concatenation (.) or string at t/00checkver.t line 39. # $TERM= ok 4 - library_version and readline_version # Looks like you failed 2 tests of 4. (More test scripts also fail like this) Some of my smokers are operating as a cronjob. Typically cronjobs have no tty and also no TERM environment variable set.
Thank you for your report. If $TERM is not set properly, the GNU Readline Library does not work. So Term::ReadLine::Gnu let Term::ReadLine choose Term::ReadLine::Stub instead of Term::ReadLine::Gnu. This feature was implemented in Term::ReadLine::Gnu-1.36. See https://rt.cpan.org/Ticket/Display.html?id=123398 for more details. Show quoted text
> Some of my smokers are operating as a cronjob. Typically cronjobs have no tty and also no TERM environment variable set.
On this environment the GNU Readline Library does not work. 'make test' does not make any sense. I will add the following fix on the next release. --- Makefile.PL (revision 563) +++ Makefile.PL (working copy) @@ -32,6 +32,12 @@ warn "cannot open /dev/tty\n"; exit 0; } +# test $TERM for CPAN Testers +if ($ENV{AUTOMATED_TESTING} + && (!exists($ENV{TERM}) || !defined($ENV{TERM}) || $ENV{TERM} =~ /^(dumb|emacs|unknown|)$/)) { + warn "wrong \$TERM value: $ENV{TERM}\n"; + exit 0; +} # I could not reach a tester, "Chris Williams (BINGOS)". #if ($ENV{AUTOMATED_TESTING} && ($Config{osname} eq 'openbsd')) { # die "OS unsupported\nPlease contact the author.\n";
On Sat Mar 16 10:20:01 2019, HAYASHI wrote: Show quoted text
> Thank you for your report. > > If $TERM is not set properly, the GNU Readline Library does not work. > So Term::ReadLine::Gnu let Term::ReadLine choose Term::ReadLine::Stub > instead of Term::ReadLine::Gnu. > This feature was implemented in Term::ReadLine::Gnu-1.36. > See https://rt.cpan.org/Ticket/Display.html?id=123398 for more > details. >
> > Some of my smokers are operating as a cronjob. Typically cronjobs > > have no tty and also no TERM environment variable set.
> > On this environment the GNU Readline Library does not work. 'make > test' does not make any sense. > > I will add the following fix on the next release. > > --- Makefile.PL (revision 563) > +++ Makefile.PL (working copy) > @@ -32,6 +32,12 @@ > warn "cannot open /dev/tty\n"; > exit 0; > } > +# test $TERM for CPAN Testers > +if ($ENV{AUTOMATED_TESTING} > + && (!exists($ENV{TERM}) || !defined($ENV{TERM}) || $ENV{TERM} =~ > /^(dumb|emacs|unknown|)$/)) { > + warn "wrong \$TERM value: $ENV{TERM}\n"; > + exit 0; > +} > # I could not reach a tester, "Chris Williams (BINGOS)". > #if ($ENV{AUTOMATED_TESTING} && ($Config{osname} eq 'openbsd')) { > # die "OS unsupported\nPlease contact the author.\n";
I encountered the problem described by Slaven in the OP this week while testing the CPAN-River-3000 against perl-5.31.1. This is an automated testing situation. In the basic run of the program, I got this excerpt from the cpanm output: ##### { author => "HAYASHI", dist => "Term-ReadLine-Gnu", distname => "Term-ReadLine-Gnu-1.36", distversion => 1.36, grade => "FAIL", prereqs => undef, test_output => [ "Building and testing Term-ReadLine-Gnu-1.36", "cp Gnu/XS.pm blib/lib/Term/ReadLine/Gnu/XS.pm", "AutoSplitting blib/lib/Term/ReadLine/Gnu/XS.pm (blib/lib/auto/Term/ReadLine/Gnu/XS)", "blib/lib/Term/ReadLine/Gnu/XS.pm: some names are not unique when truncated to 8 characters:", " directory blib/lib/auto/Term/ReadLine/Gnu/XS:", " rl_bind_key.al, rl_bind_key_if_unbound.al, rl_bind_keyseq.al, rl_bind_keyseq_if_unbound.al truncate to rl_bind_", " rl_set_keymap.al, rl_set_key.al truncate to rl_set_k", "cp Gnu.pm blib/lib/Term/ReadLine/Gnu.pm", "Running Mkbootstrap for Gnu ()", "chmod 644 \"Gnu.bs\"", "\"/usr/home/jkeenan/var/tad/testing/perl-5.31.1/bin/perl\" -MExtUtils::Command::MM -e 'cp_nonempty' -- Gnu.bs blib/arch/auto/Term/ReadLine/Gnu/Gnu.bs 644", "\"/usr/home/jkeenan/var/tad/testing/perl-5.31.1/bin/perl\" \"/home/jkeenan/var/tad/testing/perl-5.31.1/lib/5.31.1/ExtUtils/xsubpp\" -typemap '/home/jkeenan/var/tad/testing/perl-5.31.1/lib/5.31.1/ExtUtils/typemap' -typemap '/usr/home/jkeenan/var/tad/testing/perl-5.31.1/.cpanm/work/1563027864.26470/Term-ReadLine-Gnu-1.36/typemap' Gnu.xs > Gnu.xsc", "mv Gnu.xsc Gnu.c", "cc -c -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_FORTIFY_SOURCE=2 -O2 -pipe -fstack-protector -fno-strict-aliasing -DVERSION=\\\"1.36\\\" -DXS_VERSION=\\\"1.36\\\" -DPIC -fPIC \"-I/home/jkeenan/var/tad/testing/perl-5.31.1/lib/5.31.1/amd64-freebsd-thread-multi/CORE\" -O -DTRG_READLINE_VERSION=0x0800 Gnu.c", "In file included from Gnu.xs:20:", "./ppport.h:4471:11: warning: 'WIDEST_UTYPE' macro redefined [-Wmacro-redefined]", "# define WIDEST_UTYPE U64TYPE", " ^", "/home/jkeenan/var/tad/testing/perl-5.31.1/lib/5.31.1/amd64-freebsd-thread-multi/CORE/handy.h:1072:12: note: previous definition is here", "# define WIDEST_UTYPE U64", " ^", "1 warning generated.", "rm -f blib/arch/auto/Term/ReadLine/Gnu/Gnu.so", "LD_RUN_PATH=\"/usr/local/lib:/usr/lib\" cc -shared -L/usr/local/lib -fstack-protector-strong Gnu.o -o blib/arch/auto/Term/ReadLine/Gnu/Gnu.so -lreadline -ltermcap -lcrypt ", "chmod 755 blib/arch/auto/Term/ReadLine/Gnu/Gnu.so", "cp eg/perlsh blib/script/perlsh", "\"/usr/home/jkeenan/var/tad/testing/perl-5.31.1/bin/perl\" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/perlsh", "\"/usr/home/jkeenan/var/tad/testing/perl-5.31.1/bin/perl\" -MExtUtils::Command::MM -e 'cp_nonempty' -- Gnu.bs blib/arch/auto/Term/ReadLine/Gnu/Gnu.bs 644", "PERL_DL_NONLAZY=1 \"/usr/home/jkeenan/var/tad/testing/perl-5.31.1/bin/perl\" \"-MExtUtils::Command::MM\" \"-MTest::Harness\" \"-e\" \"undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')\" t/*.t", "Use of uninitialized value \$Term::ReadLine::Gnu::VERSION in concatenation (.) or string at t/00checkver.t line 29.", "", "# Failed test 'An object of class 'Term::ReadLine::Stub' isa 'Term::ReadLine''", "# at t/00checkver.t line 32.", "# The object of class 'Term::ReadLine::Stub' isn't a 'Term::ReadLine'", "", "# Failed test ''Attribs' isa 'Term::ReadLine''", "# at t/00checkver.t line 34.", "# 'Attribs' isn't a 'Term::ReadLine'", "Use of uninitialized value in concatenation (.) or string at t/00checkver.t line 38.", "Use of uninitialized value in printf at t/00checkver.t line 38.", "Use of uninitialized value \$ENV{\"TERM\"} in concatenation (.) or string at t/00checkver.t line 39.", "# Looks like you failed 2 tests of 4.", "t/00checkver.t ... ", "Dubious, test returned 2 (wstat 512, 0x200)", "Failed 2/4 subtests ", "t/01test_use.t ... ok", "t/02test_use.t ... ok", "", "# Failed test 'An object of class 'Term::ReadLine::Stub' isa 'Term::ReadLine''", "# at t/callback.t line 38.", "# The object of class 'Term::ReadLine::Stub' isn't a 'Term::ReadLine'", "", "# Failed test ''Attribs' isa 'Term::ReadLine''", "# at t/callback.t line 40.", "# 'Attribs' isn't a 'Term::ReadLine'", "Use of uninitialized value in pattern match (m//) at t/callback.t line 42.", "# skipped since Tk is not available.", "# Looks like you failed 2 tests of 8.", "t/callback.t ..... ", "Dubious, test returned 2 (wstat 512, 0x200)", "Failed 2/8 subtests ", "Use of uninitialized value \$Term::ReadLine::Gnu::VERSION in concatenation (.) or string at t/history.t line 36.", "", "# Failed test 'An object of class 'Term::ReadLine::Stub' isa 'Term::ReadLine''", "# at t/history.t line 42.", "# The object of class 'Term::ReadLine::Stub' isn't a 'Term::ReadLine'", "", "# Failed test '\$t->ReadLine'", "# at t/history.t line 48.", "", "# Failed test ''Attribs' isa 'Term::ReadLine''", "# at t/history.t line 55.", "# 'Attribs' isn't a 'Term::ReadLine'", "Use of uninitialized value in pattern match (m//) at t/history.t line 57.", "Can't locate object method \"using_history\" via package \"Term::ReadLine::Stub\" at t/history.t line 64.", "# Looks like your test exited with 255 just after 4.", "t/history.t ...... ", "Dubious, test returned 255 (wstat 65280, 0xff00)", "Failed 87/88 subtests ", "Bareword \"ISKMAP\" not allowed while \"strict subs\" in use at t/readline.t line 302.", "Bareword \"ISFUNC\" not allowed while \"strict subs\" in use at t/readline.t line 305.", "Bareword \"ISMACR\" not allowed while \"strict subs\" in use at t/readline.t line 309.", "Bareword \"RL_STATE_INITIALIZED\" not allowed while \"strict subs\" in use at t/readline.t line 152.", "Bareword \"ISFUNC\" not allowed while \"strict subs\" in use at t/readline.t line 222.", "Bareword \"ISFUNC\" not allowed while \"strict subs\" in use at t/readline.t line 234.", "Bareword \"ISKMAP\" not allowed while \"strict subs\" in use at t/readline.t line 318.", "Bareword \"ISMACR\" not allowed while \"strict subs\" in use at t/readline.t line 322.", "Bareword \"prompt\" not allowed while \"strict subs\" in use at t/readline.t line 659.", "Bareword \"prompt\" not allowed while \"strict subs\" in use at t/readline.t line 663.", "Bareword \"prompt\" not allowed while \"strict subs\" in use at t/readline.t line 665.", "Bareword \"prompt\" not allowed while \"strict subs\" in use at t/readline.t line 669.", "Bareword \"prompt\" not allowed while \"strict subs\" in use at t/readline.t line 671.", "Bareword \"ISFUNC\" not allowed while \"strict subs\" in use at t/readline.t line 988.", "Bareword \"ISKMAP\" not allowed while \"strict subs\" in use at t/readline.t line 988.", "Bareword \"ISMACR\" not allowed while \"strict subs\" in use at t/readline.t line 988.", "Bareword \"prompt\" not allowed while \"strict subs\" in use at t/readline.t line 997.", "Execution of t/readline.t aborted due to compilation errors.", "# Looks like your test exited with 255 before it could output anything.", "t/readline.t ..... ", "Dubious, test returned 255 (wstat 65280, 0xff00)", "Failed 147/147 subtests ", "Use of uninitialized value \$Term::ReadLine::Gnu::VERSION in concatenation (.) or string at t/utf8_binary.t line 43.", "", "# Failed test 'An object of class 'Term::ReadLine::Stub' isa 'Term::ReadLine''", "# at t/utf8_binary.t line 90.", "# The object of class 'Term::ReadLine::Stub' isn't a 'Term::ReadLine'", "", "# Failed test 'input layers after 'new''", "# at t/utf8_binary.t line 95.", "# Structures begin differing at:", "# \$got->[2] = Does not exist", "# \$expected->[2] = 'stdio'", "", "# Failed test 'output layers after 'new''", "# at t/utf8_binary.t line 98.", "# Structures begin differing at:", "# \$got->[2] = Does not exist", "# \$expected->[2] = 'stdio'", "# Looks like you failed 3 tests of 13.", "t/utf8_binary.t .. ", "Dubious, test returned 3 (wstat 768, 0x300)", "Failed 3/13 subtests ", "Use of uninitialized value \$Term::ReadLine::Gnu::VERSION in concatenation (.) or string at t/utf8_text.t line 48.", "", "# Failed test 'An object of class 'Term::ReadLine::Stub' isa 'Term::ReadLine''", "# at t/utf8_text.t line 116.", "# The object of class 'Term::ReadLine::Stub' isn't a 'Term::ReadLine'", "# Looks like you failed 1 test of 14.", "t/utf8_text.t .... ", "Dubious, test returned 1 (wstat 256, 0x100)", "Failed 1/14 subtests ", "", "Test Summary Report", "-------------------", "t/00checkver.t (Wstat: 512 Tests: 4 Failed: 2)", " Failed tests: 2-3", " Non-zero exit status: 2", "t/callback.t (Wstat: 512 Tests: 8 Failed: 2)", " Failed tests: 2-3", " Non-zero exit status: 2", "t/history.t (Wstat: 65280 Tests: 4 Failed: 3)", " Failed tests: 2-4", " Non-zero exit status: 255", " Parse errors: Bad plan. You planned 88 tests but ran 4.", "t/readline.t (Wstat: 65280 Tests: 0 Failed: 0)", " Non-zero exit status: 255", " Parse errors: Bad plan. You planned 147 tests but ran 0.", "t/utf8_binary.t (Wstat: 768 Tests: 13 Failed: 3)", " Failed tests: 6-8", " Non-zero exit status: 3", "t/utf8_text.t (Wstat: 256 Tests: 14 Failed: 1)", " Failed test: 7", " Non-zero exit status: 1", "Files=8, Tests=47, 1 wallclock secs ( 0.03 usr 0.03 sys + 0.79 cusr 0.30 csys = 1.15 CPU)", "Result: FAIL", ], via => "App::cpanminus::reporter 0.17 (1.7044)", } ##### Since cpanm graded this distribution as FAIL, it was not installed -- and none of its reverse dependencies was reached during testing. I then went into the cpanm build directory for this distribution and ran 'make test'. Here, the result was a PASS. I tried Slaven's 'unset TERM' experiment and got failures. So, yes, this distribution's test suite needs to be adapted for automated testing environments. Thank you very much. Jim Keenan