Re: the GPG_TTY line in bashrc produces error message in chroot environment

"Xi Ruoyao" ([email protected] via blfs-dev Mailing List) <[email protected]> Mon, 20 Oct 2025 13:47:16 +0800
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <[email protected]>
On Sun, 2025-10-19 at 23:24 -0300, Jamenson Espindula wrote:
> Em sáb., 18 de out. de 2025 às 01:17, Zhang Wen
> <[email protected]> escreveu:
> > 
> > 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 did reproduce that.
> 
> I add that the GPG_TTY exported variable was set with 'not a tty' (see
> output of printenv | grep 'GPG_TTY').
> 
> A question arises in my mind: inside the chroot environment, if it is
> 'not a tty', then what is it?

It is a tty but the device node assigned for the tty is does not exist
in the chroot environment.  Thus we can consider it an unnamed tty, so
IMO the return status 4 ("the terminal's name cannot be determined") is
correct.

And now it looks to me that the doc of the tty command is just unclear:


     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

So in our case the standard input is a terminal but its name cannot be
determined, then should we get 0 or 4?

-- 
Xi Ruoyao <[email protected]>

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-dev
Unsubscribe: See the above information page