[distcc] Function getenv() does not work properly in certain areas of distcc's code

Tom Holly hollydt at gmail.com
Mon Jun 1 15:59:39 GMT 2009


I am running distcc version 3.1 on a Sun, using all Suns as servers.
$TMPDIR: "/tmp/distcc"

I have noticed that the getenv() function for returning environmental values
is not entirely working in the distcc code.
When running from a remote machine, the getenv function fails to get the
variable's value.
For example, in tempfile.c, the $TMPDIR environmental variable is needed so
that distcc knows where to store temporary files.
If the value cannot be accessed, the default is "/tmp". I end up with a
bunch of temporary files in my $TMPDIR directory and some in /tmp.
Here's what ends up where:

/tmp/distcc:
distcc_ea1df635.stderr             distcc_server_stderr_842af640.txt
lint_61caf63d.txt
distcc_server_stderr_6248f63d.txt  distcc_server_stderr_d2c7f642.txt
lint_828af63e.txt

/tmp:
distcc-pump.Ocai9C/                distccd_GqairN/
sh148170                                tmpzSKv_T.include_server-14837-1/


I left a debug line in tempfile.c to show when $TMPDIR was used and when it
wasn't:
----------------------------------------------------------------------------------------
tempfile.c:
----------------------------------------------------------------------------------------
  d = getenv("TMPDIR");

    if (!d || d[0] == '\0') {
        *p_ret = "/tmp";
        rs_log_info("Setting temporary dir. to /tmp");
        return 0;
    } else {
        *p_ret = d;
        rs_log_info("Setting temporary dir. to TMPDIR: %s", d);
        return 0;
    }
----------------------------------------------------------------------------------------
cod is the client machine. apple, cud, kiwi, mango, and pear are all servers
listed in $DISTCC_POTENTIAL_HOSTS

distcc.log:distcc[14900] (dcc_get_tmp_top): Setting temporary dir. to
TMPDIR: /tmp/distcc
cod.log:distccd[14803] (dcc_get_tmp_top): Setting temporary dir. to TMPDIR:
/tmp/distcc
apple.log:distccd[11980] (dcc_get_tmp_top): Setting temporary dir. to /tmp
cud.log:distccd[20104] (dcc_get_tmp_top): Setting temporary dir. to /tmp
kiwi.log:distccd[12287] (dcc_get_tmp_top): Setting temporary dir. to /tmp
mango.log:distccd[20360] (dcc_get_tmp_top): Setting temporary dir. to /tmp
pear.log:distccd[26273] (dcc_get_tmp_top): Setting temporary dir. to /tmp

I want to be able to put ALL temporary files, from distcc and distccd, in
$TMPDIR. However this getenv() issue remains to be a problem.
Help is much appreciated. Thanks!
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the distcc mailing list