Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld-logger results in empty compilation database if build command program name contains "cc" #1687

Open
whisperity opened this issue Jul 23, 2018 · 1 comment
Assignees
Labels
analyzer 📈 Related to the analyze commands (analysis driver) bug 🐛

Comments

@whisperity
Copy link
Contributor

whisperity commented Jul 23, 2018

Describe the bug
If the build command given to log (using LD-LOGGER) contains the substring cc (in lowercase!) in the build executable (not in the arguments, but as the first "word"), the result JSON is empty.

CodeChecker version
6.7.1 (but this has been around for ages, I think even 4.0 has this issue)

To Reproduce

  1. Create a dummy shell script (let's name it build-cc.sh) that does a compilation on a dummy file.
#!/bin/bash
g++ -c hello-world.cpp -o /dev/null
  1. Make sure this shell script is executable: chmod +x ./build-cc.sh.
  2. Create some symbolic links to this file that has different names, or copy this file over and over again. Examples: cc.sh, cC.sh, foobar.sh, build-cC.sh, bu-cc-ild.sh, etc.
  3. Do a CodeChecker log using these shell scripts as build commands, e.g. CodeChecker log -o temp1.json -b "./build-cc.sh". Alternatively, also run where the build command is bash ./build-cc.sh.

The build log is NOT populated for cc.sh, build-cc.sh, bu-cc-ild.sh and the likes.
The build log is populated where the shell script's name does not contain the substring cc, or when it is invoked as bash ./whatever.sh.

The issue does only appear if the command is a shell script. For example, if the build command is ccache (even if a local ccache symlink is made to the real install location), the logging still works.
Removing the shebang from the script does not fix the issue either.

Expected behavior
The build log is populated in both cases.

Desktop (please complete the following information)

  • OS: Ubuntu 16.04.5 LTS

This should be fixed in the logger tool.

@whisperity whisperity added bug 🐛 analyzer 📈 Related to the analyze commands (analysis driver) labels Jul 23, 2018
@csordasmarton
Copy link
Contributor

I checked the source code of the ld-logger. It will identify your script as a cc compiler call:

const char* progName = strrchr(progPath_, '/');
if (progName)
++progName;
else
progName = progPath_;
found = strstr(progName, token) != NULL;

However no source file will be found when the logger will process this command at here:

So this is the reason why your compilation database will be empty.

@bruntib Do you now about this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📈 Related to the analyze commands (analysis driver) bug 🐛
Projects
None yet
Development

No branches or pull requests

3 participants