In combination with bug #99101, the ccache+userpriv permissions checking also compares the directory UID with the portage GID. While these are normally the same it is not, in fact, what the code modifies. Suggest changing it to either mystat[stat.ST_UID] != portage_uid or mystat[stat.ST_GID] != portage_gid probably the latter. Reproducible: Always Steps to Reproduce: Code defect
Created attachment 65095 [details, diff] patch of the /usr/lib/portage/pym/portage.py
Looks good to me, if portage's GID is not equal to the UID then all kinds of permission changes get triggers, even through they aren't needed. A quick check shows stable could use it.
*** Bug 104392 has been marked as a duplicate of this bug. ***
Fixed in 2.0.53_rc3