Bug#1054022: libncursesw6: broken in GNU Screen

2023-10-16 Thread Thomas Dickey
On Mon, Oct 16, 2023 at 06:36:40PM +0200, Sven Joachim wrote:
> On 2023-10-16 04:36 +0200, Vincent Lefevre wrote:
> 
> > Package: libncursesw6
> > Version: 6.4+20231007-1
> > Severity: grave
> > Justification: renders package unusable
> >
> > With libncursesw6 6.4+20231007-1, I get the following issue:
> >
> > $ screen -dRR mutt /usr/bin/mutt
> > [screen is terminating]
> >
> > after a few seconds (or immediately "[screen is terminating]" when
> > I hit a key). When rebuilding Mutt with debug support, this shows
> > that Mutt is actually running, but with no output, and I don't know
> > why it terminates.
> 
> The strace output you sent gives a hint.
> 
> > 659013 write(2, "Error opening terminal: screen.xterm-256color.\n", 47) = 47
> 
> This message is coming from ncurses' initscr() function, which
> terminates the program if it cannot setup the terminal.
> 
> > Downgrading the ncurses packages to 6.4+20230625-2 makes this problem
> > disappear.
> 
> Since I was able to reproduce the problem, I bisected it and found the
> following change as the culprit:
> 
> ,
> | 20231001
> | + modify setupterm to provide for using ANSI cursor-position report (in
> |   user6/user7 terminfo capabilities) to obtain screensize if neither
> |   environment variables or ioctl is used.  The ncurses test-program
> |   with options "-E -T" demonstrates this feature.
> `
> 
> Reverting ncurses/tinfo/lib_setup.c to the 20230923 patchlevel made the
> problem disappear.  I'll leave it to Thomas to work out the details.

I suppose it's timing.

I was unable to reproduce it if any tracing (ncurses or strace) was active.
Without that - once or twice out of a few dozen tries, screen exited without
any message.

I'm making the feature optional for now.

-- 
Thomas E. Dickey 
https://invisible-island.net


signature.asc
Description: PGP signature


Bug#1054022: libncursesw6: broken in GNU Screen

2023-10-16 Thread Sven Joachim
On 2023-10-16 04:36 +0200, Vincent Lefevre wrote:

> Package: libncursesw6
> Version: 6.4+20231007-1
> Severity: grave
> Justification: renders package unusable
>
> With libncursesw6 6.4+20231007-1, I get the following issue:
>
> $ screen -dRR mutt /usr/bin/mutt
> [screen is terminating]
>
> after a few seconds (or immediately "[screen is terminating]" when
> I hit a key). When rebuilding Mutt with debug support, this shows
> that Mutt is actually running, but with no output, and I don't know
> why it terminates.

The strace output you sent gives a hint.

> 659013 write(2, "Error opening terminal: screen.xterm-256color.\n", 47) = 47

This message is coming from ncurses' initscr() function, which
terminates the program if it cannot setup the terminal.

> Downgrading the ncurses packages to 6.4+20230625-2 makes this problem
> disappear.

Since I was able to reproduce the problem, I bisected it and found the
following change as the culprit:

,
| 20231001
|   + modify setupterm to provide for using ANSI cursor-position report (in
| user6/user7 terminfo capabilities) to obtain screensize if neither
| environment variables or ioctl is used.  The ncurses test-program
| with options "-E -T" demonstrates this feature.
`

Reverting ncurses/tinfo/lib_setup.c to the 20230923 patchlevel made the
problem disappear.  I'll leave it to Thomas to work out the details.

Cheers,
   Sven



Bug#1054022: libncursesw6: broken in GNU Screen

2023-10-16 Thread Vincent Lefevre
Via JuiceSSH+mosh under Android, if I hit a key, I can see spurious
escape sequences in the output after the error message:

