Re: the GPG_TTY line in bashrc produces error message in chroot environment
"Xi Ruoyao" ([email protected] via blfs-dev Mailing List) <[email protected]> Sun, 19 Oct 2025 23:43:57 +0800
| Newsgroups | gmane.linux.lfs.beyond.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 2025-10-19 at 23:02 +0800, Xi Ruoyao wrote: > On Sun, 2025-10-19 at 16:39 +0800, Zhang Wen wrote: > > Xi Ruoyao <[email protected]> 于2025年10月18日周六 19:00写道: > > > > > > On Sat, 2025-10-18 at 12:17 +0800, Zhang Wen wrote: > > > > The root cause is while the tty command returns non-zero in the chroot > > > > environment, the 'tty -s' command returns a zero value. > > > > I changed 'tty -s' to 'tty > /dev/null 2>&1' and the error message > > > > disappeared, not sure if there's a better solution. > > > > > > I'd say it's a coreutils bug and it should be reported to the coreutils > > > developers. "tty -s" should have the same exit status as "tty". > > > > > > -- > > > Xi Ruoyao <[email protected]> > > > -- > > > http://lists.linuxfromscratch.org/sympa/info/blfs-dev > > > Unsubscribe: See the above information page > > > > It's not necessarily the truth, there's a code structure overview link > > below the the git line on https://www.gnu.org/software/coreutils: > > https://www.maizure.org/projects/decoded-gnu-coreutils/tty.html > > It says that the silent mode of tty only return result of the isatty > > function in the c library, while the normal mode return result of the > > ttyname one. > > It's not relevant. The info page says: > > ‘-s’ > ‘--silent’ > ‘--quiet’ > Print nothing; only return an exit status. > > Exit status: > > 0 if standard input is a terminal > 1 if standard input is a non-terminal file > 2 if given incorrect arguments > 3 if a write error occurs > 4 if the terminal's name cannot be determined > > It's not related to how the code is structured. It's simply the code > isn't doing what the document says. If this wasn't a bug, it would mean > "the terminal's name can be determined with -s, but it cannot without - > s." That would be just ridiculous. > > Either the code should be fixed to ensure the exit status consistent > with and without -s, or the documentation should be updated to document > the current behavior. In either case we've encountered a bug here. I've updated the book to use &>/dev/null instead of -s. But still I think coreutils should be fixed. -- Xi Ruoyao <[email protected]> -- http://lists.linuxfromscratch.org/sympa/info/blfs-dev Unsubscribe: See the above information page