NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/50431: sh job control doesn't work for loops

>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
>Originator:     Michael van Elst
>Release:        NetBSD 6.1_STABLE
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

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.


$ 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



Home | Main Index | Thread Index | Old Index