[ccache] Insufficient environment sanitization in test.sh

Radu Rendec rrendec at arista.com
Sat Dec 23 13:49:21 UTC 2017


Hi all,

I ran across a weird issue where test.sh fails in the CCACHE_NOHASHDIR
test because the CCACHE_HASHDIR variable happens to be set in my
environment.

I added a debug print in conf_update_from_environment() and the
variable that is inherited from the shell (CCACHE_HASHDIR) comes last,
so it has precedence over CCACHE_NOHASHDIR=1 that is set locally by the
test.

I would say this is a problem with test.sh, which fails to sanitize the
environment properly at the beginning of the TEST() function. Probably
this is a problem with all boolean options, which accept either the
direct or negated form (e.g. CCACHE_HASHDIR vs. CCACHE_NOHASHDIR).

My idea is to iterate through the output of `env` and unset all
variables starting with CCACHE_ instead of listing them explicitly
(since this is pretty much what conf_update_from_environment() does).
Any thoughts?

Thanks,
Radu Rendec



More information about the ccache mailing list