[ccache] Minor enhancement request: Handling of CCACHE_PREFIX when it is defined as a null string
Frank Klotz
frank.klotz at alcatel-lucent.com
Tue Feb 7 11:38:03 MST 2012
Could a CCACHE_PREFIX defined as a null string please be treated as
if it were undefined, rather than as a fatal error?
Yes, of course, I can fix this in my script by making sure I undefine it
if I don't want a prefix, but I got a little surprised when resetting it
from "distcc" to "" caused a fatal ccache failure. And it was a bit
nasty to debug.
I think I see two places in ccache.c that would be affected here:
Around line 218:
if ((e = getenv("CCACHE_PREFIX"))) {
char *p = find_executable(e, MYNAME);
if (!p) {
fatal("%s: %s", e, strerror(errno));
}
args_add_prefix(orig_args, p);
}
(Change that first line to something like this?
if ((e = getenv("CCACHE_PREFIX")) && strlen (e) > 0) {
)
And line 1944:
env = getenv("CCACHE_PREFIX");
if (env) {
char *p = find_executable(env, MYNAME);
if (!p) {
fatal("%s: %s", env, strerror(errno));
}
cc_log("Using command-line prefix %s", env);
args_add_prefix(compiler_args, p);
}
And change the second line here to
if (env && strlen (env) > 0) {
And you might want to consider refactoring this
almost-but-not-quite-identical code into a function or macro - not sure
why there are two versions....
Thanks,
Frank Klotz
More information about the ccache
mailing list