From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,ea41123b6a1299c2 X-Google-Attributes: gidfee84,public X-Google-Thread: 11035d,ea41123b6a1299c2 X-Google-Attributes: gid11035d,public X-Google-Thread: 1012a6,ea41123b6a1299c2 X-Google-Attributes: gid1012a6,public X-Google-Thread: f678f,ea41123b6a1299c2 X-Google-Attributes: gidf678f,public From: john@iastate.edu (John Hascall) Subject: Re: Most shells don't handle SIGCHLD correctly Date: 1996/01/21 Message-ID: <4dsiub$1g6@news.iastate.edu>#1/1 X-Deja-AN: 136125762 distribution: inet references: <4dgcf4$hho@lovelace.infobiogen.fr> organization: Iowa State University, Ames, Iowa USA newsgroups: comp.unix.solaris,comp.unix.shell,comp.unix.osf.misc,comp.unix.osf.osf1 Claude Scarpelli wrote: }I just discovered some weird behaviour of most shell on most unix }system. here is a two lines test script: }sleep 1000 }echo done.... }lovelace$ }I run this program with my favourite shell on my favorite unix system, }and I send the signal SIGSTOP to the 'sleep 1000' process. }lovelace$ sh tt& }[1] 16826 } claude 16827 16826 3 15:12:56 pts/6 0:00 sleep 1000 }I send SIGSTOP.... }lovelace$ kill -STOP 16827 }done.... }lovelace$ }The shell run the next line of the shell script ! }UNIX SHELL BUGGY ? }----------------------------------------------------------- }SunOS 4.1.3 /bin/sh No }SunOS 4.1.3 Bash 1.12.1 Yes }Solaris 2.4 /bin/sh Yes }Solaris 2.4 Bash 1.14.5(1) Yes }OSF1 V3.2 /usr/ucb/sh No }OSF1 V3.2 Bash 1.14.4(1) Yes * V*.* Bash *.*.*(*) Yes (near as I can tell) Ultrix sh,sh5,csh No Ultrix,DEC UNIX,OSF/1,IRIX tcsh 6.* No DEC UNIX,OSF/1 csh No IRIX sh Yes IRIX csh Different Bug! Check this out (IRIX 5.3): insanely.bogus> csh tt& [1] 6937 insanely.bogus> ps -ef | grep sleep john 6941 6922 1 23:20:42 pts/1 0:00 grep sleep john 6939 6937 0 23:20:41 pts/1 0:00 sleep 1000 insanely.bogus> kill -STOP 6939 insanely.bogus> Stopped (signal) [1] Exit 1 csh tt insanely.bogus> John -- John Hascall ``An ill-chosen word is the fool's messenger.'' Moderator, comp.unix.wizards Systems Software Engineer, ISU Comp Center + Ames, IA 50011 + 515/294-9551 My Homepage From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 11035d,ea41123b6a1299c2,start X-Google-Attributes: gid11035d,public X-Google-Thread: fee84,ea41123b6a1299c2,start X-Google-Attributes: gidfee84,public X-Google-Thread: f678f,ea41123b6a1299c2,start X-Google-Attributes: gidf678f,public X-Google-Thread: 1012a6,ea41123b6a1299c2,start X-Google-Attributes: gid1012a6,public From: claude@lovelace.infobiogen.fr (Claude Scarpelli) Subject: Most shells don't handle SIGCHLD correctly Date: 1996/01/16 Message-ID: <4dgcf4$hho@lovelace.infobiogen.fr>#1/1 X-Deja-AN: 135377622 distribution: inet content-type: text/plain; charset=iso-8859-1 organization: GIS INFOBIOGEN, 7 rue Guy Moquet BP8, 94801 VILLEJUIF, France mime-version: 1.0 newsgroups: comp.unix.solaris,comp.unix.shell,comp.unix.osf.misc,comp.unix.osf.osf1 I just discovered some weird behaviour of most shell on most unix system. here is a two lines test script: lovelace$ cat tt sleep 1000 echo done.... lovelace$ I run this program with my favourite shell on my favorite unix system, and I send the signal SIGSTOP to the 'sleep 1000' process. lovelace$ sh tt& [1] 16826 lovelace$ ps -fu claude | grep sleep claude 16834 4349 3 15:13:07 pts/6 0:00 grep sleep claude 16827 16826 3 15:12:56 pts/6 0:00 sleep 1000 I send SIGSTOP.... lovelace$ kill -STOP 16827 done.... lovelace$ The shell run the next line of the shell script ! Obviously, the shell receive the signal SIGCHLD because its child changed its state (it is becoming stopped). I would say this is an incorrect behaviour : The shell should check its child terminated or may be should call sigaction(SIGCHLD...) with the SA_NOCLDSTOP flag. Here is a small summary of system/shell which exhibit what I call a bug, and those who seems to have the correct behaviour: UNIX SHELL BUGGY ? ----------------------------------------------------------- SunOS 4.1.3 /bin/sh No SunOS 4.1.3 Bash 1.12.1 Yes Solaris 2.4 /bin/sh Yes Solaris 2.4 Bash 1.14.5(1) Yes OSF1 V3.2 /usr/ucb/sh No OSF1 V3.2 Bash 1.14.4(1) Yes Can someone comment on that ? -- ------------------------------------------------------------------------------ Claude Scarpelli | Defenestrate: to exit a window INFOBIOGEN ::= INFOrmatique appliqu�e � | onscreen. (Time International l'�tude des BIOmol�cules et des G�Nomes | Vol 146, No. 20, Nov 13, 1995)