[Python-Dev] posixmodule.c diffs for working forkpty() and openpty() under Solaris 2.8

Martin v. Loewis martin@v.loewis.de
30 Jun 2002 08:55:56 +0200

Lance Ellinghaus <lellinghaus@yahoo.com> writes:

> The problem is that Solaris (SUN) does NOT have openpty() and does not
> have forkpty().. So what HAVE_ test would you suggest? What would I
> test for? 

... If you know they always come in groups, testing for an single one
would be sufficient.

> I guess I could have tested for "grantpt()", but testing for "sun"
> works as needed.

Does it work on SunOS 4 as well?

> I understand your PERSONAL problem with testing for SYSTEMs.. but
> that does not mean it is WRONG..

It is not just my personal problem; it is a maintainance principle for
Python. Perhaps there should be a section on it in PEP 7.

In this case, it is not only wrong because it is too inclusive (as it
tests for Sun 4 as well). What's worse is that it is too exclusive: it
will force us to produce long lists of tests for other systems that
use the same mechanism.

> > Also, are you certain your changes apply to all systems that define
> > sun?
> Yes. All currently supported Solaris systems will need this patch to
> provide openpty() and forkpty() services. Supported Solaris is 2.8.
> This should work with 2.9 as well.

Besides SunOS 4, are you *sure* it also works on, say, Solaris 2.5?

> This may be the case. I was not coding for these other systems. I was
> only coding for Sun Solaris 2.8. 

But you should be.

> If someone wants to test it on those other systems, then it could be
> expanded for them.

No. Anybody expanding it for other systems will use the same style
that you currently use, and we can look forward for a constant stream
of patches saying "add this, and trust me - I'm the only one who has
such a system". If we later find that the version test was incorrect,
we are at a loss as to what to do.

> Again, was I coding for other systems? No. 

Again, this is my primary concern with that patch.

> Hence the "#if defined(sun)". Again, many other systems do not need
> this patch as they already have forkpty() and openpty() defined.

Right, and autoconf will find out. However, that still leaves quite a
number of systems that follow the STREAMS way of live. If there is a
chance to support them simultaneously, than this should be done.

> Yes. You can use the autopush feature, but that requires making changes
> to the OS level configuration files. If they have been autopushed, it
> will not reload them. You do not want the requirement of making changes
> to the OS level configuration files if you can keep from having to do
> it. BTW: This is how SSH, EMACS, and other programs do it (YES I

That doesn't necessarily make it more right. What happens if you leave
out the ttcompat module?