mobile-shell / mosh

Mobile Shell
https://mosh.org
GNU General Public License v3.0
12.63k stars 734 forks source link

ANSI escape sequences (tree) #1155

Open FingerCramp opened 3 years ago

FingerCramp commented 3 years ago

I understand mosh does something with respect to ANSI escape sequences, but I don't quite understand it. Using ssh, running the 'tree' command looks like this:

$ tree
.
├── [   0]  one
├── [   0]  three
└── [   0]  two

0 directories, 3 files

But, through mosh, it looks like this:

$ tree
.
tqq [   0]  one
tqq [   0]  three
mqq [   0]  two

0 directories, 3 files

Is there something I can do to make this display properly?

-Mike

eminence commented 2 years ago

Can you check to see if you have NCURSES_NO_UTF8_ACS=1 in your environment?

FingerCramp commented 2 years ago

I do not.

I have no NCURSES env vars set at all.

-Mike

On Fri, Dec 10, 2021 at 4:00 PM Andrew Chin @.***> wrote:

Can you check to see if you have NCURSES_NO_UTF8_ACS=1 in your environment?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mobile-shell/mosh/issues/1155#issuecomment-991289803, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADPYU7AZFREW73QJNWHAALDUQJS7RANCNFSM5FJ3YSVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

eminence commented 2 years ago

