Skip Menu |

This queue is for tickets about the Pod-Perldoc CPAN distribution.

Report information
The Basics
Id: 53986
Status: resolved
Priority: 0/
Queue: Pod-Perldoc

People
Owner: Nobody in particular
Requestors: kruegerm-bitcard [...] avax.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 3.14_02
  • 3.15
Fixed in: (no value)



Subject: perldoc -m option fails if PAGER environment variable value contains white space
The -m option to the perldoc command generates an error message if the value of the PAGER environment variable contains white space; for example, a value of "less --ignore-case" will cause the error. In the error case, the "less" pager is invoked before the error message appears, even if the PAGER environment variable indicates that a different pager should be used. The error appears to be due to the fact that the full value of PAGER is passed as the first argument to a system() call. Possible fixes would be to pass only the first word, or to split PAGER first and pass all the words as an array. Here is a session transcript demonstrating the bug in Pod::Perldoc 3.15; the failure in version 3.14_02 is the same, but the error message mentions line 1346 of Perldoc.pm instead of line 1437: $ uname -a Linux ala-engtools-dev 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux $ perl -v This is perl, v5.10.0 built for i686-linux-thread-multi (with 4 registered patches, see perl -V for more detail) Copyright 1987-2007, Larry Wall Binary build 1004 [287188] provided by ActiveState http://www.ActiveState.com Built Sep 3 2008 11:22:08 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. $ echo '# Module text.' > foo.pl $ PAGER='cat' perldoc -m foo.pl # Module text. $ PAGER='cat -v' perldoc -m foo.pl Can't exec "cat -v": No such file or directory at /folk/tools_test/public/install/activeperl-5.10/i686-pc-linux-gnu/site/lib/Pod/Perldoc.pm line 1437. $ perl -MPod::Perldoc -e 'print "$Pod::Perldoc::VERSION\n";' 3.15
From: dmaestro
On Mon Jan 25 17:45:18 2010, kruegerm wrote: Show quoted text
> The -m option to the perldoc command generates an error message if the > value of the PAGER environment variable contains white space; for > example, a value of "less --ignore-case" will cause the error. > > In the error case, the "less" pager is invoked before the error > message > appears, even if the PAGER environment variable indicates that a > different pager should be used. > > The error appears to be due to the fact that the full value of PAGER > is > passed as the first argument to a system() call. Possible fixes would > be to pass only the first word, or to split PAGER first and pass all > the > words as an array. >
Yes, I've had a patch for this for a little while and just got around to posting it. Show quoted text
> Here is a session transcript demonstrating the bug in Pod::Perldoc > 3.15; > the failure in version 3.14_02 is the same, but the error message > mentions line 1346 of Perldoc.pm instead of line 1437: > > $ uname -a > Linux ala-engtools-dev 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT > 2006 i686 i686 i386 GNU/Linux > $ perl -v > > This is perl, v5.10.0 built for i686-linux-thread-multi > (with 4 registered patches, see perl -V for more detail) > > Copyright 1987-2007, Larry Wall > > Binary build 1004 [287188] provided by ActiveState > http://www.ActiveState.com > Built Sep 3 2008 11:22:08 > > Perl may be copied only under the terms of either the Artistic License > or the > GNU General Public License, which may be found in the Perl 5 source > kit. > > Complete documentation for Perl, including FAQ lists, should be found > on > this system using "man perl" or "perldoc perl". If you have access to > the > Internet, point your browser at http://www.perl.org/, the Perl Home > Page. > > $ echo '# Module text.' > foo.pl > $ PAGER='cat' perldoc -m foo.pl > # Module text. > $ PAGER='cat -v' perldoc -m foo.pl > Can't exec "cat -v": No such file or directory at > /folk/tools_test/public/install/activeperl-5.10/i686-pc-linux- > gnu/site/lib/Pod/Perldoc.pm > line 1437. > $ perl -MPod::Perldoc -e 'print "$Pod::Perldoc::VERSION\n";' > 3.15
Subject: perlcritic_multiver.patch
--- ./Perl/Critic/PolicyFactory.pm.org 2010-11-29 12:06:45.000000000 -0500 +++ ./Perl/Critic/PolicyFactory.pm 2011-01-07 11:49:56.000000000 -0500 @@ -300,7 +300,8 @@ my %known_policies = hashify( $self->site_policy_names() ); for my $policy_name ( $profile->listed_policies() ) { - if ( not exists $known_policies{$policy_name} ) { + if ( not exists $known_policies{$policy_name} and + not $profile->policy_is_disabled($policy_name) ) { my $message = qq{Policy "$policy_name" is not installed.}; if ( $errors ) {
From: dmaestro
Oops, posted the wrong one ... ignore above attachement. On Fri Jan 28 12:21:10 2011, http://dmaestro12.myopenid.com/ wrote: Show quoted text
> On Mon Jan 25 17:45:18 2010, kruegerm wrote:
> > The -m option to the perldoc command generates an error message if the > > value of the PAGER environment variable contains white space; for > > example, a value of "less --ignore-case" will cause the error. > > > > In the error case, the "less" pager is invoked before the error > > message > > appears, even if the PAGER environment variable indicates that a > > different pager should be used. > > > > The error appears to be due to the fact that the full value of PAGER > > is > > passed as the first argument to a system() call. Possible fixes would > > be to pass only the first word, or to split PAGER first and pass all > > the > > words as an array. > >
> > Yes, I've had a patch for this for a little while and just got around to > posting it. >
Subject: Perldoc-1.patch
--- Pod/Perldoc.pm.org 2009-10-02 15:29:09.000000000 -0400 +++ Pod/Perldoc.pm 2010-11-29 10:11:07.000000000 -0500 @@ -1348,7 +1348,7 @@ foreach my $pager ( $self->pagers ) { $self->aside("About to try calling $pager @found\n"); - if (system($pager, @found) == 0) { + if (system(split(/\s+(?=-)/, $pager), @found) == 0) { $self->aside("Yay, it worked.\n"); return 0; }
On Fri Jan 28 12:23:22 2011, http://dmaestro12.myopenid.com/ wrote: Show quoted text
> Oops, posted the wrong one ... ignore above attachement. > > On Fri Jan 28 12:21:10 2011, http://dmaestro12.myopenid.com/ wrote:
> > On Mon Jan 25 17:45:18 2010, kruegerm wrote:
> > > The -m option to the perldoc command generates an error message if the > > > value of the PAGER environment variable contains white space; for > > > example, a value of "less --ignore-case" will cause the error. > > > > > > In the error case, the "less" pager is invoked before the error > > > message > > > appears, even if the PAGER environment variable indicates that a > > > different pager should be used. > > > > > > The error appears to be due to the fact that the full value of PAGER > > > is > > > passed as the first argument to a system() call. Possible fixes would > > > be to pass only the first word, or to split PAGER first and pass all > > > the > > > words as an array. > > >
> > > > Yes, I've had a patch for this for a little while and just got around to > > posting it.
In the general sense, this expression must be system(EXPR), not system(LIST). Perl's Configure supplies the value $Config{pager} which requires shell expansion. In general, this is because our use of less must also pass the the -r or -R parameters (I forget which - it's one of them). I've attached a patch against bleadperl which approaches the problem from this direction.
Subject: 0001-Handle-artificial-signals.patch
From a119438e06cb7278eafdd3b26960d78f17abb740 Mon Sep 17 00:00:00 2001 From: Josh ben Jore <jjore@cpan.org> Date: Tue, 10 May 2011 12:39:37 -0700 Subject: [PATCH] Handle artificial signals --- mg.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/mg.c b/mg.c index 85b5461..42037fc 100644 --- a/mg.c +++ b/mg.c @@ -1460,10 +1460,26 @@ Perl_despatch_signals(pTHX) dVAR; int sig; PL_sig_pending = 0; + + /* Normal signal handlers never set PL_sig_pending=1 when there's * no PL_psig_pend so this case is pathological and is here so a * user can attach to a process with gdb and fake a signal to let * perl advance to a safe place for running arbitrary code, i.e., + * + * set PL_sig_pending = 1 + * break Perl_despatch_signals + * continue + * if Perl_get_context() + * call Perl_eval_pv(Perl_get_context(), "print qq{Hello world!\n}", 0) + * else + * call Perl_eval_pv("print qq{Hello world!\n}", 0) + * end + * detach + */ + if (!PL_psig_pend) { + return; + } + for (sig = 1; sig < SIG_SIZE; sig++) { if (PL_psig_pend[sig]) { dSAVE_ERRNO; -- 1.7.4.1
I've patched this in https://github.com/briandfoy/Pod-Perldoc as commit 43d557b31794a3a3c996976ea66fb1aa164d0fb4, but I think it requires more investigation. I haven't tested it.
This is resolved in the next release 3.16. Thanks.