Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Signal 18 (CONT) caught by ps (procps-ng version 3.3.9)
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 */] <unfinished ...>
[pid 9552] execve("/usr/bin/wc", ["wc", "-l"], [/* 34 vars */] <unfinished ...>
[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 <unfinished ...>
[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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author