From owner-freebsd-stable@FreeBSD.ORG Sun Jul 20 05:19:50 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90E041065678 for ; Sun, 20 Jul 2008 05:19:50 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: from web57008.mail.re3.yahoo.com (web57008.mail.re3.yahoo.com [66.196.97.112]) by mx1.freebsd.org (Postfix) with SMTP id 55C188FC0A for ; Sun, 20 Jul 2008 05:19:50 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: (qmail 40295 invoked by uid 60001); 20 Jul 2008 05:19:49 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:X-Mailer:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Message-ID; b=MWNYgPUycLWXANHFC5aB2TB00lLh/iL9v51ZvF0bBmiDfVt1BQexGZ0sCZe4ketXsfCfCuTgicbLe2NpTntVC6WzZxFeX9I9Htp1vGt1k+0oI0//Lv0Irjb4jMBgq2FSxONGh/z9X0wAFZxfKRoPkBqrq5MWPjRafxdvJswWj00=; Received: from [220.255.7.205] by web57008.mail.re3.yahoo.com via HTTP; Sat, 19 Jul 2008 22:19:49 PDT X-Mailer: YahooMailWebService/0.7.218 Date: Sat, 19 Jul 2008 22:19:49 -0700 (PDT) From: Unga To: freebsd-stable@freebsd.org In-Reply-To: <545719.90429.qm@web57010.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <451954.40252.qm@web57008.mail.re3.yahoo.com> Cc: gavin@FreeBSD.org, dnelson@allantgroup.com Subject: Re: Pseudoterminals increase: compilation error X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: unga888@yahoo.com List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2008 05:19:50 -0000 --- On Sun, 7/20/08, Unga wrote: > From: Unga > Subject: Re: Pseudoterminals increase: compilation error > To: "Dan Nelson" > Cc: freebsd-stable@freebsd.org > Date: Sunday, July 20, 2008, 10:44 AM > --- On Sun, 7/20/08, Dan Nelson > 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