Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 550650 - app-shells/zsh zpty broken in gentoo using sandbox
Summary: app-shells/zsh zpty broken in gentoo using sandbox
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Tim Harder
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-28 14:30 UTC by Alessandro Molari
Modified: 2015-09-20 08:44 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge app-shells/zsh log (part 1) (zsh-5.0.5:20150529-064413.log,185.90 KB, text/x-log)
2015-05-29 06:47 UTC, Alessandro Molari
Details
emerge app-shells/zsh (part 2) (zsh-5.0.5:20150529-064523.log,91.96 KB, text/x-log)
2015-05-29 06:48 UTC, Alessandro Molari
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Molari 2015-05-28 14:30:04 UTC
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..
Comment 1 Alessandro Molari 2015-05-28 14:30:52 UTC
The bug was initially reported here: https://github.com/sindresorhus/pure/issues/117
Comment 2 SpanKY gentoo-dev 2015-05-28 15:04:23 UTC
please attach the full build log of zsh, and an example zsh command to reproduce the failure you're hitting
Comment 3 Alessandro Molari 2015-05-29 06:37:33 UTC
Command example:

zmodload zsh/zpty
zpty cat cat
Comment 4 Alessandro Molari 2015-05-29 06:47:47 UTC
Created attachment 404254 [details]
emerge app-shells/zsh log (part 1)
Comment 5 Alessandro Molari 2015-05-29 06:48:10 UTC
Created attachment 404256 [details]
emerge app-shells/zsh (part 2)
Comment 6 Alessandro Molari 2015-05-29 06:54:04 UTC
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).
Comment 7 SpanKY gentoo-dev 2015-09-20 08:44:33 UTC
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