From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29312 invoked by alias); 13 Jan 2014 04:00:40 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32251 Received: (qmail 18642 invoked from network); 13 Jan 2014 04:00:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140112200003.ZM21464@torch.brasslantern.com> Date: Sun, 12 Jan 2014 20:00:02 -0800 In-reply-to: Comments: In reply to Michele Guerini Rocco "Signal 18 (CONT) caught by ps (procps-ng version 3.3.9)" (Jan 12, 10:59pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Michele Guerini Rocco , zsh-workers@zsh.org Subject: Re: Signal 18 (CONT) caught by ps (procps-ng version 3.3.9) MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 12, 10:59pm, Michele Guerini Rocco wrote: } } Executing `ps -ef | wc -l` in a zsh shell script or directly with `echo $(ps -ef | wc -l)` will cause this message to appear: } } Signal 18 (CONT) caught by ps (procps-ng version 3.3.9). } ps:display.c:66: please report this bug``` That's rather a strange error message. Why would it be a bug for ps to get a CONT signal? There are cases in which zsh sends a CONT signal to a child process that *could* be in a stopped state without bothering to check first whether the child actually *is* stopped. This should be a completely harmless no-op for a child that's already running, and I'd say it's more a bug in ps for complaining about it than it is a bug in zsh for sending it. The "extraneous" SIGCONT is at line 285 of Src/jobs.c and "git blame" says it has been there since 2000-04-01, so there is undoubtedly *some* way to induce it in any version of zsh you're likely to be able to try; but the circumstances in which that code is called have changed recently, as we now try to do a more thorough job of tracking child processes for correct population the $pipestatus array and avoiding race conditions. Relevant strace: % schaefer[602] strace -q -f -e trace=kill,process Src/zsh -fc 'echo "$(ps -ef | wc -l)"' execve("Src/zsh", ["Src/zsh", "-fc", "echo \"$(ps -ef | wc -l)\""], [/* 34 vars */]) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7eef708) = 9550 [pid 9550] clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7eef708) = 9551 [pid 9550] clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7eef708) = 9552 [pid 9551] execve("/bin/ps", ["ps", "-ef"], [/* 34 vars */] [pid 9552] execve("/usr/bin/wc", ["wc", "-l"], [/* 34 vars */] [pid 9551] <... execve resumed> ) = 0 [pid 9552] <... execve resumed> ) = 0 [pid 9551] exit_group(0) = ? [pid 9550] --- SIGCHLD (Child exited) @ 0 (0) --- [pid 9550] wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 9998}, ru_stime={0, 0}, ...}) = 9551 [pid 9550] wait4(-1, 0xbfeef6c4, WNOHANG|WSTOPPED|WCONTINUED, 0xbfeef64c) = 0 [pid 9550] kill(9551, SIGCONT [pid 9552] exit_group(0) = ? [pid 9550] <... kill resumed> ) = -1 ESRCH (No such process) [pid 9550] kill(9552, SIGCONT) = 0 [pid 9550] --- SIGCHLD (Child exited) @ 0 (0) --- [pid 9550] wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 9998}, ...}) = 9552 [pid 9550] wait4(-1, 0xbfeef6c4, WNOHANG|WSTOPPED|WCONTINUED, 0xbfeef64c) = -1 ECHILD (No child processes) [pid 9550] exit_group(0) = ? kill(9550, SIG_0) = 0 --- SIGCHLD (Child exited) @ 0 (0) --- wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 9998}, ru_stime={0, 9998}, ...}) = 9550 wait4(-1, 0xbfeefb24, WNOHANG|WSTOPPED|WCONTINUED, 0xbfeefaac) = -1 ECHILD (No child processes) kill(9550, SIG_0) = -1 ESRCH (No such process) 128 exit_group(0) = ? -- Barton E. Schaefer