^[[1;1R^[[49;80R^[[49;80R^[[49;80R

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Bug#1054022: libncursesw6: broken in GNU Screen

2023-10-16 Thread Vincent Lefevre
On 2023-10-16 04:10:36 -0400, Thomas Dickey wrote:
> But in a quick check to "upgrade", my sources.list to investigate this,
> I get stopped by the "improvements".  It might help if you posted the
> corresponding sources.list (or are you using the separate gpg stuff?).

I'm wondering why this matters as this basically corresponds
to unstable.

deb https://ftp.debian.org/debian/ stable main contrib non-free
deb-src https://ftp.debian.org/debian/ stable main contrib non-free

# Security updates (previously "stable/updates")
deb https://security.debian.org/debian-security stable-security main contrib 
non-free
deb-src https://security.debian.org/debian-security stable-security main 
contrib non-free

# stable-updates, previously known as 'volatile'
deb https://ftp.debian.org/debian/ stable-updates main contrib
deb-src https://ftp.debian.org/debian/ stable-updates main contrib

deb https://ftp.debian.org/debian/ testing main contrib non-free 
non-free-firmware
deb-src https://ftp.debian.org/debian/ testing main contrib non-free

deb https://security.debian.org/ testing-security main contrib non-free 
non-free-firmware
deb-src https://security.debian.org/ testing-security main contrib non-free

deb https://ftp.debian.org/debian/ unstable main contrib non-free 
non-free-firmware
deb-src https://ftp.debian.org/debian/ unstable main contrib non-free

deb https://ftp.debian.org/debian/ experimental main
deb-src https://ftp.debian.org/debian/ experimental main

# -dbgsym packages; see
#   https://lists.debian.org/debian-devel/2015/12/msg00262.html
deb http://debug.mirrors.debian.org/debian-debug/ unstable-debug main

# Debian Mozilla team - https://mozilla.debian.net/
#deb http://http.debian.net/debian experimental main

# Local repository for the default architecture.
# Update with "dpkg-scanpackages . > Packages" from it.
deb [trusted=yes] file:///var/local/apt ./

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Bug#1054022: libncursesw6: broken in GNU Screen

2023-10-16 Thread Thomas Dickey
On Mon, Oct 16, 2023 at 04:36:07AM +0200, Vincent Lefevre wrote:
> Package: libncursesw6
> Version: 6.4+20231007-1
> Severity: grave
> Justification: renders package unusable
> 
> With libncursesw6 6.4+20231007-1, I get the following issue:
> 
> $ screen -dRR mutt /usr/bin/mutt
> [screen is terminating]
> 
> after a few seconds (or immediately "[screen is terminating]" when
> I hit a key). When rebuilding Mutt with debug support, this shows
> that Mutt is actually running, but with no output, and I don't know
> why it terminates.
> 
> Same issue with
> 
>   screen -dRR mutt sh -c "true; /usr/bin/mutt"
> 
> but
> 
>   screen -dRR mutt sh -c "sleep 1; /usr/bin/mutt"
> 
> appears to work. Some kind of race condition?
> 
> With
> 
>   /usr/bin/screen -dRR mutt strace -f -o str.out -s 256 /usr/bin/mutt
...
> Downgrading the ncurses packages to 6.4+20230625-2 makes this problem
> disappear.

hmm - at least it's not likely the tiparm fixes from April.

But in a quick check to "upgrade", my sources.list to investigate this,
I get stopped by the "improvements".  It might help if you posted the
corresponding sources.list (or are you using the separate gpg stuff?).
 
> -- System Information:
> Debian Release: trixie/sid
>   APT prefers unstable-debug
>   APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
> 'stable-security'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
> 'experimental')
> merged-usr: no
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386
> 
> Kernel: Linux 6.5.0-2-amd64 (SMP w/12 CPU threads; PREEMPT)
> Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
> TAINT_UNSIGNED_MODULE
> Locale: LANG=POSIX, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> LSM: AppArmor: enabled
> 
> Versions of packages libncursesw6 depends on:
> ii  libc6  2.37-12
> ii  libtinfo6  6.4+20231007-1
> 
> Versions of packages libncursesw6 recommends:
> ii  libgpm2  1.20.7-10+b1
> 
> libncursesw6 suggests no packages.
> 
> -- no debconf information
> 
> -- 
> Vincent Lefèvre  - Web: 
> 100% accessible validated (X)HTML - Blog: 
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
> 

-- 
Thomas E. Dickey 
https://invisible-island.net


signature.asc
Description: PGP signature


Bug#1054022: libncursesw6: broken in GNU Screen

2023-10-15 Thread Vincent Lefevre
Package: libncursesw6
Version: 6.4+20231007-1
Severity: grave
Justification: renders package unusable

With libncursesw6 6.4+20231007-1, I get the following issue:

$ screen -dRR mutt /usr/bin/mutt
[screen is terminating]

after a few seconds (or immediately "[screen is terminating]" when
I hit a key). When rebuilding Mutt with debug support, this shows
that Mutt is actually running, but with no output, and I don't know
why it terminates.

Same issue with

  screen -dRR mutt sh -c "true; /usr/bin/mutt"

but

  screen -dRR mutt sh -c "sleep 1; /usr/bin/mutt"

appears to work. Some kind of race condition?

With

  /usr/bin/screen -dRR mutt strace -f -o str.out -s 256 /usr/bin/mutt

the strace output ends with

659013 openat(AT_FDCWD, "/usr/share/terminfo/s/screen.xterm-256color", 
O_RDONLY) = 3
659013 geteuid()= 1000
659013 setfsuid(1000)   = 1000
659013 getegid()= 1000
659013 setfsgid(1000)   = 1000
659013 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=3615, ...}, 
AT_EMPTY_PATH) = 0
659013 read(3, "\36\2=\0&\0\17\0q\1\247\5screen.xterm-256color|GNU Screen with 
xterm using 256 
colors\0\1\1\0\0\1\0\0\0\1\0\0\0\0\1\1\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\0\0\0\1\0P\0\0\0\10\0\0\0\30\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\1\0\0\0\0\1\0\0\0\4\0\6\0\10\0\31\0\36\0&\0*\0.\0\377\3779\0J\0L\0P\0W\0\377\377Y\0f\0\377\377j\0n\0x\0|\0\377\377\377\377\200\0\204\0\211\0\216\0\377\377\240\0\245\0\377\377\377\377\252\0\257\0\264\0\271\0\302\0\306\0\315\0\377\377"...,
 32768) = 3615
659013 read(3, "", 28672)   = 0
659013 close(3) = 0
659013 ioctl(1, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(1, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(1, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(1, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(1, TIOCGWINSZ, {ws_row=105, ws_col=333, ws_xpixel=3676, 
ws_ypixel=2124}) = 0
659013 ioctl(2, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCSETSW, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ECHOE|ECHOK|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ECHOE|ECHOK|ECHOCTL|ECHOKE, ...}) = 0
659013 write(2, "\33[6n", 4)= 4
659013 read(2, "", 19)  = 0
659013 write(2, "\33[1;1H", 14) = 14
659013 write(2, "\33[6n", 4)= 4
659013 read(2, "", 19)  = 0
659013 write(2, "\33[437457153;385880577H", 22) = 22
659013 ioctl(2, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ECHOE|ECHOK|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCSETSW, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCGETS, {c_iflag=ICRNL|IUTF8, 
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, 
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
659013 ioctl(2, TCSETSW, {c_iflag=ICRNL|IUTF8,