Skip Menu |

This queue is for tickets about the Log-Report CPAN distribution.

Report information
The Basics
Id: 68496
Status: resolved
Priority: 0/
Queue: Log-Report

People
Owner: Nobody in particular
Requestors: zhull [...] jetpay.com
Cc:
AdminCc:

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



Subject: Log::Report::report exits with a status code of 0 by default.
Date: Thu, 26 May 2011 18:27:02 -0500
To: bug-Log-Report [...] rt.cpan.org
From: "Zephaniah E. Loss-Cutler-Hull" <zhull [...] jetpay.com>
The documentation for report states that the exit status is the value of the errno option, and that the default if the errno option is not provided (due to being called as error or the like) is $! or 1. The code (in Report.pm, v0.92, line 147) reads: $^S or exit($opts->{errno} || 0); This ignores $? and defaults to 0. The result is that a program that calls error() will exit with an exit status of 0, indicating to the parent program that it exited without error. This is obviously incorrect. Thank you, Zephaniah E. Loss-Cutler-Hull.
Download signature.asc
application/pgp-signature 836b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #68496] Log::Report::report exits with a status code of 0 by default.
Date: Fri, 27 May 2011 09:20:20 +0200
To: "Zephaniah E. Hull via RT" <bug-Log-Report [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Zephaniah E. Hull via RT (bug-Log-Report@rt.cpan.org) [110526 23:27]: Show quoted text
> Thu May 26 19:27:25 2011: Request 68496 was acted upon. > Transaction: Ticket created by zhull@jetpay.com > Queue: Log-Report > Subject: Log::Report::report exits with a status code of 0 by default. > > The documentation for report states that the exit status is the value of > the errno option, and that the default if the errno option is not > provided (due to being called as error or the like) is $! or 1. > > The code (in Report.pm, v0.92, line 147) reads: > $^S or exit($opts->{errno} || 0); > This ignores $? and defaults to 0.
There certainly is a problem, but this location is also showing the effect. Further down, in report() the error is collected $opts->{errno} ||= $!+0 # want copy! if $use_errno{$reason} && !defined $opts->{errno}; So, if you write system(...) and fault "error"; Actually, using system() whole my live, I still do not know the cleanest way to handle system calls which report both $! and $? errors. Those error-code ranges do overlap. $? is very platform dependent. Show quoted text
> The result is that a program that calls error() will exit with an exit > status of 0, indicating to the parent program that it exited without error. > This is obviously incorrect.
True. Maybe we should change above line into $opts->{errno} ||= $!+0 || $? || 1 if $use_errno{$reason} && !defined $opts->{errno}; What do you think? -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
user disappeared