[distcc] Re: PATH problem 2
Martin Pool
mbp at samba.org
Fri Jul 11 03:39:48 GMT 2003
On 7 Jul 2003, Wayne Davison <wayned at users.sourceforge.net> wrote:
> > Why wouldn't removing all directories that contain symlinks to gcc
> > work?
>
> That is another potential cleanup strategy if you didn't really mean
> "symlinks to gcc" but "gcc symlinks". And actually it's not gcc but cc
> we're scanning for at daemon startup (since we don't know what compiler
> the user is going to call).
>
> The problem with this heuristic is that the real compiler may, in fact,
> be a symlink (it was on several older systems I used to use). If we
> stop the dropping of dirs at the first non-symlink to cc we find, and if
> we leave the last symlink if we don't find a real file (whew!) that
> could possibly work, but it might introduce some other unforeseen
> problem.
>
> What would you think if it did no path munging at all, but it output
> warnings like this (if appropriate):
>
> WARNING: found a cc->ccache symlink on the PATH -- is this intentional?
> WARNING: found a cc->distcc symlink on the PATH -- potential config problem.
> Set DISTCD_PATH in the environment to override distccd's PATH setting and to
> silence these warnings.
I was just wondering about actually not changing the server-side PATH
at all, and instead walking along the path ourselves instead of
calling execvp(). That seems to have a few advantages:
- If the contents of the directories change while the daemon is
running then it will adapt properly.
- The server can search for the actual name of the compiler, rather
than looking for "cc".
- We can emit warnings as you suggest.
So (some?) calls to dcc_execvp would be replaced with something like
this:
dcc_execvp_skip_masq(char *argv[])
foreach component of PATH:
name = dir + "/" + argv[0]
target = readlink(name)
if a link:
if target contains "distcc" || target contains "ccache":
print warning
continue
execv(name, argv)
# if execv fails, continue
return ENOENT
--
Martin
More information about the distcc
mailing list