Hi, I've been adding support for distcc with ccache into the Debian OpenOffice.org package build system, and come across the same problem as reported earlier (thread 'distcc and ccache problems').
After investigating the problem I found it was due to a crash in distccd.
You can reproduce the problem easily like this:
$ echo 'void f() {}' > test.i
$ echo 'void f() {}' > test.ii
$ DISTCC_HOSTS=127.0.0.1 distcc gcc -c -o test.o test.i
[that works]
$ DISTCC_HOSTS=127.0.0.1 distcc gcc -c -o test.o test.ii
[hang...]
I found two problems in the code:
- in dcc_preproc_exten, the extension '.ii' is not recognised. Ccache
preprocesses source and passes input files to distcc with this
extension.
- in dcc_accept_job, the function dcc_preproc_exten can return NULL,
and this is not handled properly, causing a crash later when trying
to take the length of this string.
I attach a patch generated against the latest CVS.
Thanks,
Chris
Index: filename.c
===================================================================
RCS file: /cvsroot/distcc/src/filename.c,v
retrieving revision 1.3
diff -u -3 -p -r1.3 filename.c
--- filename.c 2 Aug 2002 04:20:39 -0000 1.3
+++ filename.c 14 Aug 2002 07:11:17 -0000
@@ -93,7 +93,7 @@ char * dcc_preproc_exten(const char *e)
} else if (!strcmp(e, "c") || !strcmp(e, "cc")
|| !strcmp(e, "cpp") || !strcmp(e, "cxx")
|| !strcmp(e, "cp") || !strcmp(e, "c++")
- || !strcmp(e, "C")) {
+ || !strcmp(e, "C") || !strcmp(e, "ii")) {
return ".ii";
} else if (!strcasecmp(e, "s")) {
return ".s";
Index: serve.c
===================================================================
RCS file: /cvsroot/distcc/src/serve.c,v
retrieving revision 1.30
diff -u -3 -p -r1.30 serve.c
--- serve.c 5 Aug 2002 09:46:33 -0000 1.30
+++ serve.c 14 Aug 2002 07:11:17 -0000
@@ -224,7 +224,7 @@ int dcc_accept_job(int fd)
input_exten = dcc_find_extension(orig_input);
if (input_exten)
input_exten = dcc_preproc_exten(input_exten);
- else
+ if (!input_exten)
input_exten = ".tmp";
temp_i = dcc_make_tmpnam("server", input_exten);
temp_o = dcc_make_tmpnam("server", ".out");
msg00048/pgp00000.pgp
Description: PGP signature
