Here's a patch to fix it. I don't know if it's the right fix or not.
Created attachment 49 [details] [review]
I meant read-only, obviously.
I think the real problem is that $HOME isn't set. Fontconfig is supposed to
survive this case, but the attached patch demonstrates a case where this isn't
true. I found another issue with this same case.
I've audited uses of config->cache and other uses of $HOME and I think this was
the only remaining problem. I've committed patches for this to both HEAD and
the 2.2 branch.