Pseudoterminals increase: compilation error

Unga unga888 at yahoo.com
Sun Jul 20 05:19:50 UTC 2008


--- On Sun, 7/20/08, Unga <unga888 at yahoo.com> wrote:

> From: Unga <unga888 at yahoo.com>
> Subject: Re: Pseudoterminals increase: compilation error
> To: "Dan Nelson" <dnelson at allantgroup.com>
> Cc: freebsd-stable at freebsd.org
> Date: Sunday, July 20, 2008, 10:44 AM
> --- On Sun, 7/20/08, Dan Nelson
> <dnelson at allantgroup.com> wrote:
> 
> > Expect's error message doesn't say anything
> except
> > "something isn't
> > working but I won't tell you what".  Run
> > 
> > truss -o truss.log -f expect -c "spawn ls" 
> > 
> > and determine which syscall is failing, with what
> error
> > number, just
> > before expect prints its "no more ptys"
> message. 
> > That will tell you
> > whether it's a permissions issue, or something
> else. 
> > If there are no
> > obvious errors, post a part of the log.
> > 
> > Also, what version of expect are you running? 
> Versions
> > between
> > 5.38.0_1 and 5.43.0_2 had a bug in the port Makefile
> that
> > limited the
> > number of ptys expect could see.  See
> > http://www.freebsd.org/cgi/query-pr.cgi?pr=108311 .
> > 
> 
> Here are more detail. In fact, I noted it through strace
> after my previous email. 
> 
> ls -l /dev/ | grep pty
> crw-rw-rw-  1 root  wheel       0, 169 Jul 20 10:11 ptyp0
> crw-rw-rw-  1 root  wheel       0, 171 Jul 20 10:22 ptyp1
> 
> truss -o truss.log -f expect -c "spawn ls"
> 
>  1178: open("/dev/ptyp0",O_RDWR,027757763030)   
> ERR#5 'Input/output error'
>  1178: open("/dev/ptyp1",O_RDWR,027757763030)   
> ERR#5 'Input/output error'
>  1178: open("/dev/ptyp2",O_RDWR,027757763030)   
> = 5 (0x5)
>  1178: fstat(5,{mode=crw-rw-rw-
> ,inode=178,size=0,blksize=4096}) = 0 (0x0)
>  :
>  :
>  1178: chown("/dev/ttyp2",1002,4)               
> ERR#1 'Operation not permitted'
>  1178: close(5)                                  = 0 (0x0)
>  1178: close(-1)                                 ERR#9
> 'Bad file descriptor'
>  1178: close(-1)                                 ERR#9
> 'Bad file descriptor'
>  1178: open("/",O_RDONLY,027757764430)          
> = 5 (0x5)
>  1178: close(5)                                  = 0 (0x0)
>  1178: write(2,"The system has no more ptys. 
> As"...,106) = 106 (0x6a)
>  1178: write(2,"\r\n",2)                 
>        = 1179 (0x49b)
>  = 2 (0x2)
> 
> ls -l /dev/ | grep pty
> crw-rw-rw-  1 root  wheel       0, 169 Jul 20 10:11 ptyp0
> crw-rw-rw-  1 root  wheel       0, 171 Jul 20 10:23 ptyp1
> crw-rw-rw-  1 root  wheel       0, 178 Jul 20 10:11 ptyp2
> 
> I'm using Expect-5.43.0 compiled from sources.
> 
> So, it looks like some sort of a misconfiguration. Still
> investigating.
> 

Here is a more narrow down. This problem is happening inside a chroot jail but only as a normal user:

Here is what it create for following command:
expect -c "spawn ls"

On FreeBSD
==========
crw--w----  1 test     tty         0, 181 Jul 20 10:11 ttyp3

On chroot
=========
crw-rw-rw-  1 root  wheel       0, 181 Jul 20 10:11 ttyp3

For some reason devfs creates ttys differently.

"devfs rule showsets" shows same for both /dev and /path/dev. Its just 1, 2, 3, 4.

I tried to add a new ruleset as follows (inside chroot jail):
devfs ruleset 10
devfs rule add path tty* type tty mode 660 group tty
devfs rule applyset

Now devfs creates ttys as follows:
crw-rw----  1 root  tty         0, 179 Jul 20 13:08 ttyp2

So, now the question is how to get the devfs to create ttys owned by the requested user? or can it be something else?

As for Gavin's suggestion to upgrade to Expect-5.43.0_2, actually, there is no such version on http://expect.nist.gov/, latest is still Expect-5.43.0.

Regards
Unga



      


More information about the freebsd-stable mailing list