Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uftrace tui in docker shows ~T~\ ~T~@(1) instead of pseudographics #1870

Open
vt-alt opened this issue Dec 28, 2023 · 8 comments · May be fixed by #1974
Open

uftrace tui in docker shows ~T~\ ~T~@(1) instead of pseudographics #1870

vt-alt opened this issue Dec 28, 2023 · 8 comments · May be fixed by #1974

Comments

@vt-alt
Copy link

vt-alt commented Dec 28, 2023

uftrace tui in docker displays like this:

  TOTAL TIME : FUNCTION
   17.001  s : (1) apt-get
   19.261 us :   ~T~\ ~T~@(1) mkostemp
             :   ~T~B
    0.409 us :   ~T~\ ~T~@(1) getpid
             :   ~T~B
    0.316 us :   ~T~\ ~T~@(1) __snprintf_chk
             :   ~T~B
   41.176 us :   ~T~\ ~T~@(2) setenv
             :   ~T~B
    4.800 us :   ~T~\ ~T~@(12) signal
             :   ~T~B
   86.704 us :   ~T~\ ~T~@(1) fork
             :   ~T~B
   17.000  s :   ~T~\ ~T~@(1) waitpid
             :   ~T~B
             :   ~T~\ ~T~@(1) execvp
             :   ~T~B
    2.913 us :   ~T~\ ~T~@(1) fstat
             :   ~T~B
   20.147 us :   ~T~T ~T~@(1) unlink

TERM is xterm, terminfo is installed. There is no other TERM* env variables. It looked OK without docker. Maybe I'm missing something but I don't understand what.

Maybe there could be a option to force ascii or pseudographic lines?

@vt-alt
Copy link
Author

vt-alt commented Dec 28, 2023

ps. Btw, just a UI/UX thought: It would be easier to understand TUI navigation if q (or maybe arrow left) in G view would return to S view (i.e. to the first view when uftrace tui is started). It's not so intuitive that top view is a 'Session view' since it not marked in a TUI like this (only in man page, but not everybody study manpages extensively). Or maybe it should say instead:

S  Session view (this)

@vt-alt
Copy link
Author

vt-alt commented Dec 28, 2023

One more thought or maybe this is the TUI bug? Hard to tell since I never seen other behavior.

(Context) I want to analyze very huge trace (of apt-get install run with interaction between apt-get and librpm* libs [this is APT-RPM package manager)) so TUI in very important because there is extremely many calls.

So I want everything collapsed in Graph view (G) but when I press C it only collapses a single branch like c, not everything. 🤷

This is all in docker. Also (reversed selection cursor) line cross the window width to the next line sometimes (sometimes not) when scrolling. (Maybe this all related to the terminal mishandling.)

@namhyung
Copy link
Owner

Thanks for the report and the suggestions. I don't know what happened on the docker environment but can you please check your locale settings?

@vt-alt
Copy link
Author

vt-alt commented Dec 29, 2023

[root@eca26e7a5988 /]# locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

But this prompted me to try other locale:

[root@eca26e7a5988 /]# export LANG=en_US.UTF-8
[root@eca26e7a5988 /]# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
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=
[root@eca26e7a5988 /]#

After this TUI graph is the same broken. But I notice error message, they are due to absence of glibc-locales.

[root@eca26e7a5988 /]# apt-get install -y glibc-locales
[root@eca26e7a5988 /]# locale
LANG=en_US.UTF-8
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=

After this (still with LANG=en_US.UTF-8) graph is fixed:

   16.988  s : (1) apt-get
   10.149 us :  ├─(4) std::basic_ostream::basic_ostream
    1.329 us :  │  ├─(4) std::ios_base::ios_base
    0.293 us :  │  │ (4) std::locale::locale
             :  │  │
    4.869 us :  │  └─(4) std::basic_ios::init
    2.189 us :  │     ├─(4) std::ios_base::_M_init

Thanks for the suggestions!

After this install and with unset LANG which returns to a POSIX locale graph is broken again:

   16.988  s : (1) apt-get
   10.149 us :   ~T~\ ~T~@(4) std::basic_ostream::basic_ostream
    1.329 us :   ~T~B   ~T~\ ~T~@(4) std::ios_base::ios_base
    0.293 us :   ~T~B   ~T~B (4) std::locale::locale
             :   ~T~B   ~T~B
    4.869 us :   ~T~B   ~T~T ~T~@(4) std::basic_ios::init

It seems that we don't have LANG nor any LC_* env set out Docker image.

I checked other distros, Fedora have LANG=C.UTF-8 in their fedora:rawhide docker image (for run command), but ubuntu:mantic nor debian:12 do not have LANG set.

@vt-alt
Copy link
Author

vt-alt commented Dec 29, 2023

So I want everything collapsed in Graph view (G) but when I press C it only collapses a single branch like c, not everything. 🤷

I realized I could C on the top node and this collapses everything like I wanted. 👌

@namhyung
Copy link
Owner

Ok, sounds like we can check if LANG has "UTF-8" and then use the unicode glyphs.

@GabrielKimm
Copy link

I'd like to contribute to resolving this issue.

Based on the discussion, it seems checking for UTF-8 in the LANG environment variable before using Unicode glyphs could be a potential solution.

I'm willing to work on implementing this check and updating the TUI rendering accordingly.

Let me know if this approach sounds good, and I'll start working on a pull request.

@namhyung
Copy link
Owner

Sounds good, please go ahead.

GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Sep 29, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: Gabriel Kim <[email protected]>
@GabrielKimm GabrielKimm linked a pull request Sep 29, 2024 that will close this issue
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Sep 29, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: 0xGabriel <[email protected]>
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Sep 30, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: 0xGabriel <[email protected]>
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Oct 1, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: Gabriel Kim <[email protected]>
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Oct 1, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: Gabriel <[email protected]>
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Oct 1, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: Gabriel <[email protected]>
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Oct 1, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: Gabriel <[email protected]>
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Oct 1, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: GabrielKim <[email protected]>
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Oct 1, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: GabrielKim <[email protected]>
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Oct 1, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: GabrielKim <[email protected]>
GabrielKimm added a commit to GabrielKimm/uftrace that referenced this issue Oct 1, 2024
This commit addresses the issue namhyung#1870 where the TUI displays
incorrect characters in non-UTF-8 locales. The fix includes:

- Checking the current locale
- Using ASCII characters for graph display in non-UTF-8 locales
- Adjusting character widths accordingly

Fixes: namhyung#1870

Signed-off-by: Gabriel Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants