[debhelper-devel] Bug#797904: Bug#797904: debhelper manpage: #DEBHELPER# in Perl: bad error handling

Peter Pentchev roam at ringlet.net
Mon Sep 7 12:55:37 UTC 2015


On Mon, Sep 07, 2015 at 01:49:52PM +0200, Jakub Wilk wrote:
> Hi Peter!
> 
> * Peter Pentchev <roam at ringlet.net>, 2015-09-07, 14:26:
> >Hm, this is a personal pet peeve, feel free to ignore it :) ...but it does
> >make me cringe a little bit every time people parse the wait() status code
> >directly instead of using WIFEXITED(), WEXITCODE() and friends...
> 
> In C, sure. But in Perl, fiddling with $? bits is a documented and portable
> method.

Oof.  Right.  Thanks for letting me know that!  The truth is, I'd looked it
up several times in Perl's documentation, but wording like:

  The return value is the exit status of the program as returned by
  the "wait" call.

...in the "system" documentation or:

  Behaves like wait(2) on your system...

...in the "wait" documentation always made me stop reading before I could
actually get to the description of ${^CHILD_ERROR_NATIVE} and the 0x80/0x7f
conversion.  Right now, I actually checked the Perl source to see what it
does with the status code returned by wait(2) and system(3), and, lo and
behold, you're right, it explicitly converts it to this set of values :)

Thanks, and sorry for the bother! :)

G'luck,
Peter

-- 
Peter Pentchev  roam at ringlet.net roam at FreeBSD.org pp at storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/debhelper-devel/attachments/20150907/abbb1d5b/attachment-0001.sig>


More information about the debhelper-devel mailing list