Up front: I solved this issue for myself, the solution is down there. This report is for others encountering the same, and for devs to avoid such issues in the future. Several python packages fail to emerge for me with USE=doc due to a sandbox violation caused by /usr/bin/sphinx-build trying to open the file /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle for writing. VERSION 1.0 FORMAT: F - Function called FORMAT: S - Access Status FORMAT: P - Path as passed to function FORMAT: A - Absolute Path (not canonical) FORMAT: R - Canonical Path FORMAT: C - Command Line === dev-python/jinja-2.5.5 === F: open_wr S: deny P: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle A: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle R: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle C: /usr/bin/python2.7 /usr/bin/sphinx-build -b html -d _build/doctrees . _build/html === dev-python/mpmath-0.16 === F: open_wr S: deny P: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle A: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle R: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle C: /usr/bin/python2.7 /usr/bin/sphinx-build -E source build === dev-python/matplotlib-1.0.1 === F: open_wr S: deny P: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle A: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle R: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle C: /usr/bin/python2.7 /usr/bin/sphinx-build -D plot_formats=[('png', 80)] -P -b html -d build/doctrees . build/html F: open_wr S: deny P: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle A: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle R: /usr/lib64/python2.7/site-packages/sphinx/pycode/Grammar2.7.pickle C: /usr/bin/python2.7 /usr/bin/sphinx-build -b latex -d build/doctrees . build/latex It seems that sphinx/pycode/pgen2/driver.py does attempt to dump the driver opportunistically: https://bitbucket.org/birkenfeld/sphinx/src/48688502e78b/sphinx/pycode/pgen2/driver.py#cl-114 Looking at the ebuild, it takes some care to generate the pickle in the pkg_postinst function. Apparently that generation failed for me at some point, due to bug 309969 and pythons multi-ABI hackery: I had changed USE_PYTHON to now include 2.6, and while jinja was installed all right for 2.7, it wasn't available for 2.7, thus breaking the 2.6 pickle generation. At the time, I hadn't realized that this was a merge-time problem affecting my live system, as opposed to a build-time one only affecting the portage build dir. Therefore the simple solution for the affected individual is this: USE=-doc emerge -1 jinja && emerge -1 sphinx and solve any reported issues, until you achieve a clean merge. I have several suggestions to make, in order to improve the situation: * Improve the error message, so users know their live system is now broken. * Move the pickle generation to src_compile or src_install if possible. As I believe that python makes way too much use of pkg_postinst already, I'd prefer this solution, but see bug #301915 about python byte code. * Solve bug #309969 working around bug #175808 by making jinja docs a separate package, on which jinja[doc] can pdepend. This should give proper dependency ordering e.g. for python-updater, and this wouldn't have happened. * Reflect enabled ABIs in USE flags. That way, users can decide the ABIs to build per package, and package deps can take this into account. The portage would have known that jinja[python2_6], required for sphinx[python2_6], wasn't available, and would have errored out before the merge. I hear that the multilib-portage approach will be based on USE flags as well.
Fixed in python overlay.
Could you please reference the specific changeset or changesets that fixed this in the overlay? That would be very helpful.
r538 I fixed this bug using python_abi_depend() function, which currently cannot be used in gentoo-x86.
Feel free to open a new issue if you can still reproduce it.