GNU bug report logs - #26371
[PATCH 0/1] tty: do not provide conflicting information

Previous Next

Package: coreutils;

Reported by: Christian Brauner <christian.brauner <at> ubuntu.com>

Date: Wed, 5 Apr 2017 15:27:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Christian Brauner <christian.brauner <at> ubuntu.com>
Subject: bug#26371: closed (Re: bug#26371: [PATCH 0/1] tty: do not provide
 conflicting information)
Date: Wed, 05 Apr 2017 18:41:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#26371: [PATCH 0/1] tty: do not provide conflicting information

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 26371 <at> debbugs.gnu.org.

-- 
26371: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26371
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Christian Brauner <christian.brauner <at> ubuntu.com>, coreutils <at> gnu.org,
 26371-done <at> debbugs.gnu.org, stgraber <at> ubuntu.com, serge <at> hallyn.com
Subject: Re: bug#26371: [PATCH 0/1] tty: do not provide conflicting information
Date: Wed, 5 Apr 2017 11:40:15 -0700
[Message part 3 (text/plain, inline)]
Thanks for the bug report. The situation you describe seems to be a 
platform that does not conform to POSIX, since POSIX doesn't allow for 
isatty to succeed but ttyname to fail. So I expect you'll run into 
problems other than with the tty program, as other software will make 
the same assumptions that tty is making.

That being said, tty could do a better job about the situation. I 
installed the attached somewhat-more-ambitious patch, so that tty will 
do more-extensive checking of the results of isatty and/or ttyname (and 
so that it never needs to call both functions and worry about whether 
their results are consistent :-). Please give it a try on your platform.
[0001-tty-handle-misconfigured-namespaces.patch (application/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Christian Brauner <christian.brauner <at> ubuntu.com>
To: coreutils <at> gnu.org, bug-coreutils <at> gnu.org, stgraber <at> ubuntu.com,
 serge <at> hallyn.com
Cc: Christian Brauner <christian.brauner <at> ubuntu.com>
Subject: [PATCH 0/1] tty: do not provide conflicting information
Date: Wed,  5 Apr 2017 16:44:40 +0200
Hi guys,

In case the current file descriptor is a tty but ttyname{_r}() fails to retrieve
the device path tty would falsely report "not a tty" but return EXIT_SUCCESS.
This is confusing. Instead, let's first check whether the fd refers to a tty and
if not report "not a tty" and exit with error. In all other cases, we should
report "is a tty but failed to determine the device path" and exit with success.
This is much clearer. Depending on the platform the user can then decide how to
proceed, e.g. by looking at /proc/self/fd/0 for Linux or somewhere else on other
platforms.

This becomes especially important when we deal with Linux namespaces where this
case can regularly happen should a new devpts instance be mounted in the
namespace but the fd still refers to a pts device from another devpts instance
in another mount namespace.

I added Signed-off-by line but I'm not completely sure if this is used in
cureutils. If not, just drop it. :)

Christian

Christian Brauner (1):
  tty: do not provide conflicting information

 src/tty.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

-- 
2.11.0




This bug report was last modified 48 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.