rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.97k stars 321 forks source link

citnames: failed with: Missing input file: "compile_commands.commands.json" #326

Closed grayed closed 3 years ago

grayed commented 3 years ago

Describe the bug I'm trying to port Bear to OpenBSD. While the build process is 99% fine (the only small issue to be reported separately), trying to run bear -- ... gives error. I'm not asking for a fix, but for a clue, what could went wrong.

To Reproduce Build Bear from port in openbsd-wip repository.

Expected behavior Bear starts and does something useful.

Environment:

Additional context The problem happens with any command specified after the "--". The verbose log (with environment variables tweaked a bit for privacy reasons) is here:

[06:09:15.367486, br, 7325] bear: 3.0.2
[06:09:15.368690, br, 7325] arguments: ["bear", "--verbose", "--", "foobar"]
[06:09:15.368801, br, 7325] environment: ["_=/usr/local/bin/bear", "LOGNAME=myself", "SDL_VIDEO_X11_DGAMOUSE=0", "OLDPWD=/home/myself", "HOME=/home/myself", "JAVA_HOME=/usr/local/jdk-1.8.0", "GIT_EDITOR=/usr/local/bin/nvi", "MORE= -i", "KDEHOME=/home/myself/.kde", "LC_MONETARY=C", "LANG=en_US.UTF-8", "MANPATH=:/usr/share/man:/usr/local/man:/usr/ports/infrastructure/man", "WWW_HOME=http://www.google.com", "PAGER=/usr/bin/more", "FTPMODE=passive", "SHELL=/bin/ksh", "PS1=\A $? \u@\h:\w\$ ", "PORTSDIR=/usr/ports", "TERM=vt220", "LC_NUMERIC=C", "PWD=/home/myself/cvs/oicb", "MOZ_PLUGIN_PATH=/usr/local/lib/mozilla/plugins", "TOP=-1 -s 1", "LC_CTYPE=ru_RU.UTF-8", "LESS= -i", "QT_QPA_PLATFORMTHEME=qt5ct", "FETCH_CMD=/usr/bin/ftp -r 10", "SVN_EDITOR=/usr/local/bin/nvi", "LC_TIME=C", "FTP_KEEPALIVE=24", "MAIL=/var/mail/myself", "BROWSER=/usr/local/bin/chrome", "BLOCKSIZE=k", "ENV=/home/myself/.kshrc", "PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/ports/infrastructure/bin:/usr/local/jdk-1.8.0/bin:/home/myself/bin", "LC_COLLATE=C", "USER=myself"]
[06:09:15.368861, br, 7325] arguments parsed: {program: bear, arguments: [{--: [foobar]}, {--citnames: [/usr/local/bin/citnames]}, {--executor: [/usr/local/libexec/er]}, {--interceptor: [/usr/local/bin/intercept]}, {--libexec: [/usr/local/libexec/libexec.so]}, {--output: [compile_commands.json]}, {--verbose: []}, {--wrapper: [/usr/local/libexec/wrapper.d]}]}
[06:09:15.371081, br, 7325] Process spawned. [pid: 39985, command: [/usr/local/bin/intercept, --library, /usr/local/libexec/libexec.so, --executor, /usr/local/libexec/er, --wrapper, /usr/local/libexec/wrapper.d, --output, compile_commands.commands.json, --verbose, --, foobar]]
[06:09:15.374521, br, 7325] Process wait requested. [pid: 39985]
[06:09:15.443404, ic, 39985] intercept: 3.0.2
[06:09:15.444630, ic, 39985] arguments: ["/usr/local/bin/intercept", "--library", "/usr/local/libexec/libexec.so", "--executor", "/usr/local/libexec/er", "--wrapper", "/usr/local/libexec/wrapper.d", "--output", "compile_commands.commands.json", "--verbose", "--", "foobar"]
[06:09:15.444762, ic, 39985] environment: ["BLOCKSIZE=k", "BROWSER=/usr/local/bin/chrome", "ENV=/home/myself/.kshrc", "FETCH_CMD=/usr/bin/ftp -r 10", "FTPMODE=passive", "FTP_KEEPALIVE=24", "GIT_EDITOR=/usr/local/bin/nvi", "HOME=/home/myself", "JAVA_HOME=/usr/local/jdk-1.8.0", "KDEHOME=/home/myself/.kde", "LANG=en_US.UTF-8", "LC_COLLATE=C", "LC_CTYPE=ru_RU.UTF-8", "LC_MONETARY=C", "LC_NUMERIC=C", "LC_TIME=C", "LESS= -i", "LOGNAME=myself", "MAIL=/var/mail/myself", "MANPATH=:/usr/share/man:/usr/local/man:/usr/ports/infrastructure/man", "MORE= -i", "MOZ_PLUGIN_PATH=/usr/local/lib/mozilla/plugins", "OLDPWD=/home/myself", "PAGER=/usr/bin/more", "PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/ports/infrastructure/bin:/usr/local/jdk-1.8.0/bin:/home/myself/bin", "PORTSDIR=/usr/ports", "PS1=\A $? \u@\h:\w\$ ", "PWD=/home/myself/cvs/oicb", "QT_QPA_PLATFORMTHEME=qt5ct", "SDL_VIDEO_X11_DGAMOUSE=0", "SHELL=/bin/ksh", "SVN_EDITOR=/usr/local/bin/nvi", "TERM=vt220", "TOP=-1 -s 1", "USER=myself", "WWW_HOME=http://www.google.com", "_=/usr/local/bin/bear"]
[06:09:15.444830, ic, 39985] arguments parsed: {program: /usr/local/bin/intercept, arguments: [{--: [foobar]}, {--executor: [/usr/local/libexec/er]}, {--library: [/usr/local/libexec/libexec.so]}, {--output: [compile_commands.commands.json]}, {--verbose: []}, {--wrapper: [/usr/local/libexec/wrapper.d]}]}
[06:09:15.445139, ic, 39985] Created library preload session. [library=/usr/local/libexec/libexec.so, executor=/usr/local/libexec/er]
[06:09:15.512994, br, 7325] Process wait request: done. [pid: 39985]
[06:09:15.513658, br, 7325] Running intercept finished. [Exited with 1]
[06:09:15.515270, br, 7325] Process spawned. [pid: 95376, command: [/usr/local/bin/citnames, --input, compile_commands.commands.json, --output, compile_commands.json, --run-checks, --verbose]]
[06:09:15.519340, br, 7325] Process wait requested. [pid: 95376]
[06:09:15.532268, cs, 95376] citnames: 3.0.2
[06:09:15.532602, cs, 95376] arguments: ["/usr/local/bin/citnames", "--input", "compile_commands.commands.json", "--output", "compile_commands.json", "--run-checks", "--verbose"]
[06:09:15.532633, cs, 95376] environment: ["BLOCKSIZE=k", "BROWSER=/usr/local/bin/chrome", "ENV=/home/myself/.kshrc", "FETCH_CMD=/usr/bin/ftp -r 10", "FTPMODE=passive", "FTP_KEEPALIVE=24", "GIT_EDITOR=/usr/local/bin/nvi", "HOME=/home/myself", "JAVA_HOME=/usr/local/jdk-1.8.0", "KDEHOME=/home/myself/.kde", "LANG=en_US.UTF-8", "LC_COLLATE=C", "LC_CTYPE=ru_RU.UTF-8", "LC_MONETARY=C", "LC_NUMERIC=C", "LC_TIME=C", "LESS= -i", "LOGNAME=myself", "MAIL=/var/mail/myself", "MANPATH=:/usr/share/man:/usr/local/man:/usr/ports/infrastructure/man", "MORE= -i", "MOZ_PLUGIN_PATH=/usr/local/lib/mozilla/plugins", "OLDPWD=/home/myself", "PAGER=/usr/bin/more", "PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/ports/infrastructure/bin:/usr/local/jdk-1.8.0/bin:/home/myself/bin", "PORTSDIR=/usr/ports", "PS1=\A $? \u@\h:\w\$ ", "PWD=/home/myself/cvs/oicb", "QT_QPA_PLATFORMTHEME=qt5ct", "SDL_VIDEO_X11_DGAMOUSE=0", "SHELL=/bin/ksh", "SVN_EDITOR=/usr/local/bin/nvi", "TERM=vt220", "TOP=-1 -s 1", "USER=myself", "WWW_HOME=http://www.google.com", "_=/usr/local/bin/bear"]
[06:09:15.532644, cs, 95376] arguments parsed: {program: /usr/local/bin/citnames, arguments: [{--input: [compile_commands.commands.json]}, {--output: [compile_commands.json]}, {--run-checks: []}, {--verbose: []}]}
[06:09:15.532935, cs, 95376] Configuration: {"compilation":null,"output":{"content":{"include_only_existing_source":true},"format":{"command_as_array":true,"drop_output_field":false}}}
[06:09:15.532975, cs, 95376] failed with: Missing input file: "compile_commands.commands.json"
[06:09:15.533804, br, 7325] Process wait request: done. [pid: 95376]
[06:09:15.533841, br, 7325] Running citnames finished. [Exited with 1]
[06:09:15.533954, br, 7325] remove command file failed: compile_commands.commands.json
[06:09:15.534052, br, 7325] succeeded with: 1

If I create the problematic file myself, it gets catched and read by Bear, and then gets removed before Bear exits.

Before you send...

grayed commented 3 years ago

... and only after filling the issue I've realized that there is coredump of intercept being generated silently. So now I have the clue. Sorry for the noise. :)