mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Gil Pedersen <kanongil@gmail.com>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] bug: isatty() can return wrong value
Date: Tue, 26 Nov 2024 11:03:36 +0100	[thread overview]
Message-ID: <4D107104-6B65-4A82-9662-A8392B56B744@gmail.com> (raw)
In-Reply-To: <20240820111100.GX10433@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]

> On 20 Aug 2024, at 13.11, Rich Felker <dalias@libc.org> wrote:
> 
> What guarantee do we have that nothing other than a tty in this state
> will return EIO for the ioctl? The implementation on the kernel side
> suggests that, if they tried to put any other device in such a state
> by replacing its ioctl function the same way, it would also give EIO
> for these ioctls.

Yeah, EIO is unconditionally signalled for any (expect TIOCSPGRP) ioctl call when a tty is hung.
While a TIOCGWINSZ ioctl call that returns EIO will very likely be a tty, there is indeed no such guarantee.

> I'm hopeful there's some good fix here where we don't have to have
> either of these bad behaviors, but returning true for isatty() of a
> device that is absolutely not a tty is a much worse behavior than
> returning false for a device that is/was a tty when it was opened but
> that's been replaced by the kernel with a defunct device.

I have proposed a change to the ioctl handling in the kernel:

https://lore.kernel.org/linux-serial/20241121111506.4717-1-gpdev@gpost.dk/

If merged, the issue should be fixed going forward.

/Gil

[-- Attachment #2: Type: text/html, Size: 8562 bytes --]

  parent reply	other threads:[~2024-11-26 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  9:50 Gil Pedersen
2024-08-20 11:11 ` Rich Felker
2024-08-20 15:18   ` Thorsten Glaser
2024-11-26 10:03   ` Gil Pedersen [this message]
2024-11-29  6:08     ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D107104-6B65-4A82-9662-A8392B56B744@gmail.com \
    --to=kanongil@gmail.com \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).