Package: joe
Version: 4.6-1+b1
Severity: important

Hi,

as of recently, if I start screen (or tmux, doesn't seem to matter) on a Linux 
host, then use lxc-attach to enter a running LXC container, and start joe 
inside that container, the terminal behaves in a hard to describe, but 
completely broken way, making the editor essentially unusable.

Some examples:

1. Subsequent lines appear concatenated and then broken at an off-by-one 
location. A file that contains

<<<
#
# foo
>>>

would be rendered as

<<<
# [... spaces up to the end of the terminal line ... ] #
foo
>>>

CTRL-R has no apparent effect. Enabling syntax highlighting seems to make it 
worse (mangling more lines), but not always.

2. When typing, the cursor keeps jumping back to column 2 or 3, and the typed 
characters are hidden, as if they were off-screen to the left. Pressing CTRL-R 
fixes this problem temporarily. After pressing CTRL-R, pressing END (but not 
^E) repeatedly moves the cursor to somewhere around colum 40, but the column 
display in the upper right corner displays the correct position even after the 
first END press (or ^E press).

3. Similar to #2, but happens especially when editing a new file, or an empty 
line: instead of echoing the typed characters, either spaces echo, or the 
cursor stays at the leftmost position.

If you can suggest a way for me to record what I see on the screen and the keys 
I press concurrently, I suppose I can produce a "movie" of the breakage.

Other editors are unaffected (I tried vim, mcedit and nano).

I can't reproduce the problem without screen or tmux (ssh host, lxc-attach 
container, joe works).

I can't reproduce the problem if I start the container's joe binary by 
chrooting into the container's filesystem from the host.

I can't reproduce the problem if I ssh into the container instead of entering 
it via lxc-attach, not even if I subsequently start screen inside the container 
and joe inside screen.

I experimented with downgrading screen, ncurses, and joe itself, but either I 
wasn't systematic enough or it really didn't help.

I experimented with using different terminal applications to ssh into the LXC 
host (xterm, konsole), and it seemed to make no difference.

I *can* reproduce the problem by starting screen(1) locally, then ssh'ing into 
the LXC host, using lxc-attach, then starting joe inside the container.

screen(1) sets my TERM to screen.xterm-256color. Setting TERM to just "screen" 
apparently fixes problem #1 but not the others.

In tmux (whether started locally or on the LXC host doesn't matter), which sets 
TERM to "screen-256color", breakage #1 is less pronounced and slightly 
different: some lines are just visually missing their first character, but it's 
not rendered at the end of the previous line. The other two problems are just 
as in screen(1).

If I start tmux locally, then ssh into the LXC host and start screen there, 
TERM is set to just "screen" but after lxc-attach, problem #1 is present again.

As a demonstration, I opened a 150x47 terminal, reproduced problem #1, and used 
the X clipboard to copy and paste the contents of the window (with 
/etc/login.defs opened in joe) into this message below, disabling automatic 
line breaks:

--- 8< ---
    IW   /etc/login.defs                                                        
                                                     Row 45   Col 1   
 Enable display of unknown usernames when login failures are recorded.
#                                                                               
                                                                     # WARNING: 
Unknown usernames may become world readable. 
# See #290803 and #298773 for details about how this could become a security
# concern
LOG_UNKFAIL_ENAB        no

#                                                                               
                                                                     # Enable 
logging of successful logins
#                                                                               
                                                                     
LOG_OK_LOGINS           no

#                                                                               
                                                                     # Enable 
"syslog" logging of su activity - in addition to sulog file logging.
# SYSLOG_SG_ENAB does the same for newgrp and sg.
#                                                                               
                                                                     
SYSLOG_SU_ENAB          yes
SYSLOG_SG_ENAB          yes

#                                                                               
                                                                     # If 
defined, all su activity is logged to this file.
#                                                                               
                                                                     
#SULOG_FILE     /var/log/sulog

#                                                                               
                                                                     # If 
defined, file which maps tty line to TERM environment parameter.
# Each line of the file is in a format something like "vt100  tty01".
#                                                                               
                                                                     
#TTYTYPE_FILE   /etc/ttytype

#                                                                               
                                                                     # If 
defined, login failures will be logged here in a utmp format
# last, when invoked as lastb, will read /var/log/btmp, so...
#                                                                               
                                                                     FTMP_FILE  
     /var/log/btmp

#                                                                               
                                                                     # If 
defined, the command name to display when running "su -".  For
# example, if this is defined as "su" then a "ps" will display the
# command is "-su".  If not defined, then "ps" would display the
# name of the shell actually being run, e.g. something like "-sh".
#                                                                               
                                                                     SU_NAME    
     su
--- >8 ---

I don't know how much this helps, but it's the best I could do. (I made no 
edits in login.defs, just scrolled around a bit.)

All experiments were carried out on reasonably recent sid boxes (a few weeks 
old at most, some up to date as of Sunday), hosts and containers alike.

I'm afraid I have no idea how to even begin troubleshooting this further.

AndrĂ¡s

-- System Information:
Debian Release: bookworm/sid
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Locale: LANG=en_US.UTF-8, LC_CTYPE=hu_HU.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8
Shell: /bin/sh linked to /bin/dash
Init: runit (via /run/runit.stopit)
LSM: AppArmor: enabled

Versions of packages joe depends on:
ii  libc6        2.33-7
ii  libncurses6  6.3+20220423-2
ii  libtinfo6    6.3+20220423-2

joe recommends no packages.

joe suggests no packages.

-- no debconf information

-- 
 Getting information from the Internet is like taking a drink from a hydrant.

Reply via email to