[distcc] permission problems, DISTCC_DIR
Thomas Schwinge
schwinge-lists-samba.org-distcc at nic-nac-project.de
Fri Feb 20 16:22:50 GMT 2004
Hello!
I'm experiencing the problem described in distcc/TODO the other way
round.
distcc/TODO:
#v+
permissions problems in distcc directory
It probably will happen that different users will share a
distcc_dir, for example by running some compilations with sudo.
This can cause files to be created in those directories with the
wrong permissions...
This can easily happen if you run a compilation through sudo,
because it will run as root but with the same $HOME.
There is no completely good solution because if root creates
~mbp/.distcc with tight permissions there's not much we can do.
We're now as loose as the user's umask allows, so often things
will work even if the ownership is wrong.
Perhaps we could try to remove and recreate the directory? That
should usually work, though it will cause some trouble. Perhaps
better is to just emit obvious messages.
We might also try removing all files when we're done. This will
make it less likely that there is a root-owned lockfile around to
cause trouble... It might also make it less likely that lockfiles
for long-dead hosts will hang around. This is more important now
that it's not in /tmp...
#v-
I start a software installation script as root, the script calls setgid
and setuid and begins to compile.
As $HOME is still set to ~root distcc will fail because of not being
able to create files in ~root/.distcc.
So I set DISTCC_DIR - btw. this in not mentioned in the manual page nor
in distcc's run-time help; a patch is attached - to /tmp/distcc and
applied the distcc/patches/lisa--recursive-mkdir-uid-distccdir.patch to
have a separate directory for every UID.
The patch needs a tiny modification to make it apply against current
versions of distcc, a patch is attached.
Is there a better solution to solve this problem?
Regards,
Thomas
-------------- next part --------------
--- distcc/patches/lisa--recursive-mkdir-uid-distccdir.patch~ 2004-02-20 09:22:34.000000000 +0000
+++ distcc/patches/lisa--recursive-mkdir-uid-distccdir.patch 2004-02-20 09:22:34.000000000 +0000
@@ -10,7 +10,7 @@
**/
int dcc_mkdir(const char *path)
{
-- if ((mkdir(path, 0755) == -1) && (errno != EEXIST)) {
+- if ((mkdir(path, 0777) == -1) && (errno != EEXIST)) {
- rs_log_error("mkdir %s failed: %s", path, strerror(errno));
- return EXIT_IO_ERROR;
- }
-------------- next part --------------
diff -Nru distcc-o/man/distcc.1 distcc/man/distcc.1
--- distcc-o/man/distcc.1 2004-01-01 20:44:17.000000000 +0000
+++ distcc/man/distcc.1 2004-02-20 10:06:34.000000000 +0000
@@ -355,7 +355,7 @@
distcc distinguishes between "genuine" errors such as a syntax error
in the source, and "accidental" errors such as a networking problem
connecting to a volunteer. In the case of accidental errors, distcc
-will retry the connection locally unless the DISTCC_FALLBACK option
+will retry the compilation locally unless the DISTCC_FALLBACK option
has been disabled.
.PP
If the compiler exits with a signal, distcc returns an exit code of
@@ -408,7 +408,7 @@
.TP
.B "DISTCC_FALLBACK"
By default distcc will compile locally if it fails to distribute a job
-to the indended machine, or if not host list can be found. If this
+to the intended machine, or if no host list can be found. If this
variable is set to 0 then fallbacks are disabled and those
compilations will simply fail. Note that this does not affect jobs
which must always be local such as linking.
@@ -434,6 +434,10 @@
or "tsocks-ssh" that accepts a similar command line. The command is
not split into words and is not executed through the shell.
.TP
+.B "DISTCC_DIR"
+Per-user configuration directory to store lock files and state files.
+By default ~/.distcc/ is used.
+.TP
.B "TMPDIR"
Directory for temporary files such as preprocessor output. By default
/tmp/ is used.
diff -Nru distcc-o/src/distcc.c distcc/src/distcc.c
--- distcc-o/src/distcc.c 2004-01-01 20:44:18.000000000 +0000
+++ distcc/src/distcc.c 2004-02-20 10:10:21.000000000 +0000
@@ -89,6 +89,7 @@
" --version show version and exit\n"
"\n"
"Environment variables:\n"
+" See the manual page for a complete list.\n"
" DISTCC_VERBOSE=1 give debug messages\n"
" DISTCC_LOG=LOGFILE send messages here, not stderr\n"
" DISTCC_TCP_CORK=0 disable TCP corks\n"
More information about the distcc
mailing list