Actions
Bug #15294
closedSuccessful read/write calls should not set errno
Start date:
Due date:
% Done:
100%
Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:
Description
With the changes to isatty()
in #15220, a successful call to the printf(3C)
functions will now set errno to 25 (ENOTTY) if the output is not a terminal.
This is inconsistent with previous behaviour, and POSIX
#include <stdio.h>
#include <errno.h>
int
main(void)
{
errno = 123;
(void) printf("test\n");
printf("errno: %d\n", errno);
}
%~/isatty test errno: 123 % ~/isatty | cat test errno: 25
% dtrace -n 'pid$target::isatty:entry{ustack()}' -c ./isatty dtrace: description 'pid$target::isatty:entry' matched 1 probe test errno: 123 dtrace: pid 26325 has exited CPU ID FUNCTION:NAME 2 99403 isatty:entry libc.so.1`isatty libc.so.1`_findbuf+0x13f libc.so.1`_wrtchk+0x61 libc.so.1`puts+0x8c isatty`main+0x18 isatty`_start_crt+0x87 isatty`_start+0x18
Related issues
Updated by Andy Fiddaman 5 months ago
- Related to Bug #15220: isatty should return reasonable errnos added
Updated by Andy Fiddaman 5 months ago
Prior to this change, the newly introduced test fails:
bloody% ./printf-15294.32 test non-PTY errno value was 25, expected 0 bloody% ./printf-15294.64 test non-PTY errno value was 25, expected 0
and after, it is successful.
I also ran all of the OS and libc tests, which were successful.
Updated by Andy Fiddaman 5 months ago
- Has duplicate Support #15297: read does not reset errno anymore added
Updated by Andy Fiddaman 5 months ago
- Subject changed from Successful *printf() calls should not set errno to Successful read/write calls calls should not set errno
Updated by Andy Fiddaman 5 months ago
- Subject changed from Successful read/write calls calls should not set errno to Successful read/write calls should not set errno
Updated by Dan McDonald 5 months ago
- Related to Bug #15291: zfs-tests errno flaws exposed by 15220 added
Updated by Electric Monk 5 months ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
git commit 06ca4e396ecc93ed45a333664a51558b7e84e8f5
commit 06ca4e396ecc93ed45a333664a51558b7e84e8f5 Author: Andy Fiddaman <illumos@fiddaman.net> Date: 2023-01-09T23:07:27.000Z 15294 Successful read/write calls should not set errno Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org> Reviewed by: Dan Cross <cross@oxidecomputer.com> Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Actions