Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zpty errors #117

Closed
alem0lars opened this issue May 25, 2015 · 23 comments
Closed

zpty errors #117

alem0lars opened this issue May 25, 2015 · 23 comments

Comments

@alem0lars
Copy link

When starting pure, I get the following error:

(zpty):zpty:2: can't open pseudo terminal: bad file descriptor

Also, when entering in some particular directories (like git) I get:

async_job:zpty:2: no such pty command: prompt_pure
async_job:zpty:2: no such pty command: prompt_pure
@alem0lars alem0lars changed the title zpty: can't open pseudo terminal: bad file descriptor zpty errors May 25, 2015
@mafredri
Copy link
Collaborator

Could you provide me with more details? These would be helpful to start:

  • Operating system
  • Zsh version
  • Zsh config

@alem0lars
Copy link
Author

  • Operating system: Linux julia 3.18.9-hardened #5 SMP Mon May 11 19:03:55 UTC 2015 x86_64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz GenuineIntel GNU/Linux
  • Distro: Gentoo
  • ZSH version: zsh 5.0.5 (x86_64-pc-linux-gnu)

The zsh configuration just loads the prompt (prompt pure) and ofc I have both async and pure functions in the load path.

@mafredri
Copy link
Collaborator

Looks like it could be a problem with regards to Gentoo not having /dev/ptyXX file descriptors (they're all located under /dev/pts/X. See here for more info.

I can reproduce this on Gentoo with ZSH 5.0.7, so I'll try to investigate further. But so far it seems to be a problem with ZSH on Gentoo.

@mafredri
Copy link
Collaborator

Hmm, to be honest it seems that my previous link is probably a dead end. I tried compiling my kernel with CONFIG_LEGACY_PTYS=y and I still experience the problem even with /dev/ptyXX devices present. As of now I have no clue what is causing this problem, and running ZSH with debugging enabled is not giving any clues :(.

ZSH versions tested: 5.0.7-r2 and 9999.

It's not a pure problem though, as can be seen from unconfigured zsh:

% zmodload zsh/zpty
zmodload zsh/zpty
+zsh:3> zmodload zsh/zpty
% zpty cat cat
zpty cat cat
+zsh:4> zpty cat cat
zpty: can't open pseudo terminal: bad file descriptor 

@nbari
Copy link

nbari commented May 27, 2015

Same issue here, problem with zpty not pure:

  • FreeBSD 10.1
  • zsh 5.0.7 (amd64-portbld-freebsd10.1)

@mafredri
Copy link
Collaborator

I guess this should be reported to either FreeBSD / Gentoo, the ZSH mailing list or both. Do you guys feel up for it?

@alem0lars
Copy link
Author

afaik Gentoo devs don't fix bugs related to upstream. They usually fix bugs related to ebuilds and specific to the distro. The link you pointed out (http://www.zsh.org/mla/users/2003/msg00561.html) suggests it's an upstream bug.

I think the best place to discuss about the bug is ZSH bugtracker.
There is one here but I think it's not used anymore (no bugs since 2013 O.o).

So we should report it in the mailinglist.

In the meantime, we should bypass the bug because atm pure is unusable and I don't think this bug will be fixed in short time..

@mafredri
Copy link
Collaborator

It seems to me like zpty isn't working due to some permission problem, when running zsh as root it works fine on Gentoo.

@alem0lars how do you mean bypass the bug? zpty is a critical part of how pure does it's asynchronous operations at the moment. If you wish to use pure without zpty you can always revert to pre-1.0.0.

@alem0lars
Copy link
Author

@mafredri I'm worried about how much time takes to upstream to fix the relevant bugs..

@mafredri
Copy link
Collaborator

@alem0lars I was interested on your thoughts on bypassing the bug, as in how to go about it?

Also, like I said above, I do not think that the zsh-users mailing list link from 2003 is relevant to the issue at hand. I could be wrong, ofc.

@mafredri
Copy link
Collaborator

Ok @alem0lars I've got a solution for you. Up to you if you use it or not. 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. So I wouldn't call this purely an upstream bug.

FEATURES="-sandbox -usersandbox" emerge zsh

@mafredri
Copy link
Collaborator

@nbari wouldn't feel right to leave you hanging, so you might try this out.

@alem0lars
Copy link
Author

@mafredri ok.. I try to report it in the gentoo bugtracker and let's see if some one knows how to solve this..

Using the sandbox isn't a real solution in my opinion. It's a workaround, but it's the best thing we have right now..

Thanks :)

@alem0lars
Copy link
Author

Bug is now reported here: https://bugs.gentoo.org/show_bug.cgi?id=550650

In the meantime we should update the readme to tell users about the workaround..

Right?

@nbari
Copy link

nbari commented May 28, 2015

@mafredri many thanks, it is working, for does with custom kernels just need to add:

device pty

@mafredri
Copy link
Collaborator

@alem0lars good job reporting the bug, looks like a dev asked for some follow-up info though.

I think I found a semi-clean solution for this (although this should be part of the ebuild in my opinion):

echo 'SANDBOX_WRITE="/dev/ptmx"' > /etc/sandbox.d/10zsh

Basically this tells the portage sandbox that access to the device is allowed.

@nbari great, glad it's working for you! Where exactly is the device pty supposed to be added?

@nbari
Copy link

nbari commented May 28, 2015

@mafredri It should be added into the kernel configuration file, but this only in the case you compiled a system with no modules and a tight kernel, In a default setup kldload pty works.

@mafredri
Copy link
Collaborator

@nbari aha! Thanks for the clarification, I'll do one last update to the README then 👍

@pierot
Copy link

pierot commented Jul 1, 2015

I have the same problem on OSX 10.10.3.

(zpty):zpty:2: can't open pseudo terminal: device not configured
async_job:zpty:2: no such pty command: prompt_pure
async_job:zpty:2: no such pty command: prompt_pure

@mafredri
Copy link
Collaborator

mafredri commented Jul 1, 2015

This is not the same problem, do you mind opening a new issue and providing more information about your setup? I have never seen this and have no idea why you're seeing it either, but it could be some issue with how your OSX is configured even.

For example the output of the following commands / info might be helpful:

  • setopt
  • unsetopt
  • Using Terminal, iTerm etc?
  • Using tmux, screen, etc?
  • Your zshrc

@pierot
Copy link

pierot commented Jul 1, 2015

@mafredri I just updated zsh with Homebrew and the problem disappeared.

@mafredri
Copy link
Collaborator

mafredri commented Jul 1, 2015

@pierot that's interesting. I haven't had any problems with the osx version of zsh either. Were you using an older homebrew version of zsh or /bin/zsh? If you were using the osx zsh, would you mind checking if you had any custom / modified files in your zsh setup: find /usr/share/zsh -newermt "2014-10-22" ?

Glad it's working though!

@pierot
Copy link

pierot commented Jul 2, 2015

@mafredri It is not working anymore ..

My zsh version is 5.0.8.

❯ find /usr/share/zsh -newermt "2014-10-22"
/usr/share/zsh/5.0.5/help
/usr/share/zsh/5.0.5/help/autoload
/usr/share/zsh/5.0.5/help/bye
/usr/share/zsh/5.0.5/help/chdir
/usr/share/zsh/5.0.5/help/declare
/usr/share/zsh/5.0.5/help/float
/usr/share/zsh/5.0.5/help/history
/usr/share/zsh/5.0.5/help/integer
/usr/share/zsh/5.0.5/help/local
/usr/share/zsh/5.0.5/help/logout
/usr/share/zsh/5.0.5/help/pushln
/usr/share/zsh/5.0.5/help/r
/usr/share/zsh/5.0.5/help/readonly
/usr/share/zsh/5.0.5/help/rehash
/usr/share/zsh/5.0.5/help/type
/usr/share/zsh/5.0.5/help/unalias
/usr/share/zsh/5.0.5/help/unfunction
/usr/share/zsh/5.0.5/help/where
/usr/share/zsh/5.0.5/help/which

The message

async_job:zpty:2: no such pty command: prompt_pure
async_job:zpty:2: no such pty command: prompt_pure

only occurs in directories from a git repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants