Subject: ptys are not always freed
To: None <current-users@NetBSD.ORG>
From: Todd Vierling <tv@NetBSD.ORG>
List: current-users
Date: 01/19/1998 08:30:33
I've seen this since 1.2G (upgraded from 1.2.1), and I have seen it
documented since 1.2F.  Someone please tell me we aren't crazy.

I can reproducibly, *every time*, make a situation where a pty's:

- slave side client can hold onto the pty and pty's pgrp, even after the
master side has closed; 

- master side is reconnected to the slave side client when reopened, and
any new process the master side program spawns to the slave side cannot
seize the pty's pgrp.

This is very simple to reproduce, and I can do it on my Sparc but not on my
i386 (running 1.3B and 1.3, respectively).  It is reported as reproducible
on the pc532 in 1.2F, sparc in 1.2F and 1.2G, amiga on 1.2G, and the only
nonreproducible report I got was 1.2G on i386.

Here's a way to do it:

Do this only on a quiet system (so you'll be likely to be reallocated a tty
after you close it).  Use screen 3.7.2 (or whatever version, really).  Open
a screen, check which tty it is, and run either pine or emacs in it.  Hit ^A
K (Ctrl-A then K).  Open a screen again.  If you don't see a ghost of your
pine or emacs, check wich tty it is (if the same, it's not reproducible for
you; if not, try opening another screen with ^A ^C and see if you can get
the same pty back).

All I can say is, it's really annoying and strange.  I'm not versed enough
in the tty internals to figure out how a process can hold on to a pty like
that, either.

=====
===== Todd Vierling (Personal tv@pobox.com) =====
== "There's a myth that there is a scarcity of justice to go around, so
== that if we extend justice to 'those people,' it will somehow erode the
== quality of justice everyone else receives."  -- Maria Price