summaryrefslogtreecommitdiff
path: root/include_server
diff options
context:
space:
mode:
authorcsilvers <csilvers@01de4be4-8c4a-0410-9132-4925637da917>2008-05-15 01:36:46 +0000
committercsilvers <csilvers@01de4be4-8c4a-0410-9132-4925637da917>2008-05-15 01:36:46 +0000
commit1e1824da88b74911da300567e11dee30860e6279 (patch)
tree1c66b037b2d3181a0ba32bc83f7a9e9ca72f0e02 /include_server
parent54b47e642e1dd338f1a6cf8d94a32b4a1d87d86a (diff)
downloaddistcc-1e1824da88b74911da300567e11dee30860e6279.tar.gz
When running gcc -v, we were clearing the environment too
aggressively: in particular, we were clearing $PATH, which is needed to find gcc when it's in an unusual location. Now we clear everything but $PATH. Tested by running 'make include-server-maintainer-check' on solaris x86, which has gcc outside the standard path, and on linux (ubuntu), which does not. Reviewed by fergus@google.com git-svn-id: http://distcc.googlecode.com/svn/trunk@242 01de4be4-8c4a-0410-9132-4925637da917
Diffstat (limited to 'include_server')
-rwxr-xr-xinclude_server/compiler_defaults.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/include_server/compiler_defaults.py b/include_server/compiler_defaults.py
index 2e039ae..440d0af 100755
--- a/include_server/compiler_defaults.py
+++ b/include_server/compiler_defaults.py
@@ -35,6 +35,7 @@ directories cannot be determined. Should this be improved upon?
__author__ = "Nils Klarlund"
+import os
import re
import sys
import basics
@@ -77,15 +78,23 @@ def _SystemSearchdirsGCC(compiler, language, canonical_lookup):
"/dev/null"]
try:
- # We annul the environment, because otherwise, directories declared by
+ # We clear the environment, because otherwise, directories declared by
# CPATH, for example, will be incorporated into the result. (See the CPP
- # manual for the meaning of CPATH.)
+ # manual for the meaning of CPATH.) The only thing we keep is PATH,
+ # so we can be sure to find the compiler.
+ # TODO(csilvers): it's possible we could need to pass in some
+ # other environment vars, like LD_LIBRARY_PATH. Instead of adding
+ # in more env-vars by hand, consider just removing from os.environ
+ # all the env-vars that are meaningful to gcc, such as CPATH. See
+ # http://docs.freebsd.org/info/gcc/gcc.info.Environment_Variables.html,
+ # or the "Environment Variables Affecting GCC" section of the gcc
+ # info page.
p = subprocess.Popen(command,
shell=False,
stdin=None,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
- env={})
+ env={'PATH': os.environ['PATH']})
out = p.communicate()[0]
except (IOError, OSError), why:
raise NotCoveredError (