emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#26371: closed ([PATCH 0/1] tty: do not provide con


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#26371: closed ([PATCH 0/1] tty: do not provide conflicting information)
Date: Wed, 05 Apr 2017 18:41:01 +0000

Your message dated Wed, 5 Apr 2017 11:40:15 -0700
with message-id <address@hidden>
and subject line Re: bug#26371: [PATCH 0/1] tty: do not provide conflicting 
information
has caused the debbugs.gnu.org bug report #26371,
regarding [PATCH 0/1] tty: do not provide conflicting information
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
26371: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26371
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- 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




--- End Message ---
--- Begin Message --- Subject: Re: bug#26371: [PATCH 0/1] tty: do not provide conflicting information Date: Wed, 5 Apr 2017 11:40:15 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 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.

Attachment: 0001-tty-handle-misconfigured-namespaces.patch
Description: Source code patch


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]