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

:term doesn't work on mac OS High Sierra #2162

Closed
Azakur4 opened this issue Sep 27, 2017 · 11 comments
Closed

:term doesn't work on mac OS High Sierra #2162

Azakur4 opened this issue Sep 27, 2017 · 11 comments

Comments

@Azakur4
Copy link

Azakur4 commented Sep 27, 2017

When i run :term in vim only get a black window

screen shot 2017-09-27 at 14 14 20

the prompt never appear, im running vim 8.0.1150

@chrisbra
Copy link
Member

When did it break? What is your 'shell' setting? and what happens when you use :term bash?

@lifepillar
Copy link
Contributor

lifepillar commented Sep 27, 2017

It works in macOS 10.12, it breaks in macOS 10.13 (tested with Terminal.app and iTerm2). The 'shell' option is set to shell in both cases. A command like :term bash behaves as described by the OP in 10.13, it works in 10.12. Good luck figuring out what Apple has changed!

@lifepillar
Copy link
Contributor

I can reproduce the issue on macOS 10.13 with Vim as old as v0.997 (I haven't tried older versions). No problems with macOS 10.12.

@chrisbra
Copy link
Member

I guess someone with a recent mac needs to debug this then.

@ichizok
Copy link
Contributor

ichizok commented Sep 27, 2017

On 10.13, trying to open /dev/ptyXY fails EAGAIN error.
I think need to open /dev/ptmx, or use posix_openpt instead of open.

Could you try this patch? (but this is just workaround)

--- a/src/pty.c
+++ b/src/pty.c
@@ -267,7 +267,7 @@ OpenPTY(char **ttyn)
 }
 #endif

-#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
+#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux)

 /* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
  * Same for Mac OS X Leopard. */

@chrisbra
Copy link
Member

shouldn't we perhaps also get an error, if openpty fails?

@lifepillar
Copy link
Contributor

Yup, the patch appears to fix it.

@Azakur4
Copy link
Author

Azakur4 commented Sep 27, 2017

sorry for my ignorance but how i can apply ur patch @ichizok do u know some site i can read about that?

Or i have to fork the vim repository make the changes and compile again?

@nuko8
Copy link

nuko8 commented Sep 28, 2017

I agree to @ichizok .

Recently, I've been working on overhauling macOS part of the build system, and I came across a similar problem regarding /dev/ptmx just a few days ago --- even on El Capitan (10.12), :term hangs against the Athena and Motif GUIs on XQuartz.

But my solution is a bit conservative in comparison with his:

diff --git a/src/pty.c b/src/pty.c
index 9b0361222..cc1c39a43 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -267,10 +267,11 @@ OpenPTY(char **ttyn)
 }
 #endif

-#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
+#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) \
+                    && !(defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6))

 /* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
- * Same for Mac OS X Leopard. */
+ * Same for Mac OS X Leopard (10.5). */
 #define PTY_DONE
     int
 OpenPTY(char **ttyn)

This is because of the comment on Leopard (10.5), and that, when googling, I came across a question at SO in which a Tiger (10.4) user asked about /dev/ptmx last March.

@tracyone
Copy link

Same issue.

adizero pushed a commit to adizero/vim that referenced this issue May 19, 2018
Problem:    :terminal doesn't work on Mac High Sierra.
Solution:   Change #ifdef for OpenPTY(). (Ozaki Kiichi, Kazunobu Kuriyama,
            closes vim#2162)
@daleworley
Copy link

You likely ran into the same problem I had on High Sierra with Emacs shell windows (https://stackoverflow.com/questions/53531777/cannot-open-pty-under-mac-os-high-sierra/53581958#53581958) -- High Sierra uses a different mechanism for allocating pty's than earlier Mac OS X releases, so if your code isn't reconfigured for it, it will fail to allocate a pty.

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

7 participants