Skip Menu |

This queue is for tickets about the podlators CPAN distribution.

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

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

Bug Information
Severity: Normal
Broken in: 1.00
Fixed in: 2.4.1



Subject: pod2man: no exit code & empty files left behind
pod2man always exit with status 0 even if conversion failed. Worse, empty files left behind, for example if invoked like pod2man /dev/null null.1 && echo OK "OK" will be printed and empty file "null.1" will be created. Empty file left by Pod::Simple because it create output file before content generation. If no content produced, empty file left behind. On top of this pod2man exit with status code 0 disregarding conversion result. The attached patch addresses both problems. (Sorry for not making test case for this) Regards, Dmitry. P.S. corresponding Debian bug number is #659939, see http://bugs.debian.org/659939
Subject: pod2man_exit-status.patch
Author: Dmitry Smirnov <onlyjob@member.fsf.org> Last-Update: 2012-02-18 Forwarded: yes Bug-Debian: http://bugs.debian.org/659939 Description: return code & empty files cleanup for pod2man pod2man leaves empty file if no POD content in input file. This is because Pod::Simple create file before generating output. If there is no content, empty file left behind. . On top of this pod2man always exit with status code 0 disregarding conversion result. This patch addresses both problems. --- a/cpan/podlators/scripts/pod2man.PL +++ b/cpan/podlators/scripts/pod2man.PL @@ -83,13 +83,21 @@ # Initialize and run the formatter, pulling a pair of input and output off at # a time. my $parser = Pod::Man->new (%options); +my $exit_status=0; my @files; do { @files = splice (@ARGV, 0, 2); print " $files[1]\n" if $verbose; - $parser->parse_from_file (@files); + my $pff_ref=$parser->parse_from_file (@files); + if($pff_ref->{'CONTENTLESS'}){ # no output content + $exit_status+=1; + unlink $files[1] unless -s $files[1]; # remove empty destination + # file if no output produced + } } while (@ARGV); +exit $exit_status; + __END__ =head1 NAME
Subject: Re: [rt.cpan.org #75099] pod2man: no exit code & empty files left behind
Date: Sat, 26 May 2012 12:07:53 -0700
To: bug-podlators [...] rt.cpan.org
From: Russ Allbery <rra [...] stanford.edu>
"Dmitry Smirnov via RT" <bug-podlators@rt.cpan.org> writes: Show quoted text
> pod2man always exit with status 0 even if conversion failed.
Show quoted text
> Worse, empty files left behind, for example if invoked like
Show quoted text
> pod2man /dev/null null.1 && echo OK
Show quoted text
> "OK" will be printed and empty file "null.1" will be created.
Show quoted text
> Empty file left by Pod::Simple because it create output file before > content generation. If no content produced, empty file left behind.
Show quoted text
> On top of this pod2man exit with status code 0 disregarding > conversion result.
Show quoted text
> The attached patch addresses both problems. (Sorry for not making test > case for this)
Making a test case for this is quite difficult given the current test suite structure. I gave up on it too. :) Thanks, something similar to this has been applied for the next podlators release. -- Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>