[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#348457: open ttydev: No such device or address ; xterm should call TIOCSCTTY on GNU systems



Package: xterm
Version: 208-2
Severity: normal
Tags: patch

Hi,

When running xterm on GNU/Hurd systems, one gets
open ttydev: No such device or address

The problem is the way xterm sets the controlling terminal: main.c:3395:
   if ((ttyfd = open(ttydev, O_RDWR)) >= 0) {

And then xterm tries to open /dev/tty, and here it fails.

Indeed, POSIX says that
`If a session leader has no controlling terminal, and opens a terminal
device file that is not already associated with a session without using
O_NOCTTY option (see open()), it is implementation-defined whether the
terminal becomes the controlling terminal of the session leader.'

And indeed, on GNU systems, along definition of O_NOCTTY in fcntl.h one
can read ` `open' never assigns a controlling terminal in GNU. '.

So here is a proposed patch, please forward upstream.

Regards,
Samuel

--- main.c.orig	2006-01-17 04:24:50.000000000 +0100
+++ main.c	2006-01-17 04:25:08.000000000 +0100
@@ -3397,6 +3397,10 @@ spawn(void)
 			    /* make /dev/tty work */
 			    ioctl(ttyfd, TCSETCTTY, 0);
 #endif
+#if defined(__GNU__) && defined(TIOCSCTTY)
+			    /* make /dev/tty work */
+			    ioctl(ttyfd, TIOCSCTTY, 0);
+#endif
 #ifdef USE_SYSV_PGRP
 			    /* We need to make sure that we are actually
 			     * the process group leader for the pty.  If

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: hurd-i386 (i686-AT386)
Shell:  /bin/sh linked to /bin/bash
Kernel: GNU 0.3
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages xterm depends on:
ii  libc0.3                   2.3.5-7        GNU C Library: Shared libraries an
ii  libfontconfig1            2.3.2-1        generic font configuration library
ii  libfreetype6              2.1.10-1       FreeType 2 font engine, shared lib
ii  libice6                   6.9.0.dfsg.1-3 Inter-Client Exchange library
ii  libncurses5               5.5-1          Shared libraries for terminal hand
ii  libsm6                    6.9.0.dfsg.1-3 X Window System Session Management
ii  libx11-6                  6.9.0.dfsg.1-3 X Window System protocol client li
ii  libxaw8                   6.9.0.dfsg.1-3 X Athena widget set library
ii  libxext6                  6.9.0.dfsg.1-3 X Window System miscellaneous exte
ii  libxft2                   2.1.7-1        FreeType-based font drawing librar
ii  libxmu6                   6.9.0.dfsg.1-3 X Window System miscellaneous util
ii  libxpm4                   6.9.0.dfsg.1-3 X pixmap library
ii  libxrender1               1:0.9.0.2-1    X Rendering Extension client libra
ii  libxt6                    6.9.0.dfsg.1-3 X Toolkit Intrinsics
ii  xlibs-data                6.9.0.dfsg.1-3 X Window System client data
ii  zlib1g                    1:1.2.3-9      compression library - runtime

Versions of packages xterm recommends:
ii  xutils                    6.9.0.dfsg.1-3 X Window System utility programs

-- no debconf information



Reply to: