Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: zpty



> 
> I'm new to this mailing list.  I've been using zsh for a while.
> Recently I found out that zpty actually does not work on my Linux
> system.
> 
> $ zmodload zsh/zpty
> $ zpty date date
> zpty: can't open pseudo terminal: bad file descriptor
> $
> 
> As I digged into the code, I saw those old-style /dev/ptyxx heuristics
> which may not work on some modern Linux systems because the location is
> changed to /dev/pts/xx.  Meanwhile there's an API in glibc for dealing
> with pseudo terminals.  So I reworked that code a bit.
> 

the location has not changed. /dev/pts are for SVR4 ptys; it depends on your
system if they are compiled in kernel (as well as old-style ones).

> Now it works fine for me.  Of course it's not portable, it works with
> glibc only.  But glibc is one of the most popular libc implementation,
> and it works not on Linux systems only.  So please consider whether this
> can be useful somehow.
> 

This won't without suitable configure tests. You can't assume glibc is the
only existing libc implementation. Your patch simply kills zpty on my
system. If you change your patch to probe for SVR4-style ptys on Linux in
addition to traditional ones without touching other systems, I's say it may
be included.

The same applies to headers, you can't include headers without testing for
their existence. error.h does not exist here.

BTW convention is that all includes and in <module>.h not in C files, but it
may be not as strict.

-andrey



Messages sorted by: Reverse Date, Date, Thread, Author