From owner-freebsd-current@FreeBSD.ORG Tue Jul 5 04:57:56 2005 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7FEE416A41C; Tue, 5 Jul 2005 04:57:56 +0000 (GMT) (envelope-from marcus@FreeBSD.org) Received: from creme-brulee.marcuscom.com (creme-brulee.marcuscom.com [24.172.16.118]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A46B43D49; Tue, 5 Jul 2005 04:57:55 +0000 (GMT) (envelope-from marcus@FreeBSD.org) Received: from shumai.marcuscom.com (shumai.marcuscom.com [192.168.1.4]) by creme-brulee.marcuscom.com (8.13.3/8.13.3) with ESMTP id j654w8gD065479; Tue, 5 Jul 2005 00:58:08 -0400 (EDT) (envelope-from marcus@FreeBSD.org) From: Joe Marcus Clarke To: current@FreeBSD.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-8vO5n1Ap6o9rCDn0XvOp" Organization: FreeBSD, Inc. Date: Tue, 05 Jul 2005 00:57:45 -0400 Message-Id: <1120539465.3587.19.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port Cc: phk@FreeBSD.org Subject: grantpt broken on -CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2005 04:57:56 -0000 --=-8vO5n1Ap6o9rCDn0XvOp Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I recently discovered the gnome-vfs sftp method which uses posix_openpt/ptsname/grantpt to set up a pty for communicating with the sftp subprocess fails to work. I found that grantpt() fails due to EACCES. The underlying reason looks to be that the pty name returned by ptsname() is not unhidden in devfs. Basically, the following code will fail: #include #include #include #include main(void) { int fd; char *p; fd =3D posix_openpt (O_RDWR | O_NOCTTY); if (fd < 0) { printf("Failed to open PTY: %s\n", strerror(errno)); return -1; } else { if ((p =3D ptsname(fd)) !=3D NULL) { printf("ptsname =3D %s\n", p); } else { printf("Failed to get ptsname: %s\n", strerror(errn= o)); close (fd); if (grantpt(fd) < 0) { printf("Failed to run grantpt: %s\n", strerror(errno)); close (fd); return -1; } close (fd); return 0; } Basically, everything works until the grantpt() call which returns EACCES. The same code works just fine under 5-STABLE. I even tried manually applying devfs rules to unhide the missing tty device (/dev/ttys5 in my tests), but that didn't work. The program also fails in the same way when run as root. This has been failing since I upgraded from 5-STABLE to -CURRENT about three weeks ago. I'm now running -CURRENT from yesterday. Joe --=20 Joe Marcus Clarke FreeBSD GNOME Team :: gnome@FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome --=-8vO5n1Ap6o9rCDn0XvOp Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQBCyhNJb2iPiv4Uz4cRAtvTAKCS2EG5cRgdm8n4SkzucedAnYM6mwCcDCtR 75FDZ8CMOInJqvgN3v8LeHw= =8cnj -----END PGP SIGNATURE----- --=-8vO5n1Ap6o9rCDn0XvOp--