ttygif icon indicating copy to clipboard operation
ttygif copied to clipboard

Error: Out of pty's

Open DanielJonesEB opened this issue 7 years ago • 11 comments

iTerm 2 Build 3.1.5.beta.2 macOS High Sierra 10.13.1 (17B48)

$ ttyrec myrecording
Out of pty's
Terminated: 15

Any suggestions?

DanielJonesEB avatar Nov 22 '17 14:11 DanielJonesEB

Did you build ttyrec yourself?

icholy avatar Nov 22 '17 14:11 icholy

Thanks for the prompt response. No, I used brew:

$ brew info ttyrec
ttyrec: stable 1.0.8 (bottled)
Terminal interaction recorder and player
http://0xcc.net/ttyrec/
/usr/local/Cellar/ttyrec/1.0.8 (9 files, 45.2KB) *
  Poured from bottle on 2017-11-22 at 14:11:31
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ttyrec.rb

DanielJonesEB avatar Nov 22 '17 14:11 DanielJonesEB

Not too sure what's happening, but here's some stuff to try:

Build ttyrec with -DSVR4

wget http://0xcc.net/ttyrec/ttyrec-1.0.8.tar.gz
tar -xf ttyrec-1.0.8.tar.gz
cd ttyrec-1.0.8

# Add -DSVR4 to line 2 of the Makefile
# CFLAGS = -O2 -DSVR4

make
./ttyrec myrecoding

If that doesn't work, post the output to the following.

# strace
strace ttyrec myrecording

# open pty's
ls /dev/pts

# max ptys
cat /proc/sys/kernel/pty/max

icholy avatar Nov 22 '17 14:11 icholy

I just hit this as well, installed via brew

berndtj avatar Nov 22 '17 16:11 berndtj

Same and via brew. Using Hyper terminal though.

Dids avatar Nov 29 '17 20:11 Dids

I don't have a mac to debug this on. The problem is here somewhere https://github.com/mjording/ttyrec/blob/c4fd0f2bc69dba852526df3610f98d867ba5ab24/ttyrec.c#L404-L435 I think we should be using https://linux.die.net/man/3/posix_openpt

icholy avatar Nov 29 '17 20:11 icholy

Since wget doesn't exist on macOS by default, I had to install it with brew install wget.

Just for reference, here's the build output without the -DSVR4 flag:

> make
gcc -O2   -c -o ttyrec.o ttyrec.c
ttyrec.c:363:9: warning: implicit declaration of function 'kill' is invalid in C99
      [-Wimplicit-function-declaration]
        (void) kill(0, SIGTERM);
               ^
1 warning generated.
gcc -O2   -c -o io.o io.c
io.c:161:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
1 warning generated.
gcc -O2 -o ttyrec ttyrec.o io.o
gcc -O2   -c -o ttyplay.o ttyplay.c
ttyplay.c:271:5: warning: implicit declaration of function 'set_progname' is invalid in C99
      [-Wimplicit-function-declaration]
    set_progname(argv[0]);
    ^
1 warning generated.
gcc -O2 -o ttyplay ttyplay.o io.o
gcc -O2   -c -o ttytime.o ttytime.c
ttytime.c:64:5: warning: implicit declaration of function 'set_progname' is invalid in C99
      [-Wimplicit-function-declaration]
    set_progname(argv[0]);
    ^
1 warning generated.
gcc -O2 -o ttytime ttytime.o io.o

After changing the build flags and attempting to build, I got the following error:

> make
gcc -O2 -DSVR4   -c -o ttyrec.o ttyrec.c
ttyrec.c:60:10: fatal error: 'stropts.h' file not found
#include <stropts.h>
         ^~~~~~~~~~~
1 error generated.
make: *** [ttyrec.o] Error 1

You can see here that stropts.h isn't supposed on macOS, so that's definitely a no go.

Additionally, strace, /dev/pts and /proc/sys/kernel/pty/max don't exist on macOS either.

Dids avatar Nov 30 '17 07:11 Dids

Ugh ... hopefully someone will better osx knowledge stumbles onto this.

icholy avatar Dec 12 '17 14:12 icholy

If I have some time, I'll see if I can investigate myself.

berndtj avatar Dec 12 '17 17:12 berndtj

Me too get this issue on Mac.

yugandhar-pathi avatar Nov 04 '19 20:11 yugandhar-pathi

Same issue here. Installed via Macports.

kwrobel avatar Mar 05 '20 16:03 kwrobel