NetBSD Problem Report #50431

From mlelstv@fud.1st.de  Sun Nov 15 13:31:42 2015
Return-Path: <mlelstv@fud.1st.de>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A360FA64EF
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 15 Nov 2015 13:31:42 +0000 (UTC)
Message-Id: <20151115133130.C29C0D6CC@fud.1st.de>
Date: Sun, 15 Nov 2015 14:31:30 +0100 (CET)
From: mlelstv@serpens.de
Reply-To: mlelstv@serpens.de
To: gnats-bugs@gnats.NetBSD.org
Subject: sh job control doesn't work for loops
X-Send-Pr-Version: 3.95

>Number:         50431
>Category:       bin
>Synopsis:       sh job control doesn't work for loops
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 15 13:35:00 +0000 2015
>Last-Modified:  Wed Oct 25 14:20:00 +0000 2017
>Originator:     Michael van Elst
>Release:        NetBSD 6.1_STABLE
>Organization:

>Environment:


System: NetBSD fud 6.1_STABLE NetBSD 6.1_STABLE (FUD) #3: Sat Sep 5 06:00:34 CEST 2015 mlelstv@pussyfoot:/home/netbsd6/obj.i386/home/netbsd6/src/sys/arch/i386/compile/FUD i386
Architecture: i386
Machine: i386
>Description:

When running a loop in an interactive shell, ctrl-Z doesn't stop the
whole loop but only the running command because each command is seen
as a separate job.

This fails also in netbsd-7 and -current. Our ksh behaves similarly.

A ctrl-C correctly aborts the loop.

It is questionable wether this is really a bug because sh (and ksh)
don't implement job control in a consistent way on other systems.
But the current behaviour is useless.


>How-To-Repeat:

$ for i in 1 2 3 4; do echo $i a; sleep 60; echo $i b; done
1 a
^Z[1] + Suspended               sleep 60
1 b
2 a
^Z[2] - Suspended               sleep 60
2 b
3 a
^Z[3]   Suspended               sleep 60
3 b
4 a
^Z[4]   Suspended               sleep 60
4 b
$ jobs
[1]   Suspended               sleep 60
[2]   Suspended               sleep 60
[3] - Suspended               sleep 60
[4] + Suspended               sleep 60

>Fix:


>Audit-Trail:
From: Michael van Elst <mlelstv@serpens.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/50431 sh job control doesn't work for loops
Date: Sat, 21 Jan 2017 14:37:30 +0100

 Still the same behaviour in -current on multiple platforms.

 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/50431 sh job control doesn't work for loops
Date: Wed, 25 Oct 2017 21:19:04 +0700

 For what it is worth, and I know this does not help much,
 but the BUGS section of sh(1) in (very) current now includes...

 	Job control of compound statements (loops, etc) is a complete mess. 

 I am aware of the problems, and if I can dream up an implementable
 way (that is, not thousands of lines of extra code) to make it better
 it will happen - someday.

 kre

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.