Bug 39959
Summary: | exitStatus() returns 0 when child process crashes due to missing symbol in dylib | ||
---|---|---|---|
Product: | WebKit | Reporter: | David Kilzer (:ddkilzer) <ddkilzer> |
Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | aroben, mrowe |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac | ||
OS: | OS X 10.6 |
David Kilzer (:ddkilzer)
* SUMMARY
When an app crashes on Mac OS X 10.6 due to a missing symbol in a dylib (for example, testapi in run-javascriptcore-tests), the exitStatus() method in webkitdirs.pm returns 0 (zero) because the value passed in is 5. This happens because WEXITSTATUS() does an 8-bit right shift of the value passed to it, which causes 5 to become 0.
Normally the 8-bit shift is the correct action since the exit status of the child process is stored in the upper 8 bits of $?. However, when an app crashes due to a missing symbol in a dylib, $? is set to 5 and there is no child exit status.
Unfortunately, I haven't found any Perl man pages that fully describe what the lower 8 bits of $? are ("man perlvar" describes some, but not all, of the lower bits), so it's not clear how best to fix this. Changing every place that calls exitStatus() to also check $? seems burdensome.
It would be nice if exitStatus() would always return a non-zero value if a non-zero value was passed in, even if it was less than 256. I'm not sure if that would break other platforms, though.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Mark Rowe (bdash)
Some bits of $? represent the manner in which the process exited, which can be queried using WIFEXITED / WIFSIGNALED / WIFSTOPPED/. Depending on the values of those macros you can use one of the following to learn more: WEXITSTATUS / WTERMSIG / WCOREDUMP / WSTOPSIG.
I’m not entirely sure what the combination of flags will be when an application fails to launch due to missing symbols, but I suspect it’s detectable via some combination of the above. It may just be a matter of ensuring that WIFEXITED is true.