rpmbuild fails with an error like this: error: Unable to open temp file. strace shows that it is trying to create /var/lib/tmp: stat("/var", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/var/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/var/lib/tmp", 0x7fffb546eb80) = -1 ENOENT (No such file or directory) mkdir("/var/lib/tmp", 0755) = -1 EACCES (Permission denied) That's because the _tmppath macro in /usr/lib/rpm/macros is: %_tmppath %{_var}/tmp which actually expands out to /var/lib/tmp because we pass --localstatedir=/var/lib to configure when building rpm. A saner value for that macro would be /var/tmp.
Created attachment 264123 [details] obligatory emerge --info
Fixed in 4.8.1-r2 and 4.9.0. Thank you for reporting the bug