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

Bug#256468: xterm: utmp handling is broken for high pts



Package: xterm
Version: 4.3.0.dfsg.1-5
Severity: normal

Later Linux 2.6 kernels do not recycle pseudo TTYs, so ptys like 
/dev/pts/1234 are not uncommon.

xterm does not seem to handle this well at all.  In particular, it
relies on the 4-digit ut_id field in utmp, which would look like
"p123" in the above example.  If I open up three xterms on ptys which
all have a ut_id of "p123", they overwrite each other in utmp,
so that only one shows up.  

In wtmp, they all show as opening, but on close, they all act as if
they closed the last record, not their own.

I would assume this is due to code like this (in Exit() in main.c):

            utmp.ut_type = DEAD_PROCESS;

            /* position to entry in utmp file */
            /* Test return value: beware of entries left behind: PSz 9 Mar 00 */
            if (!(utret = getutid(&utmp))) {
                (void) setutent();
                utmp.ut_type = USER_PROCESS;
                if (!(utret = getutid(&utmp))) {
                    (void) setutent();
                }
            }

... which uses getutid() to find the proper entry in utmp, without
matching the full and proper ut_line to make sure that it was the
correct entry.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.6
Locale: LANG=C, LC_CTYPE=en_US.UTF-8

Versions of packages xterm depends on:
ii  libc6                     2.3.2.ds1-12   GNU C Library: Shared libraries an
ii  libexpat1                 1.95.6-8       XML parsing C library - runtime li
ii  libfontconfig1            2.2.2-2        generic font configuration library
ii  libfreetype6              2.1.7-2        FreeType 2 font engine, shared lib
ii  libice6                   4.3.0.dfsg.1-1 Inter-Client Exchange library
ii  libncurses5               5.4-3          Shared libraries for terminal hand
ii  libsm6                    4.3.0.dfsg.1-1 X Window System Session Management
ii  libxaw7                   4.3.0.dfsg.1-1 X Athena widget set library
ii  libxext6                  4.3.0.dfsg.1-1 X Window System miscellaneous exte
ii  libxft2                   2.1.2-6        FreeType-based font drawing librar
ii  libxmu6                   4.3.0.dfsg.1-1 X Window System miscellaneous util
ii  libxpm4                   4.3.0.dfsg.1-1 X pixmap library
ii  libxrender1               0.8.3-7        X Rendering Extension client libra
ii  libxt6                    4.3.0.dfsg.1-1 X Toolkit Intrinsics
ii  xlibs                     4.3.0.dfsg.1-1 X Window System client libraries m
ii  xlibs-data                4.3.0.dfsg.1-1 X Window System client data

-- no debconf information



Reply to: