From 1e1824da88b74911da300567e11dee30860e6279 Mon Sep 17 00:00:00 2001 From: csilvers Date: Thu, 15 May 2008 01:36:46 +0000 Subject: 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 --- include_server/compiler_defaults.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'include_server') 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 ( -- cgit v1.2.1