On Tue, Jan 24, 2006 at 11:52:52PM +0100, "Martin v. Löwis" wrote:
> > It looks like a timing issue; the first run succeeds, all subsequent runs > > fail, for a while, anyway. I'll do some googling and browsing other > > tty/pty-using code to see if there's anything we're not doing we should be > > doing, but it looks like a platform bug that we can't fix... Not without > > re-implementing os.isatty anyway ;P > Couldn't there be a bug in openpty instead? Perhaps it is trying to > allocate the same device again, but fails to do so correctly, and fails > to recognize that it should use a different one instead. Well, a bug in openpty is what I started with. Python's posix.openpty() that is, as Solaris doesn't have openpty. Openpty is emulated using code taken almost verbatim from Solaris' pts(7D) manpage: fdm = open("/dev/ptmx", O_RDWR); /* open master */ grantpt(fdm); /* change permission of slave */ unlockpt(fdm); /* unlock slave */ slavename = ptsname(fdm); /* get name of slave */ fds = open(slavename, O_RDWR); /* open slave */ ioctl(fds, I_PUSH, "ptem"); /* push ptem */ ioctl(fds, I_PUSH, "ldterm"); /* push ldterm*/ (That's the manpage code.) This is also what openssh does (as far as I can tell). Screen does it slightly differently; it does the ptsname() call before the grantpt/unlockpt calls, but the open(slavename) after. If I make posixmodule do that, it still fails on Solaris. Mucking with it more just breaks it more. The thing is, disabling the check that fails, whether the slave-tty returned by os.openpty() is a tty, shows that the later test for the same thing succeeds. The later test is done in a child created by pty.fork(). Disabling the ptmx code on Solaris is probably the most reliable way to fix the failing test; the pty module will fall back to old-style BSD pty code and that works fine. But it's a bit of a shame not to use /dev/ptmx just because the slave fd, when used directly (rather than in a child process) sometimes doesn't seem to be a tty. They're still connected, it still seems to work fine. > Anyway, if you still think you need an OS 10 account, please let me > know, and I can give you an account to the machine the buildbot > runs on. I think I've seen enough confusing situations for a while... I'm sure the bug is the same on Solaris 10 ;P -- Thomas Wouters <[EMAIL PROTECTED]> Hi! I'm a .signature virus! copy me into your .signature file to help me spread! _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com