Consider this sample ebuild: EAPI=8 SLOT=0 KEYWORDS="~amd64" pkg_pretend() { einfo "NO_DIE_MAN=${NO_DIE_MAN}" if [[ ! ${NO_DIE_MAN} ]]; then die "I die" fi } pkg_setup() { unset NO_DIE_MAN } If I build a binary package via: NO_DIE_MAN=1 emerge -vB dummy it correctly creates a package without "NO_DIE_MAN" in its environment.bz2. However, if I try to install it afterwards: NO_DIE_MAN=1 emerge -vk dummy it fails because Portage apparently ignores NO_DIE_MAN from the calling environment, even though it is not overwritten by environment.bz2. This certainly goes against the principle of the least surprise.
I think there's a similar bug report about similar behavior for emerge --config. The build time environment is frozen, but it can be modified vi /etc/portage/bashrc. We need to be careful not to violate PMS section 11.2 "The state of variables between functions" here.