-
Notifications
You must be signed in to change notification settings - Fork 383
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
[fix] Pass envp
to posix_spawn
in ld_logger
#4146
Conversation
/* \ | ||
Note that envp is not passed through (which would be the environment that \ | ||
that the process will be spawned it), but is replaced by environ, which is \ | ||
a global variable that stores our environment. We added quite a few \ | ||
variables into it, and for some reason, they are not present in envp. \ | ||
*/ \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a while since I wrote this, but I recall that some codechecker (CC_*
) and logger related variables were not present in envp, but should've been. Can you verify thats not an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, which environment variable was involved in your case, but this function call blocked the forwarding of all environment variable. I assume, this cc_
was among them too.
argp
to posix_spawn
in ld_logger
argp
to posix_spawn
in ld_logger
envp
to posix_spawn
in ld_logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this?
Something along the lines of a Makefile which calls gcc ${ENVIRONMENT_VARIABLE}
and a /usr/bin/env ENVIRONMENT_VARIABLE=foo.cpp CodeChecker log -b "make"
?
f7c5a9a
to
5e72ecf
Compare
GNU make 4.3 uses posix_spawn() for initiating recursive make calls in subdirectories: make -C <subdirectory> Since we overwrote posix_spawn() through LD_PRELOAD and we didn't forward environment variables to the subprocess, the build of the submodule didn't get the environment variables set by a Makefile. This commit fixes this issue so the logging phase behaves the same way as the original build. Fixes Ericsson#3860
5e72ecf
to
32e4366
Compare
GNU make 4.3 uses posix_spawn() for initiating recursive make calls in subdirectories:
make -C <subdirectory>
Since we overwrote posix_spawn() through LD_PRELOAD and we didn't forward environment variables to the subprocess, the build of the submodule didn't get the environment variables set by a Makefile. This commit fixes this issue so the logging phase behaves the same way as the original build.
Fixes #3860