[distcc] Incorrect handling of -x and -s arguments
Michal Welnicki
mw189448 at students.mimuw.edu.pl
Tue Nov 30 09:21:03 GMT 2004
Hello.
The handling of "-x" and "-specs=" arguments in current version of distcc
(2.18.2) seems to be broken.
The command:
$ distcc gcc -c -s test.c
incorrectly forces local compilation, while
$ distcc gcc -c -specs=xxx test.c
gets distributed.
The problem is that the arguments to str_startswith are reversed:
...
} else if (str_startswith(a, "-specs=")) {
rs_trace("%s must be local", a);
...
while str_startswith's definition is:
int str_startswith(const char *head, const char *worm)
Patch for arg.c is attached.
BTW, I've just noticed that this should fix Hamish Greig's problem
(previous mail in the list archives). His gcc line includes the "-s"
switch, which the daemon wrongly treats as "-specs=", forcing local
compilation.
Michal Welnicki
-------------- next part --------------
diff -urN devel-orig/src/arg.c devel-new/src/arg.c
--- devel-orig/src/arg.c 2004-11-28 21:03:02.000000000 +0100
+++ devel-new/src/arg.c 2004-11-30 09:57:30.000000000 +0100
@@ -181,7 +181,7 @@
rs_trace("%s must be local", a);
return EXIT_DISTCC_FAILED;
}
- } else if (str_startswith(a, "-specs=")) {
+ } else if (str_startswith("-specs=", a)) {
rs_trace("%s must be local", a);
return EXIT_DISTCC_FAILED;
} else if (!strcmp(a, "-S")) {
@@ -193,7 +193,7 @@
} else if (!strcmp(a, "-frepo")) {
rs_log_info("compiler will emit .rpo files; must be local");
return EXIT_DISTCC_FAILED;
- } else if (str_startswith(a, "-x")) {
+ } else if (str_startswith("-x", a)) {
rs_log_info("gcc's -x handling is complex; running locally");
return EXIT_DISTCC_FAILED;
} else if (!strcmp(a, "-c")) {
More information about the distcc
mailing list