|
Bugzilla – Full Text Bug Listing |
| Summary: | check_ttyname: FAIL /dev/pts/0 (sudo) vs. /dev/pts/18 (libc) | ||
|---|---|---|---|
| Product: | Sudo | Reporter: | Lars Wendler <polynomial-c> |
| Component: | Sudo | Assignee: | Todd C. Miller <Todd.Miller> |
| Status: | RESOLVED FIXED | ||
| Severity: | low | CC: | flameeyes |
| Priority: | low | ||
| Version: | 1.8.10 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| URL: | https://bugs.gentoo.org/487618 | ||
| Attachments: | build.log | ||
|
Description
Lars Wendler
2014-04-19 06:11:56 MDT
Created attachment 404 [details]
build.log
I don't see that failure on other Linux systems so it's possible that this is an artifact of the build environment. I'd still like to understand what is happening so I'll leave this bug open until I've figured that out. Good news, I ended up reproducing this and looking into it.
What happens is that stdin is closed, and you're using redirects for output (like Portage does), then your TTYs don't match. Sudo (correctly) gets tty0 for me, but then it can't find STDIN and the STDOUT/ERR are on a different tty.
One more problem:
printf("%s: FAIL %s (sudo) vs. %s (libc)\n", getprogname(),
tty_sudo ? tty_sudo : "none", tty_libc ? tty_sudo : "none");
It should be
printf("%s: FAIL %s (sudo) vs. %s (libc)\n", getprogname(),
tty_sudo ? tty_sudo : "none", tty_libc ? tty_libc : "none");
(see the difference in the second to latter token.)
HTH!
Closing since this is not a bug in the test. I've fixed the error message as suggested, thanks! Well, it kinda is a problem with the test: it should not cause the whole tests to fail because it can't find STDIN. Maybe SKIP? The problem is not that stdin is closed but that stdout/stderr point to a different tty. Just skipping the test when stdin is closed would prevent the test from working in my own build scripts. It turns out my own build system no longer redirects stdin so I can get away with only checking ttyname(0) and skipping the test if that is not available. |