From owner-freebsd-bugs@FreeBSD.ORG Fri Jun 20 00:50:03 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E8C61065674 for ; Fri, 20 Jun 2008 00:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 24B828FC15 for ; Fri, 20 Jun 2008 00:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m5K0o3Tu084252 for ; Fri, 20 Jun 2008 00:50:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m5K0o3se084251; Fri, 20 Jun 2008 00:50:03 GMT (envelope-from gnats) Date: Fri, 20 Jun 2008 00:50:03 GMT Message-Id: <200806200050.m5K0o3se084251@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: "Garrett Cooper" Cc: Subject: Re: misc/124748: sh -c 'exit -1' fails with "Illegal number: -1", instead of exiting with a code of 255 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Garrett Cooper List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2008 00:50:03 -0000 The following reply was made to PR bin/124748; it has been noted by GNATS. From: "Garrett Cooper" To: "Garrett Cooper" Cc: "Edwin Groothuis" , "FreeBSD Gnats Submit" Subject: Re: misc/124748: sh -c 'exit -1' fails with "Illegal number: -1", instead of exiting with a code of 255 Date: Thu, 19 Jun 2008 17:44:29 -0700 ------=_Part_7292_27631637.1213922669108 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thu, Jun 19, 2008 at 3:18 PM, Garrett Cooper wrote: > On Thu, Jun 19, 2008 at 2:45 PM, Edwin Groothuis wrote: >> On Thu, Jun 19, 2008 at 07:03:10AM +0000, Garrett Cooper wrote: >>> =================================================================== >>> RCS file: /home/ncvs/src/bin/sh/exec.c,v >>> retrieving revision 1.31 >>> diff -r1.31 exec.c >>> 40a41 >>> > #include >>> 361c362 >>> < if (prefix("builtin", pathopt)) { >>> --- >>> > if (strncmp(BUILTIN, pathopt, strlen(BUILTIN)) == 0) { >>> Index: histedit.c >>> =================================================================== >> >> I don't want to be a pain, but could you do this with "diff -u" in >> case there is some context required? >> >> Edwin > > Will do once I get home. > -Garrett Here's a new patch. -Garrett ------=_Part_7292_27631637.1213922669108 Content-Type: text/x-patch; name=sh_fix_numbers.patch Content-Transfer-Encoding: base64 X-Attachment-Id: f_fho27fxf0 Content-Disposition: attachment; filename=sh_fix_numbers.patch SW5kZXg6IGV4ZWMuYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvaG9tZS9uY3ZzL3NyYy9iaW4vc2gv ZXhlYy5jLHYKcmV0cmlldmluZyByZXZpc2lvbiAxLjMxCmRpZmYgLXUgLXIxLjMxIGV4ZWMuYwot LS0gZXhlYy5jCTE4IEphbiAyMDA3IDIyOjMxOjIyIC0wMDAwCTEuMzEKKysrIGV4ZWMuYwkyMCBK dW4gMjAwOCAwMDo0MDoxNiAtMDAwMApAQCAtMzgsNiArMzgsNyBAQAogI2luY2x1ZGUgPHN5cy9j ZGVmcy5oPgogX19GQlNESUQoIiRGcmVlQlNEOiBzcmMvYmluL3NoL2V4ZWMuYyx2IDEuMzEgMjAw Ny8wMS8xOCAyMjozMToyMiBzdGVmYW5mIEV4cCAkIik7CiAKKyNpbmNsdWRlIDxzdHJpbmcuaD4K ICNpbmNsdWRlIDxzeXMvdHl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6ZXJvIGxl bmd0aCBzdHJpbmcgKi8KIApAQCAtMTIxLDkgKzEyNCw0MyBAQAogaW50CiBpc19udW1iZXIoY29u c3QgY2hhciAqcCkKIHsKKwkvKiBJcyB0aGlzIHRoZSBmaXJzdCBpbmRleD8gKi8KKwlpbnQgaXRl ciA9IDA7CisKKyNpZiBERUJVRworI2RlZmluZSBQUklOVF9ERUJVRyBmcHJpbnRmKHN0ZGVyciwg IiVkOiAlY1xuIiwgaXRlciwgKnApCisjZWxzZQorI2RlZmluZSBQUklOVF9ERUJVRyAgCisjZW5k aWYKKwogCWRvIHsKLQkJaWYgKCEgaXNfZGlnaXQoKnApKQorCQkvKgorCQkgKiBBY2NvdW50IGZv ciBzaWducyBpbiBmcm9udCBvZiBudW1iZXJzLgorCQkgKi8KKworCQkvKgorCQkgKiBYWFg6IGRv ZXMgUE9TSVggYm91cm5lIHNoZWxsIGFsbG93IGZvciAnKycgcHJlZml4ZWQKKwkJICogbnVtYmVy cz8KKwkJICovCisKKwkJLyoKKwkJICogVGhlIHN0cmluZyBkZWZpbmVkIGJ5ICpwIGlzbid0IGEg bnVtYmVyLCB1bmxlc3M6CisJCSAqIAkxLiBJdCdzIGEgZGlnaXQuCisJCSAqIAkyLiBUaGUgMCd0 aCBpbmRleCBpcyBlaXRoZXIgYSArIG9yIC0uCisJCSAqLworCQlpZiAoIShpc19kaWdpdCgqcCkg fHwKKwkJICAgICAoaXRlciA9PSAwICYmICgqcCA9PSAnLScgfHwgKnAgPT0gJysnKSkpCisJCSkg eworCQkJUFJJTlRfREVCVUc7CiAJCQlyZXR1cm4gMDsKKwkJfQorCisJCVBSSU5UX0RFQlVHOwor CisjdW5kZWYgUFJJTlRfREVCVUcKKworCQlpdGVyKys7CisKIAl9IHdoaWxlICgqKytwICE9ICdc MCcpOwogCXJldHVybiAxOwogfQo= ------=_Part_7292_27631637.1213922669108--