From owner-freebsd-bugs@FreeBSD.ORG Wed Dec 14 09:40:08 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 688A316A41F for ; Wed, 14 Dec 2005 09:40:08 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C7CC043D5D for ; Wed, 14 Dec 2005 09:40:07 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id jBE9e7M8050763 for ; Wed, 14 Dec 2005 09:40:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id jBE9e7bW050762; Wed, 14 Dec 2005 09:40:07 GMT (envelope-from gnats) Date: Wed, 14 Dec 2005 09:40:07 GMT Message-Id: <200512140940.jBE9e7bW050762@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Maxim Konovalov Cc: Subject: Re: bin/90334: /bin/sh trap problem X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Maxim Konovalov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2005 09:40:08 -0000 The following reply was made to PR bin/90334; it has been noted by GNATS. From: Maxim Konovalov To: Dmitriy Kirhlarov Cc: bug-followup@freebsd.org, kst@oilspace.com Subject: Re: bin/90334: /bin/sh trap problem Date: Wed, 14 Dec 2005 12:36:50 +0300 (MSK) [...] > 2/ By your co-worker, Konstantin Stepanenkov, break an endless loop if > we get ECHILD: > > Index: jobs.c > =================================================================== > RCS file: /home/ncvs/src/bin/sh/jobs.c,v > retrieving revision 1.69 > diff -u -r1.69 jobs.c > --- jobs.c 5 Sep 2005 17:57:19 -0000 1.69 > +++ jobs.c 13 Dec 2005 18:38:26 -0000 > @@ -929,6 +929,8 @@ > if (pid <= 0) > return -1; > } > + if (errno == ECHILD) > + job->state = 1; > if (pid <= 0) > return pid; > INTOFF; > %%% BDE has more elegant version of this patch: Index: sh/jobs.c =================================================================== RCS file: /home/ncvs/src/bin/sh/jobs.c,v retrieving revision 1.69 diff -u -r1.69 jobs.c --- sh/jobs.c 5 Sep 2005 17:57:19 -0000 1.69 +++ sh/jobs.c 14 Dec 2005 09:35:03 -0000 @@ -924,6 +924,8 @@ } while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) || (pid > 0 && WIFSTOPPED(status) && !iflag)); in_dowait--; + if (pid == -1 && errno == ECHILD && job != NULL) + job->state = JOBDONE; if (breakwaitcmd != 0) { breakwaitcmd = 0; if (pid <= 0) %%% I am going to commit it after some tests. -- Maxim Konovalov