This code can silently omit patches if the portage user does not have access to the relevant directories: for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{:${SLOT%/*},}; do for f in "${d}"/*; do
I've proposed a patch here: https://bugs.gentoo.org/attachment.cgi?id=498816