ccc-analyzer sees the wiped out environment variables

Hello Clang,

While running scan-build, ccc-analyzer (line 45) sets $Clang from
$ENV{'CLANG_CXX'} and checks its validity by whether its defined or
not. Since $ENV{'CLANG_CXX'} happens to have an empty string on my
machine (ubuntu 12.04, bash shell, perl v5.14), $Clang is not
initialized properly, which eventually causes the scan-build to fail.
Note that $ENV{'CLANG_CXX'} was set from scan-build properly, and I'm
not sure why environment variables are wiped out.

Once I changed the ccc-analyzer as follows, it works fine. I'm
wondering this is the platform dependent errors or I'm using the wrong
options for scan-build (also attached below).

$ svn diff ccc-analyzer
Index: ccc-analyzer

Hi (although I'm not Clang :wink: ),

The issue probably has to do with /bin/sh on Ubuntu not being Bash, but Dash instead. Because of this, it doesn't support some extensions and can do weird things with the environment. Try changing the shebang line in the script to #!/bin/bash and see if it helps.

See this page for more details on why this is:
https://wiki.ubuntu.com/DashAsBinSh

Cheers,
Gordon Keiser
Software Development Engineer
Arxan Technologies

Hi Gordon,

Thanks for your suggestion! I've tried it with #!/bin/bash, but the
problem is still the same unfortunately.

Thanks,
Byoungyoung