[Patches] [ python-Patches-838546 ] make pty.fork() allocate a controlling tty

SourceForge.net noreply at sourceforge.net
Thu Nov 9 12:12:00 CET 2006


Patches item #838546, was opened at 2003-11-08 21:21
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=838546&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: J Raynor (raynorj)
Assigned to: Nobody/Anonymous (nobody)
Summary: make pty.fork() allocate a controlling tty

Initial Comment:

pty.fork() does not allocate a controlling tty on
systems that don't have os.forkpty().  The code for
pty.fork() tries to use os.forkpty(), and if it isn't
available, then it tries to do its work in python, but
it doesn't work.

The code does setup stdin, stdout, and stderr to use
the slave device, but it needs to do an explicit open
on the slave device to make it become a controlling tty.

This patch is against pty.py from python 2.3, but the
same change can be made to pty.py from python 2.2 and
it works there.



----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-11-09 12:12

Message:
Logged In: YES 
user_id=21627

I just looked at the source of the GNU C library, and it
essentially does the same thing:
in login_tty(), it does check whether ttyname returned a
non-NULL string, and then just
opens the terminal once. It might do the null check for a
different reason; it's not
certain that the fd really is a terminal.

On systems that support TIOCSCTTY, glibc uses that instead.

So thanks for the patch; I committed it as r52686 and
r52687. There might be room for
improvement, but that can come as a separate contribution.

----------------------------------------------------------------------

Comment By: J Raynor (raynorj)
Date: 2003-11-11 02:03

Message:
Logged In: YES 
user_id=904832


This works on aix 5.2, 5.1, and 4.3.3.  It also works on
hpux 10.20.


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-11-10 07:38

Message:
Logged In: YES 
user_id=21627

What systems did you test this on? I remember ttyname
returning funny things on some systems.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=838546&group_id=5470


More information about the Patches mailing list