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

"Jamenson Espindula" ([email protected] via blfs-dev Mailing List) <[email protected]> Sun, 19 Oct 2025 23:36:29 -0300
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <CAOW_YOm8CbS3+nHTHk-CA9gLoiv0OPVG-RykdY6aRqE0WPE58Q@mail.gmail.com>
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 add that I thing it strange. I transcript partially the POSIX
specification (source:
<https://pubs.opengroup.org/onlinepubs/9799919799/functions/isatty.html>):

 = = = Transcription begins = = =

NAME

    isatty — test for a terminal device

SYNOPSIS

    #include <unistd.h>

    int isatty(int fildes);

DESCRIPTION

    The isatty() function shall test whether fildes, an open file
descriptor, is associated with a terminal device.

RETURN VALUE

    The isatty() function shall return 1 if fildes is associated with
a terminal; otherwise, it shall return 0 and may set errno to indicate
the error.

ERRORS

    The isatty() function may fail if:

    [EBADF]
        The fildes argument is not a valid open file descriptor.
    [ENOTTY]
        The file associated with the fildes argument is not a terminal.

 = = = Transcription ends = = =

My point is: if 'fildes' effectively is associated with a terminal,
then should not it return zero '0' indicating that effectively it is a
TTY?

Jamenson Ferreira Espindula de Almeida Melo
Jaboatão dos Guararapes, Pernambuco, Brazil
GNU/Linux user #166197; LFS ID 24492
Key fingerprint: 234D 1914 4224 7C53 BD13 6855 2AE0 25C0 08A8 6180

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