Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2001 11:32:09 +0300 (EEST)
From:      Valentin Nechayev <netch@netch.kiev.ua>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/28383: screen incorrectly detects ptys with devfs
Message-ID:  <200106240832.f5O8W9w08459@iv.nn.kiev.ua>

next in thread | raw e-mail | index | archive | help

>Number:         28383
>Category:       ports
>Synopsis:       screen incorrectly detects ptys with devfs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 24 01:40:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Valentin Nechayev <netch@netch.kiev.ua>
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
home sweet home
>Environment:
System: FreeBSD iv.nn.kiev.ua 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Sat Jun 16 12:43:44 EEST 2001 root@iv.nn.kiev.ua:/usr/obj/usr/HEAD/src/sys/nn12 i386


	
>Description:

When screen is built from ports on fresh -current system with devfs,
config.h contains:

#define PTYRANGE0 "pqrsPQRS"
#define PTYRANGE1 "0"

instead of correct

#define PTYRANGE0 "pqrsPQRS"
#define PTYRANGE1 "0123456789abcdefghijklmnopqrstuv"

This is caused by default screen testing which separates some special
cases (OSF, AIX,...), wide-spread /dev/ptmx variant, and without them
falls to simple BSD-styled case with iterative opening of all master
pty's in classes specified with PTYRANGE0 and PTYRANGE1.
Screen's configure gets values from PTYRANGE0 and PTYRANGE1 from listing
of current /dev, which works correct without devfs, but fails with devfs.

Example of result:

netch@iv:~>w
10:25AM  up 50 mins, 14 users, load averages: 0.00, 0.00, 0.00
USER             TTY      FROM              LOGIN@  IDLE WHAT
root             v1       -                 9:35AM    15 -sbash (sbash)
netch            v2       -                 9:35AM    26 -bash (bash)
netch            v3       -                 9:35AM    26 -bash (bash)
netch            v4       -                 9:35AM    30 -bash (bash)
netch            v6       -                 9:36AM    48 ssh -2 localhost
netch            p0       :ttyv7:S.0        9:35AM     - /usr/local/bin/mutt -y
netch            p1       localhost         9:36AM    48 -bash (bash)
netch            q0       :ttyv7:S.1        9:35AM     - w
netch            r0       :ttyv7:S.2        9:41AM    29 /usr/local/bin/mutt -y
netch            s0       :ttyv7:S.3        9:55AM    15 lynx http://www.inar.r
netch            P0       :ttyv7:S.4       10:08AM    11 lynx http://www.inar.r
netch            Q0       :ttyv7:S.5       10:08AM     - lynx http://www.inar.r
netch            R0       :ttyv7:S.6       10:09AM    15 lynx http://www.inar.r
netch            S0       :ttyv7:S.7       10:09AM    15 lynx http://www.inar.r

An attempt to create new terminal, either from the same metasession or
new one, fails with "No more PTYs." screen's error message.
Strange pty allocation pattern (shown in `w' output) points to its reason.

>How-To-Repeat:

Close all ptys, rebuild screen from ports and check PTYRANGE* in config.h.

>Fix:

Disable misworked configure detecting of ptys and hardcode FreeBSD variant.
This also fixes need to reinstall screen when new ptys are generated
in plain old /dev, with little overhead of testing all nonexistent
ones when ptys are really exhausted.

diff -rNu 0/Makefile 1/Makefile
--- 0/Makefile	Sat Mar 31 12:36:51 2001
+++ 1/Makefile	Sun Jun 24 11:30:58 2001
@@ -7,7 +7,7 @@
 
 PORTNAME=	screen
 PORTVERSION=	3.9.8
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	misc
 MASTER_SITES=	ftp://ftp.uni-erlangen.de/pub/utilities/screen/ \
 		${MASTER_SITE_GNU}
diff -rNu 0/files/patch-ah 1/files/patch-ah
--- 0/files/patch-ah	Thu Jan  1 03:00:00 1970
+++ 1/files/patch-ah	Sun Jun 24 11:23:56 2001
@@ -0,0 +1,80 @@
+--- configure.orig	Sun Jun 24 11:18:54 2001
++++ configure	Sun Jun 24 11:23:23 2001
+@@ -2183,76 +2183,10 @@
+ fi
+ rm -f conftest*
+ 
+-echo "checking for /dev/ptc" 1>&6
+-echo "configure:2213: checking for /dev/ptc" >&5
+-if test -r /dev/ptc; then
+-cat >> confdefs.h <<\EOF
+-#define HAVE_DEV_PTC 1
+-EOF
+-
+-fi
+-
+-echo "checking for SVR4 ptys" 1>&6
+-echo "configure:2222: checking for SVR4 ptys" >&5
+-if test -c /dev/ptmx ; then
+-cat > conftest.$ac_ext <<EOF
+-#line 2225 "configure"
+-#include "confdefs.h"
+-
+-int main() {
+-ptsname(0);grantpt(0);unlockpt(0);
+-; return 0; }
+-EOF
+-if { (eval echo configure:2232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+-  rm -rf conftest*
+-  cat >> confdefs.h <<\EOF
+-#define HAVE_SVR4_PTYS 1
+-EOF
+-
+-else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-fi
+-rm -f conftest*
+-fi
+-
+-echo "checking for ptyranges" 1>&6
+-echo "configure:2246: checking for ptyranges" >&5
+-if test -d /dev/ptym ; then
+-pdir='/dev/ptym'
+-else
+-pdir='/dev'
+-fi
+-cat > conftest.$ac_ext <<EOF
+-#line 2253 "configure"
+-#include "confdefs.h"
+-#ifdef M_UNIX
+-   yes;
+-#endif
+-
+-EOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+-  egrep "yes" >/dev/null 2>&1; then
+-  rm -rf conftest*
+-  ptys=`echo /dev/ptyp??`
+-else
+-  rm -rf conftest*
+-  ptys=`echo $pdir/pty??`
+-fi
+-rm -f conftest*
+-
+-if test "$ptys" != "$pdir/pty??" ; then
+-p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
+-p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g'  | sort -u | tr -d '\012'`
+ cat >> confdefs.h <<EOF
+ #define PTYRANGE0 "pqrsPQRS"
++#define PTYRANGE1 "0123456789abcdefghijklmnopqrstuv"
+ EOF
+-
+-cat >> confdefs.h <<EOF
+-#define PTYRANGE1 "$p1"
+-EOF
+-
+-fi
+ 
+ echo "checking default tty permissions/group" 1>&6
+ echo "configure:2284: checking default tty permissions/group" >&5


/netch
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106240832.f5O8W9w08459>