[distcc] Re: PATH problem 2

Wayne Davison wayned at users.sourceforge.net
Tue Jul 8 06:46:58 GMT 2003


On Mon, Jul 07, 2003 at 11:09:47PM -0700, Leif Huhn wrote:
> Why wouldn't this work for the distcc masquerade dir?

I suppose "wouldn't work" was too strong of a statement.  It would work,
but it's less than optimal for the normal case of the user running a
daemon when the path is set for distcc-client use -- at least, that's
true using the current strategy of only recognizing symlinks to ccache
or distcc.

> 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.

(In the case of your path that contained /usr/bin before the ccache
masquerade dir, it would not have output any warnings since it would
have run across a non-symlink gcc before reaching that dir.)

> I don't want to use ccache.  I just expected distccd to work if I
> put the directories that 'gcc' and 'as' were in at the front.

In your case, the patch I alluded to would have made things "Just Work".
I've appended my tweaked version of it to this message.

..wayne..
-------------- next part --------------
--- src/util.c	16 Jun 2003 02:25:10 -0000	1.40
+++ src/util.c	8 Jul 2003 06:25:23 -0000
@@ -263,8 +263,10 @@
         strncpy(buf, p, len);
 
         sprintf(buf + len, "/%s", compiler_name);
-        if (lstat(buf, &sb) == -1 || !S_ISLNK(sb.st_mode))
+        if (lstat(buf, &sb) == -1)
             continue;
+        if (!S_ISLNK(sb.st_mode))
+            break;
         if ((len = readlink(buf, linkbuf, sizeof linkbuf)) <= 0)
             continue;
         linkbuf[len] = '\0';


More information about the distcc mailing list