The ZSH module zpty doesn't work when compiled in Gentoo using Portage's sandbox. Synthoms: When you try to load the zpty module and use it you get a ton of errors, like: - (zpty):zpty:2: can't open pseudo terminal: bad file descriptor - ...:zpty:2: no such pty command: ... Explanation: Basically ZSH (or at least zpty) depends on old legacy BSD PTYs (kernel option: CONFIG_LEGACY_PTYS=y, so I guess that article from 2003 might've been somewhat relevant after all) assuming /dev/ptmx cannot be detected upon compilation. It seems like portage sandbox messes up /dev/ptmx detection, and thusly ZSH reverts back to legacy pty detection. Workaround: FEATURES="-sandbox -usersandbox" emerge zsh However, I didn't find a real solution to this, since I don't know how portage sandboxing works..
The bug was initially reported here: https://github.com/sindresorhus/pure/issues/117
please attach the full build log of zsh, and an example zsh command to reproduce the failure you're hitting
Command example: zmodload zsh/zpty zpty cat cat
Created attachment 404254 [details] emerge app-shells/zsh log (part 1)
Created attachment 404256 [details] emerge app-shells/zsh (part 2)
If it can help, a guy (mafredi, https://github.com/sindresorhus/pure/issues/117) discovered that adding to /etc/sandbox.d/10zsh : SANDBOX_WRITE="/dev/ptmx" works. I've also tried to re-emerge app-shells/zsh and it works for me too (no errors anymore).
i've whitelisted write access to /dev/ptmx now (see the other bugs on the topic for some background): http://gitweb.gentoo.org/proj/sandbox.git/commit/?id=6b9b505f4a7716a50ff9e63c85f2c4882987a732