Skip Menu |

This queue is for tickets about the podlators CPAN distribution.

Report information
The Basics
Id: 88724
Status: resolved
Priority: 0/
Queue: podlators

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

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



Subject: Insufficient sanity check
I discovered this bug in the context of a pod2man call on a binary file and then I reduced the issue to the following one^Wsixliner: perl -e ' use Pod::Man; for my $i (128){ # pick any number 128..255 my $content = "=".chr($i); eval { Pod::Man->new->parse_string_document($content) }; printf "%d: %s\n", $i, $@; }' 128: Modification of non-creatable array value attempted, subscript -1 at /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3/a2da/lib/5.19.3/Pod/Man.pm line 287. I'm not sure what the right fix for this should be. In any case this error message is quite suboptimal, so I set this ticket up with "insufficient sanity check". Thanks,
Subject: Re: [rt.cpan.org #88724] Insufficient sanity check
Date: Tue, 17 Sep 2013 08:56:08 -0700
To: bug-Pod-Simple [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
Shouldn’t this be in the podlaters queue? That’s the distribution that includes Pod::Man. https://rt.cpan.org/Public/Dist/Display.html?Name=podlators Best, David
Show quoted text
> Shouldn’t this be in the podlaters queue?
Maybe, but run the snippet with Carp::Always and see who was the last caller: perl -e ' use Pod::Man; use Carp::Always; for my $i (128){ # pick any number 128..255 my $content = "=".chr($i); eval { Pod::Man->new->parse_string_document($content) }; printf "%d: %s\n", $i, $@; }' 128: Modification of non-creatable array value attempted, subscript -1 at /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3/a2da/lib/5.19.3/Pod/Man.pm line 287. Pod::Man::_handle_element_start('Pod::Man=HASH(0x1af58a0)', 'head1', 'HASH(0x1b0a1f0)') called at /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3/a2da/lib/site_perl/5.19.3/Pod/Simple/BlackBox.pm line 1484 Pod::Simple::BlackBox::_traverse_treelet_bit(undef, undef, 'HASH(0x1b0a1f0)', 'POD ERRORS') called at /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3/a2da/lib/site_perl/5.19.3/Pod/Simple/BlackBox.pm line 880 Pod::Simple::BlackBox::_ponder_paragraph_buffer('Pod::Man=HASH(0x1af58a0)') called at /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3/a2da/lib/site_perl/5.19.3/Pod/Simple/BlackBox.pm line 76 Pod::Simple::BlackBox::parse_lines('Pod::Man=HASH(0x1af58a0)', undef) called at /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3/a2da/lib/site_perl/5.19.3/Pod/Simple.pm line 405 Pod::Simple::parse_string_document('Pod::Man=HASH(0x1af58a0)', '=\x{80}') called at -e line 6 eval {...} called at -e line 6 Downgrading the Pod::Simple 3.20 makes this bug disappear.
Subject: Re: [rt.cpan.org #88724] Insufficient sanity check
Date: Tue, 17 Sep 2013 21:22:46 -0700
To: bug-Pod-Simple [...] rt.cpan.org
From: "David E. Wheeler" <david [...] justatheory.com>
On Sep 17, 2013, at 8:20 PM, Andreas Koenig via RT <bug-Pod-Simple@rt.cpan.org> wrote: Show quoted text
> Maybe, but run the snippet with Carp::Always and see who was the last caller:
Hrm. Couldn't replicate using Pod::Man or Pod::Simple. Updated Pod::Man, still not replicated. Updated Pod::Simple, replicate (though only when using Pod::Man -- not when using Pod::Simple). So I stepped back in time to each release until I found one that didn't die, which was v3.21. Git bisected up to v3.22 and found the commit that causes the bug: https://github.com/theory/pod-simple/commit/b67b902bfd49efb1461d3fc8f31b18c00e56be35 So I've opened an issue on GitHub for it: https://github.com/theory/pod-simple/issues/51 Thanks, David
Download smime.p7s
application/pkcs7-signature 4.2k

Message body not shown because it is not plain text.

On Wed Sep 18 00:23:13 2013, david@justatheory.com wrote: Show quoted text
> On Sep 17, 2013, at 8:20 PM, Andreas Koenig via RT <bug-Pod- > Simple@rt.cpan.org> wrote: >
> > Maybe, but run the snippet with Carp::Always and see who was the last > > caller:
> > Hrm. Couldn't replicate using Pod::Man or Pod::Simple. Updated > Pod::Man, still not replicated. Updated Pod::Simple, replicate (though > only when using Pod::Man -- not when using Pod::Simple). > > So I stepped back in time to each release until I found one that > didn't die, which was v3.21. Git bisected up to v3.22 and found the > commit that causes the bug: > > https://github.com/theory/pod- > simple/commit/b67b902bfd49efb1461d3fc8f31b18c00e56be35 > > So I've opened an issue on GitHub for it: > > https://github.com/theory/pod-simple/issues/51
David asked me to look at the issue on GitHub since I was responsible for the commit referenced above. If I understand correctly, the problem being reported here is that this 1-liner: perl -MPod::Man -e 'Pod::Man->new->parse_string_document("=\x80")' will die with this error: Modification of non-creatable array value attempted, subscript -1 at lib/Pod/Man.pm ... The condition that is triggering this failure is indeed the new parse warning introduced in my commit, however the same result can be triggered on versions of Pod::Simple that pre-date my change, with this 1-liner: perl -MPod::Man -e 'Pod::Man->new->parse_string_document("=cut")' The problem seems to relate to the fact that both these snippets of POD source trigger parse warnings but are otherwise empty. Under these circumstances, Pod::Simple will generate an errata section and perhaps Pod::Man is not in a suitable state to handle the errata section if it hasn't seen any preceding document elements (wild guess on my part). Regards Grant
RT-Send-CC: dwheeler [...] cpan.org, grantm [...] cpan.org
Thanks, Grant, for taking the time and coming up with the better example. Your explanation sounds plausible. I'll try to move the ticket onto the podlators queue.
Could podlators please comment on the nature of this bug and what needs to be fixed? Thanks!
Subject: Re: [rt.cpan.org #88724] Insufficient sanity check
Date: Wed, 18 Sep 2013 09:25:05 -0700
To: bug-Pod-Simple [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
On Sep 18, 2013, at 2:05 AM, Grant McLean via RT <bug-Pod-Simple@rt.cpan.org> wrote: Show quoted text
> perl -MPod::Man -e 'Pod::Man->new->parse_string_document("=cut")' > > The problem seems to relate to the fact that both these snippets of POD source trigger parse warnings but are otherwise empty. Under these circumstances, Pod::Simple will generate an errata section and perhaps Pod::Man is not in a suitable state to handle the errata section if it hasn't seen any preceding document elements (wild guess on my part).
So, Pod::Man issue, then? Thanks, David
On 2013-09-18 12:25:19, DWHEELER wrote: Show quoted text
> So, Pod::Man issue, then?
Ah, already moved over to the podlater queue. Sorry. David
Subject: Re: [rt.cpan.org #88724] Insufficient sanity check
Date: Wed, 18 Sep 2013 10:19:57 -0700
To: bug-podlators [...] rt.cpan.org
From: Russ Allbery <rra [...] stanford.edu>
"Andreas Koenig via RT" <bug-podlators@rt.cpan.org> writes: Show quoted text
> Queue: podlators > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=88724 >
Show quoted text
> Could podlators please comment on the nature of this bug and what needs > to be fixed?
Will do. I'm hoping to fix a bunch of bugs in podlators fairly soon now, as I've been remiss in my maintenance. -- Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
RT-Send-CC: dwheeler [...] cpan.org
On 2013-09-18 03:32:12, ANDK wrote: Show quoted text
> Could podlators please comment on the nature of this bug and what > needs to be fixed?
This will be fixed in the next release of podlators. The problem was that, for these documents, Pod::Simple sets the flag indicating that they're contentless. In an ill-advised meaningless optimization, Pod::Man (and Pod::Text) didn't set up internal state for output of documents that are contentless. However, in this case, the supposedly contentless document still has a POD ERRORS section and content, so subsequent processing referenced data structures that weren't initialized. I think it's a little weird that Pod::Simple claims a document with content (even manufactured content) is contentless, but there may be some reason to keep that behavior so that callers can still treat empty documents with errors as empty documents. Regardless, it's now fixed in my development tree by removing the ill-advised and useless optimization and doing full setup for empty documents.
CC: ANDK [...] cpan.org
Subject: Re: [rt.cpan.org #88724] Insufficient sanity check
Date: Sun, 22 Sep 2013 09:21:34 +0200
To: bug-podlators [...] rt.cpan.org
From: Andreas Koenig <andreas.koenig.7os6VVqR [...] franz.ak.mind.de>
Excellent, this is good news, thanks a lot Russ, -- andreas
Fixed in 2.5.2, now released. Note that the test I added made the mistake of assuming that this error would always occur, so it fails on all Perls with older Pod::Simple. I will release 2.5.3 to fix that.