Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2003 14:01:09 +0100 (CET)
From:      Peter Much <pmc@citylink.dinoex.sub.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/50051: /bin/sh: child termination signals break valid shellscripts
Message-ID:  <200303161301.h2GD19e62827@disp.oper.dinoex.org>

next in thread | raw e-mail | index | archive | help

>Number:         50051
>Category:       bin
>Synopsis:       /bin/sh: child termination signals break valid shellscripts
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 16 10:10:11 PST 2003
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303161301.h2GD19e62827>