[llvm-bugs] [Bug 41501] New: scan-build exits successfully if subordinate command is killed by a signal

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 15 08:09:05 PDT 2019


            Bug ID: 41501
           Summary: scan-build exits successfully if subordinate command
                    is killed by a signal
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: nbowler at draconx.ca
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

If the build command is killed by a signal, scan-build ignores this fact
and returns everythign is A-OK.  For example, to demonstrate:

  % scan-build /bin/sh -c 'kill -TERM $$; sleep 5; exit 42' ; echo status is $?
  scan-build: No bugs found.
  exit status is 0

Or alternately since perl ignores SIGINT during the execution of a system()
function, one can typically just ctrl+c the build and this will kill just
the child process.  Then scan-build will (depending on timing) exit
successfully with a status of 0.

This appears to be because whenever scan-build script calls perl's system
function it calls it like this:

    return (system(@$Args) >> 8);

which is explicitly discarding the status of the child process in cases where
it dies due to a signal...

Since the build has failed due to the compiler being killed, I had expected
scan-build to at least return some indication of this failure...

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190415/e8fd2503/attachment.html>

More information about the llvm-bugs mailing list