From owner-cvs-bin Thu Jun 19 11:42:19 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id LAA10626 for cvs-bin-outgoing; Thu, 19 Jun 1997 11:42:19 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id LAA10608; Thu, 19 Jun 1997 11:41:40 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id EAA18554; Fri, 20 Jun 1997 04:35:55 +1000 Date: Fri, 20 Jun 1997 04:35:55 +1000 From: Bruce Evans Message-Id: <199706191835.EAA18554@godzilla.zeta.org.au> To: bde@zeta.org.au, jkh@time.cdrom.com Subject: Re: cvs commit: src/bin/sh expand.c Cc: cvs-all@FreeBSD.ORG, cvs-bin@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, jkh@FreeBSD.ORG Sender: owner-cvs-bin@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> Submitted patches are almost never suitable for committing directly. > >Well, I did look at it first, sheesh! ;) Given the mastications that >sh was doing on the value of the integer there, the fix seemed >perfectly correct so I committed it. I didn't know I was walking into Yes, the fix seems to address another bug. The home made itoa() is obviously wrong for all negative values. Now it is only obviously wrong when the negation causes overflow :-). Apart from giving undefined behaviour, the overflow normally gives a negative int so you are no closer to printing its absolute value. The fix leaves sh printing wrong exit values. After exit(255), sh prints $? as -1 (-1 is 255 shifted back and forth). Did you test all possible exit values? :-) Bruce