<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - scan-build exits successfully if subordinate command is killed by a signal"
   href="https://bugs.llvm.org/show_bug.cgi?id=41501">41501</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>scan-build exits successfully if subordinate command is killed by a signal
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dcoughlin@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nbowler@draconx.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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...</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>