bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dialog --pause not timing out on serial console (dialog 1.2)


From: Stefan Puiu
Subject: Re: dialog --pause not timing out on serial console (dialog 1.2)
Date: Fri, 23 Jul 2021 18:56:17 +0300

Hi Rich,

On Fri, Jul 23, 2021 at 4:45 PM Rich Coe <richcoe2@gmail.com> wrote:
>
> You can attempt to set CLOCAL on the port.  But it's going to be a race
> between whatever application/kernel writes output on the console and your
> workaround to set CLOCAL.
>
> I'm guessing you will find that you won't be able to find a place in the
> boot sequence to set CLOCAL before something writes to the console.  YMMV.

What's strange is that clocal seems to be set (if I'm reading the
flags right), and dialog/ncurses is trying to clear the flag. I've
debugged a bit in cbreak() when the console is hung:

(gdb) frame 2
#2  0x0000003b98e10d8c in cbreak () at ../../ncurses/tinfo/lib_raw.c:155
155             result = NCURSES_SP_NAME(_nc_set_tty_mode)
(NCURSES_SP_ARGx &buf);
(gdb) p/x termp->Nttyb
$1 = {c_iflag = 0x5400, c_oflag = 0x5, c_cflag = 0x1cb2, c_lflag =
0x83b, c_line = 0x0, c_cc = {0x3, 0x1c, 0x7f, 0x15,
    0x4, 0x0, 0x1, 0x0, 0x11, 0x13, 0x1a, 0x0, 0x12, 0xf, 0x17, 0x16,
0x0 <repeats 16 times>}, c_ispeed = 0x1002,
  c_ospeed = 0x1002}
(gdb) p/x buf
$2 = {c_iflag = 0x5400, c_oflag = 0x5, c_cflag = 0x1cb2, c_lflag =
0x839, c_line = 0x0, c_cc = {0x3, 0x1c, 0x7f, 0x15,
    0x4, 0x0, 0x1, 0x0, 0x11, 0x13, 0x1a, 0x0, 0x12, 0xf, 0x17, 0x16,
0x0 <repeats 16 times>}, c_ispeed = 0x1002,
  c_ospeed = 0x1002}

And the only difference between the 2 sets of settings is c_lflag:
0x83b is the current setting, 0x839 is the intended value. As far as I
can tell from headers
(/usr/src/debug/glibc-2.18/sysdeps/unix/sysv/linux/bits/termios.h on
this Fedora), bit 2 in c_lflag is ICANON, so it's set in termp->Nttyb,
and ncurses is trying to clear it in buf.

The code also looks like it's clearing ICANON
(https://github.com/tebriel/ncurses-5.9/blob/master/ncurses/tinfo/lib_raw.c#L134
- I have ncurses-5.9).

I agree that whatever possible setting I'd try, it's probably going to
be racy. It would probably be safer to not use dialog/ncurses in this
context, I guess.

Thanks,
Stefan.

>
> Rich
> --



reply via email to

[Prev in Thread] Current Thread [Next in Thread]