From pmc@citylink.dinoex.sub.org  Sun Mar 16 10:06:58 2003
Return-Path: <pmc@citylink.dinoex.sub.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6A63D37B404
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Mar 2003 10:06:58 -0800 (PST)
Received: from net2.dinoex.sub.org (net2.dinoex.de [212.184.201.182])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8D5D243FBF
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Mar 2003 10:06:55 -0800 (PST)
	(envelope-from pmc@citylink.dinoex.sub.org)
Received: from net2.dinoex.sub.org (uucp@net2.dinoex.de [212.184.201.182])
	by net2.dinoex.sub.org (8.12.8/8.12.8) with ESMTP id h2GI6jmo003358
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Mar 2003 19:06:47 +0100 (CET)
	(envelope-from pmc@citylink.dinoex.sub.org)
Received: from citylink.dinoex.sub.org (uucp@localhost)
	by net2.dinoex.sub.org (8.12.8/8.12.8/Submit) with UUCP id h2GI6iWR003357
	for freebsd.org!FreeBSD-gnats-submit; Sun, 16 Mar 2003 19:06:44 +0100 (CET)
	(envelope-from pmc@citylink.dinoex.sub.org)
Received: from citylink.dinoex.sub.de  by citylink.dinoex.sub.org (8.8.5/PMuch-B3b) with ESMTP
	id OAA05636 for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Mar 2003 14:00:27 +0100 (CET)
Received: from gate.oper.dinoex.org (localhost [127.0.0.1])
	by citylink.dinoex.sub.de (8.12.6/8.12.6) with ESMTP id h2GD2ekO064568
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Mar 2003 14:02:40 +0100 (CET)
	(envelope-from pmc@disp.oper.dinoex.org)
Received: from disp.oper.dinoex.org (disp-e [192.168.98.5])
	by gate.oper.dinoex.org (8.12.6/8.12.6) with ESMTP id h2GD1abN064562
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Mar 2003 14:01:37 +0100 (CET)
	(envelope-from pmc@disp.oper.dinoex.org)
Received: (from pmc@localhost)
	by disp.oper.dinoex.org (8.11.6/8.11.6) id h2GD19e62827;
	Sun, 16 Mar 2003 14:01:09 +0100 (CET)
	(envelope-from pmc)
Message-Id: <200303161301.h2GD19e62827@disp.oper.dinoex.org>
Date: Sun, 16 Mar 2003 14:01:09 +0100 (CET)
From: Peter Much <pmc@citylink.dinoex.sub.org>
Reply-To: Peter Much <pmc@citylink.dinoex.sub.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: /bin/sh: child termination signals break valid shellscripts
X-Send-Pr-Version: 3.113

>Number:         50051
>Category:       bin
>Synopsis:       /bin/sh: child termination signals break valid shellscripts
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    tjr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 16 10:10:11 PST 2003
>Closed-Date:    Fri Apr 04 00:18:34 PST 2003
>Last-Modified:  Fri Apr 04 00:18:34 PST 2003
>Originator:     Peter Much
>Release:        FreeBSD 4.7-RELEASE i386
>Organization:
n/a
>Environment:
System: FreeBSD gate.oper.dinoex.org 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Fri Dec 27 23:08:12 CET 2002 root@dyn.oper.dinoex.org:/u/4-STABLE/obj/u/4-STABLE/src/sys/G1R47V1 i386

	/bin/sh

>Description:
	
	An executable gets terminated by signal.
	/bin/sh will report the name of the signal not only
	to its stdout, but will also insert this text in the
	stdout of the next subshell.

>How-To-Repeat:

	1. Run /bin/sh
	2. Enter the command:
		sleep 30; test `ls | wc -l` -gt 0
	3. Kill the "sleep" process with the kill command from some
	   other tty.
	You will then see the "test" command failing with syntax
	error. When activating -x you will see the signal name
	being added to the output from "wc":
		+ sleep 30
		+ wc -l
		+ ls
		+ test 133 Terminated -gt 0
		Terminated
		test: 133: unexpected operator

>Fix:

	Bernd Walter came up with the following suggestion. It
	seems to suit as a workaround:
		trap "wait" 20

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->tjr 
Responsible-Changed-By: tjr 
Responsible-Changed-When: Mon Mar 17 03:12:42 PST 2003 
Responsible-Changed-Why:  
I've tracked the problem down and will commit a fix to -current shortly. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50051 
State-Changed-From-To: open->patched 
State-Changed-By: tjr 
State-Changed-When: Mon Mar 17 03:29:15 PST 2003 
State-Changed-Why:  
Fixed in -current; will be MFC'd after FreeBSD 4.8 has been released. 
Thanks for the report. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50051 
State-Changed-From-To: patched->closed 
State-Changed-By: tjr 
State-Changed-When: Fri Apr 4 00:16:32 PST 2003 
State-Changed-Why:  
Fixed in -stable. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50051 
>Unformatted:
