mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Gil Pedersen <kanongil@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] bug: isatty() can return wrong value
Date: Tue, 20 Aug 2024 11:50:02 +0200	[thread overview]
Message-ID: <A914634C-F598-4187-A85A-03BBA280A884@gmail.com> (raw)

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

Hi,

I found a musl related issue in systemd, where it relies on glibc specific behaviour for isatty(), which happens to work out. When using musl, it will fail in another way, causing some essential retry logic to not run.

The error occurs when the isatty() implementation calls an ioctl() that sets the EIO error. glibc will directly forward any errors, while musl remaps it to an ENOTTY error.

Neither behaviour are POSIX compliant. glibc sets an undocumented errno, while musl sets ENOTTY for something that is definitely a TTY.

It seems that the correct fix is to remap the EIO to a success (1).

See https://github.com/systemd/systemd/pull/34039 and https://sourceware.org/bugzilla/show_bug.cgi?id=32103.

I'm not on the mailing list, so please CC any replies.

Regards,
Gil

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

             reply	other threads:[~2024-08-20 10:16 UTC|newest]

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

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=A914634C-F598-4187-A85A-03BBA280A884@gmail.com \
    --to=kanongil@gmail.com \
    --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).