csh jobs/tostop bug

utzoo!decvax!duke!harpo!utah-cs!utah-gr!thomas utzoo!decvax!duke!harpo!utah-cs!utah-gr!thomas
Sun Jan 16 21:24:01 AEST 1983


It looks to me like the problem is not a bug in the csh, but that you're
trying to do it slightly wrong.  Here is my analysis of the events.
=Spencer

Script started on Sun Jan 16 21:07:39 1983
1 gr> set echo			# so we can see what is happening
2 gr> (sleep 10 ; echo "hi") & stty tostop & wait ; fg # try the command
[1] 3153
sleep 10			# first part of command 1
[2] 3155			# stty command (don't know why it isn't echoed
wait				# and a wait

[2]  + Stopped (tty output) stty tostop	# stty does several ioctl calls,
					# apparently at least one happens
					# after the TOSTOP
[1]  + Stopped (tty output) ( sleep 10; echo "hi" ) # we expect this to stop
fg					# and the fg command executes
( sleep 10; echo "hi" )			# [1] continues and finishes
echo hi
hi
3 gr> jobs				# BUT, there is a stty left there
jobs					# Not a bug - wait waits for ALL
[2]  + Stopped (tty output) stty tostop # children to finish, since [1]
					# stopped last, it was continued by fg
4 gr> %2				# get rid of the extra stty
stty tostop
5 gr> stty -tostop			# and set -tostop

					# This is the correct way to do it -
					# Don't run the stty backgrounded
6 gr> (sleep 10 ; echo "hi") & stty tostop ; wait ; fg
[1] 3160
sleep 10				# cmd 1 starts
stty tostop				# stty runs to completion
wait					# csh waits

[1]  + Stopped (tty output) ( sleep 10; echo "hi" )	#[1] stops
fg					# is continued
( sleep 10; echo "hi" )
echo hi					# and completes
hi
7 gr> exit
script done on Sun Jan 16 21:09:43 1983



More information about the Comp.bugs.4bsd.ucb-fixes mailing list