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

Bug#35695: marked as done (libc6: ttyname() broken ?)



Your message dated Tue, 11 May 1999 01:05:22 -0700
with message-id <v04204e05b35d94ca397b@[206.163.71.146]>
and subject line Forgot to close these
has caused the attached bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I'm
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Ian Jackson
(administrator, Debian bugs database)

Received: (at submit) by bugs.debian.org; 7 Apr 1999 15:38:47 +0000
Received: (qmail 25528 invoked from network); 7 Apr 1999 15:38:46 -0000
Received: from thunderchild.aszi.sztaki.hu (mail@193.225.87.24)
  by master.debian.org with SMTP; 7 Apr 1999 15:38:46 -0000
Received: from gorgo by thunderchild.aszi.sztaki.hu with local (Exim 2.11 #1 (Debian))
	id 10UuPa-0000jc-00; Wed, 7 Apr 1999 17:38:42 +0200
From: Madarasz Gergely <gorgo@thunderchild.aszi.sztaki.hu>
Subject: libc6: ttyname() broken ?
To: submit@bugs.debian.org
X-Mailer: bug 3.1.7
Message-Id: <E10UuPa-0000jc-00@thunderchild.aszi.sztaki.hu>
Date: Wed, 7 Apr 1999 17:38:42 +0200

Package: libc6
Version: 2.1.1-0.1

After upgrading to kernel 2.2.5-ac4, screen does not work. It seems to be a
problem with glibc. Here are the facts:

# screen
Cannot access '/dev/ptsÿÿÿÿÿÿÿÿ': No such file or directory

ltracing it reveals the following:
ttyname(0)                                        = "/dev/pts/0\b\bEOFEOFEOFEOFEOFEOFEOFEOF"
__xstat(3, "/dev/pts/0\b\bEOFEOFEOFEOFEOFEOFEOFEOF", 0xbfffe930) = -1

If I strace it, it says the following:
readlink("/proc/self/fd/0", "/dev/pts/0", 4095) = 10
stat("/dev/pts/^H<FF><FF><FF><FF><FF><FF><FF><FF>", 0xbfffe7d0) = -1 ENOENT
(No such file or directory)

See the return value of readlink. On a non-ac kernel it returns 11,
terminating the string with a \0. Here is the relevant part of the patch of 
the ac kernel:

--- linux.vanilla/fs/proc/link.c        Sun Nov  8 15:06:32 1998
+++ linux.ac/fs/proc/link.c     Wed Mar 24 18:14:32 1999
@@ -158,7 +158,7 @@
                path = tmp;
        } else {
                path = d_path(dentry, tmp, PAGE_SIZE);
-               len = tmp + PAGE_SIZE - path;
+               len = tmp + PAGE_SIZE - 1 - path;
        }

        if (len < buflen)

Reading the manpage of readlink() it seems that this patch is correct, and
readlink should not terminate the string with a \0:

DESCRIPTION
       readlink  places the contents of the symbolic link path in
       the buffer buf, which has size bufsiz.  readlink does  not
       append  a NUL character to buf...

RETURN VALUES
       The  call  returns  the  count of characters placed in the
       buffer if it succeeds, or a -1 if an error occurs, placing
       the error code in errno.

In this case the ttyname() function of libc should take care of terminating
the string with \0 before returning it to the caller.

-- System Information
Debian Release: potato
Kernel Version: Linux thunderchild 2.2.5 #2 Fri Apr 2 15:44:43 CEST 1999 i586 unknown

Versions of the packages libc6 depends on:
ii  ldso            1.9.10-1.2     The Linux dynamic linker, library and utilit


Reply to: