[cmake-developers] CMake execute_process/signal_handler on Unix

Yordanov, Dimitar dimitar.yordanov at sap.com
Wed Jun 1 09:04:02 EDT 2016


Hey,

I'm looking into an issue with a CMake build on Linux hanging in a
select syscall, when using EXECUTE_PROCESS without any additional
arguments. The subprocess executed is "chmod". The child finishes and
is marked as a zombie, but CMake did not realize that. The only
descriptors left open are the one of the signaling pipe.

Looking through the code I couldn't see a place, where I could prove
that is directly related to the problem. Nevertheless I have a
question about the signal handler used. The function
kwsysProcessesSignalHandler in ProcessUnix.c. The problem that I see
is the use of a shared variable "kwsysProcesses" in the signal
handler. I think the usage of non volatile shared objects should be
avoided in signal handlers and we should just do as less as we
can in there. So my proposal would be:

1. Use just one SignalPipe for all subprocess
2. In the signal handler just write the one single byte into the w-end
of the pipe
3. Do the rest of the processing in the normal workflow.

A few more questions:
Why do we need the "(void)pipeStatus;" lines. For debugging?
Why do we need to read from the pipe in the signal handler?

Please let me know what is your opinion.

Best wishes
Dimitar


More information about the cmake-developers mailing list