Simon McVittie dixit:

>On Mon, 19 Aug 2024 at 16:27:24 +0000, Thorsten Glaser wrote:
>> mksh actually does things inside script(1) that use the tty
>
>For the purposes of having a test-case for schroot that doesn't require
>mksh, perhaps a good approximation to this would be asserting that
>tty(1) from coreutils exits successfully and prints the path to a char
>device that exists and is rw?

Unsure. It also requires and accesses /dev/tty, it doesn’t just
do isatty on stdio.

>For a manual smoke-test for this change, having a known-good version
>of mksh build and pass its test suite seems like a better indicator
>that the terminal is indeed working, but I think that's too large and
>involved to make a reasonable autopkgtest for schroot to guard against
>this maybe regressing.

Right.

Looking at the code, it seems we need isatty(0) && isatty(2)
to succeed as well as open("/dev/tty", O_RDWR, 0) to succeed
(and later F_DUPFD and F_SETFD, FD_CLOEXEC fcntl).

Perhaps isolating that as a small C or Perl program to use
for those tests?

>on a pty or tty, or produce some other output if not?

Produce some other output (error messages) if not.

$ echo true | sudo chroot /tmp/a /sh -i; echo
W: /sh: can't find controlling tty: Permission denied
W: /sh: won't have full job control
# #

The two warning lines are absent if the tty is present.
They look different in older versions, though.

bye,
//mirabilos
-- 
> Hi, does anyone sell openbsd stickers by themselves and not packaged
> with other products?
No, the only way I've seen them sold is for $40 with a free OpenBSD CD.
        -- Haroon Khalid and Steve Shockley in gmane.os.openbsd.misc

Reply via email to