Can you try to set NCURSES_NO_UTF8_ACS=1? mosh-server sets this automatically, but sometimes it can be dropped (if you ssh into another system, or if you attach to a screen/tmux session that doesn't have it set)

FingerCramp commented 2 years ago

Unfortunately, it didn't help. :(

-Mike

On Fri, Dec 10, 2021 at 4:24 PM Andrew Chin @.***> wrote:

Can you try to set NCURSES_NO_UTF8_ACS=1? mosh-server sets this automatically, but sometimes it can be dropped (if you ssh into another system, or if you attach to a screen/tmux session that doesn't have it set)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mobile-shell/mosh/issues/1155#issuecomment-991303665, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADPYU7GE7RPOYECE63CA453UQJVWPANCNFSM5FJ3YSVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

achernya commented 1 year ago

I cannot reproduce this with a mosh-client 1.4.0 connected to a mosh-server 1.3.2 on Ubuntu 18.04.

This is what I see

$ env -u NCURSES_NO_UTF8_ACS tree                                                                                                                         
.
├── one
├── three
└── two

0 directories, 3 files
$ echo $TERM
xterm-256color

If you are still experiencing this issue, please include the value of $TERM and if possible the rest of your env output, as well as the output of lsb_release -a and reopen this issue.

FingerCramp commented 1 year ago

Here is my output:

Mike/fingercramp- tree . tqq one tqq three mqq two

0 directories, 3 files

Mike/fingercramp- echo $TERM xterm-256color

Mike/fingercramp- lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy

-Mike

On Sun, Jan 22, 2023 at 1:55 PM Alex Chernyakhovsky < @.***> wrote:

I cannot reproduce this with a mosh-client 1.4.0 connected to a mosh-server 1.3.2 on Ubuntu 18.04.

This is what I see

$ env -u NCURSES_NO_UTF8_ACS tree

.

├── one

├── three

└── two

0 directories, 3 files

$ echo $TERM

xterm-256color

If you are still experiencing this issue, please include the value of $TERM and if possible the rest of your env output, as well as the output of lsb_release -a and reopen this issue.

— Reply to this email directly, view it on GitHub https://github.com/mobile-shell/mosh/issues/1155#issuecomment-1399573556, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADPYU7GQFU6L5TSM3LDX6JLWTV7CXANCNFSM5FJ3YSVQ . You are receiving this because you authored the thread.Message ID: @.***>

achernya commented 1 year ago

What is $TERM outside of mosh? What terminal is being used? Can you post the rest of env and locale?

FingerCramp commented 1 year ago

Thank you for the reply.

Before moshing to the remote system, my $TERM is the same:

Mike/Macbook- echo $TERM xterm-256color

I'm using the iTerm2 terminal (Build 3.4.19). Before connecting to the remove host, my env and locale are:

Mike/Macbook- env MANPATH=/opt/homebrew/share/man: TERM_PROGRAM=iTerm.app TERM=xterm-256color SHELL=/bin/bash HOMEBREW_REPOSITORY=/opt/homebrew TMPDIR=/var/folders/vn/1_k3tjcj29110v1ndqnzpmg40000gn/T/ TERM_PROGRAM_VERSION=3.4.19 TERM_SESSION_ID=w0t6p0:5A21C26D-FFE1-4B66-B18E-2D875D0B8B4D USER=mike LD_LIBRARY_PATH=:/usr/local/lib COMMAND_MODE=unix2003 SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.86hJCBdAXy/Listeners __CF_USER_TEXT_ENCODING=0x0:0:0 PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/bin:/bin:/usr/local/bin:/usr/bin/X11:/usr/local/sbin:/usr/sbin:/sbin:/usr/games @.*** LaunchInstanceID=57E025C0-B98E-4F6D-8348-DC7848B351EE __CFBundleIdentifier=com.googlecode.iterm2 PWD=/Users/mike EDITOR=vim LANG=en_US.UTF-8 ITERM_PROFILE=localhost XPC_FLAGS=0x0 PS1=Mike/Macbook- HISTCONTROL=ignoredups PS2=> NCURSES_NO_UTF8_ACS=1 XPC_SERVICE_NAME=0 SHLVL=1 HOME=/Users/mike COLORFGBG=7;0 LC_TERMINAL_VERSION=3.4.19 HOMEBREW_PREFIX=/opt/homebrew ITERM_SESSION_ID=w0t6p0:5A21C26D-FFE1-4B66-B18E-2D875D0B8B4D LOGNAME=mike TFLIBDIR=/usr/share/games/tf INFOPATH=/opt/homebrew/share/info: HOMEBREW_CELLAR=/opt/homebrew/Cellar LCTERMINAL=iTerm2 SECURITYSESSIONID=186ad COLORTERM=truecolor =/usr/bin/env

Mike/Macbook- locale LANG="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL=

After connecting to remote host:

Mike/fingercramp- env SHELL=/bin/bash HISTCONTROL=ignoredups EDITOR=vim PWD=/home/mike LOGNAME=mike XDG_SESSION_TYPE=tty MOTD_SHOWN=pam HOME=/home/mike LANG=en_US.UTF-8 LC_TERMINAL=iTerm2 SSH_CONNECTION=192.168.1.172 59329 192.168.1.101 22 win7ult=win7ult_20191021 XDG_SESSION_CLASS=user TERM=xterm-256color USER=mike NCURSES_NO_UTF8_ACS=1 LC_TERMINAL_VERSION=3.4.19 SHLVL=1 XDG_SESSION_ID=263742 LD_LIBRARY_PATH=:/usr/local/lib:/usr/local/lib XDG_RUNTIME_DIR=/run/user/1000 PS2=> PS1=Mike/fingercramp- [\e]2;fingercramp\a] SSH_CLIENT=192.168.1.172 59329 22 XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop PATH=/main/bin:/main/ammoseek/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin/X11:/usr/local/sbin:/usr/sbin:/sbin:/usr/games:/usr/lib/go-1.10/bin: DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus SSHTTY=/dev/pts/17 GOPATH=/hugedrive/go =/usr/bin/env

Mike/fingercramp- locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=

HOWEVER, take note of this:

Mike/fingercramp- tree . tqq one tqq tewo mqq three

0 directories, 3 files

Mike/fingercramp- env -u NCURSES_NO_UTF8_ACS tree . ├── one ├── tewo └── three

0 directories, 3 files

What does this mean I need to do to fix this?

--Mike

On Sun, Jan 22, 2023 at 2:51 PM Alex Chernyakhovsky < @.***> wrote:

What is $TERM outside of mosh? What terminal is being used? Can you post the rest of env and locale?

— Reply to this email directly, view it on GitHub https://github.com/mobile-shell/mosh/issues/1155#issuecomment-1399590027, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADPYU7GNRL7DF3PBEZY7YU3WTWFUDANCNFSM5FJ3YSVQ . You are receiving this because you authored the thread.Message ID: @.***>

achernya commented 1 year ago

That's very weird. I still can't reproduce the behavior you're seeing, but I'm admittedly using Terminal.app, not iTerm2. Any chance you could post the output of infocmp to see what ncurses thinks is going on? Maybe there's some weird local override? Because it seems like, despite NCURSES_NO_UTF8_ACS=1 being set, tree is emitting the Line Graphics characters and not the UTF-8 alternatives.

For example, in Terminal.app directly

 $ tput smacs && echo tqq && tput rmacs
├──

but in mosh --local 127.0.0.1 inside Terminal.app

$ tput smacs && echo tqq && tput rmacs
tqq
FingerCramp commented 1 year ago

I'm not sure if you're looking for the infocmp output on local or remote host, so I'm providing both, below. Please let me know if I can provide anything else to assist here.

Mike/Macbook- infocmp

Reconstructed via infocmp from file: /usr/share/terminfo/78/xterm-256color

xterm-256color|xterm with 256 colors, am, bce, ccc, km, mc5i, mir, msgr, npc, xenl, colors#256, cols#80, it#8, lines#24, pairs#32767, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, initc=\E]4;%p1%d;rgb\:%p2%{255}%%{1000}%/%2.2X/%p3%{255}%%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\, invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^H, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S, kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~, kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El, memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h, smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,

Mike/fingercramp- infocmp

Reconstructed via infocmp from file: /lib/terminfo/x/xterm-256color

xterm-256color|xterm with 256 colors,

    am, bce, ccc, km, mc5i, mir, msgr, npc, xenl,
    colors#0x100, cols#80, it#8, lines#24, pairs#0x10000,
    acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
    bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
    clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=\r,
    csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
    cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C,
    cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
    cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m,
    dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K,
    el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, home=\E[H,
    hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@,
    il=\E[%p1%dL, il1=\E[L, ind=\n, indn=\E[%p1%dS,

initc=\E]4;%p1%d;rgb:%p2%{255}%%{1000}%/%2.2X/%p3%{255}%%{1000}%/%2.2X /%p4%{255}%*%{1000}%/%2.2X\E\, invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, ka1=\EOw, ka3=\EOy, kb2=\EOu, kbeg=\EOE, kbs=^?, kc1=\EOq, kc3=\EOs, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S, kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~, kind=\E[1;2B, kmous=\E[<, knp=\E[6~, kpp=\E[5~, kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El, memu=\Em, mgc=\E[?69l, nel=\EE, oc=\E]104\007, op=\E[39;49m, rc=\E8, rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, rin=\E[%p1%dT, ritm=\E[23m, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l\E[23;0;0t, rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]104\007, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,

setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,

setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,

sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t ;7%;%?%p4%t;5%;%?%p7%t;8%;m, sgr0=\E(B\E[m, sitm=\E[3m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h\E[22;0;0t, smglp=\E[?69h\E[%i%p1%ds, smglr=\E[?69h\E[%i%p1%d;%p2%ds, smgrp=\E[?69h\E[%i;%p1%ds, smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?%[;0123456789]c, u9=\E[c, vpa=\E[%i%p1%dd,

On Sun, Jan 22, 2023 at 3:38 PM Alex Chernyakhovsky < @.***> wrote:

That's very weird. I still can't reproduce the behavior you're seeing, but I'm admittedly using Terminal.app, not iTerm2. Any chance you could post the output of infocmp to see what ncurses thinks is going on? Maybe there's some weird local override? Because it seems like, despite NCURSES_NO_UTF8_ACS=1 being set, tree is emitting the Line Graphics characters and not the UTF-8 alternatives.

For example, in Terminal.app directly

$ tput smacs && echo tqq && tput rmacs

├──

but in mosh --local 127.0.0.1 inside Terminal.app

$ tput smacs && echo tqq && tput rmacs

tqq

— Reply to this email directly, view it on GitHub https://github.com/mobile-shell/mosh/issues/1155#issuecomment-1399601425, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADPYU7GTZ3PCP7BZUS66VSDWTWLCVANCNFSM5FJ3YSVQ . You are receiving this because you authored the thread.Message ID: @.***>