nushell / nushell

A new type of shell
https://www.nushell.sh/
MIT License
31.72k stars 1.63k forks source link

table command printing multiline with unicode crash #13462

Open dirtslayer opened 1 month ago

dirtslayer commented 1 month ago

Describe the bug

The terminal window has to be sufficiently narrow to force the table command output to split a string into multiline for this crash to occur. The string must also contain a unicode character like 🖨️.

20..200 | each { let w = $in; "🖨️" | fill --character '-' --width $w | print }

this command prints a list of strings that contain 1 🖨️ that are increased in length, they are not sent to the table command here because of the | print, but, if you remove the | print

20..200 | each { let w = $in; "🖨️" | fill --character '-' --width $w }

a crash occurs

How to reproduce

20..200 | each { let w = $in; "🖨️" | fill --character '-' --width $w }

Expected behavior

not crash and print the strings

Screenshots

No response

Configuration

| key                | value                                    |
| ------------------ | ---------------------------------------- |
| version            | 0.96.0                                   |
| major              | 0                                        |
| minor              | 96                                       |
| patch              | 0                                        |
| branch             |                                          |
| commit_hash        |                                          |
| build_os           | linux-x86_64                             |
| build_target       | x86_64-unknown-linux-gnu                 |
| rust_version       | rustc 1.77.2 (25ef9e3d8 2024-04-09)      |
| rust_channel       | stable-x86_64-unknown-linux-gnu          |
| cargo_version      | cargo 1.77.2 (e52e36006 2024-03-26)      |
| build_time         | 2024-07-26 00:58:25 -06:00               |
| build_rust_channel | release                                  |
| allocator          | mimalloc                                 |
| features           | default, sqlite, system-clipboard, trash |
| installed_plugins  |                                        

Additional context

No response

dirtslayer commented 1 month ago

I had exported an email file, the filename was 57 characters but I was using a large font terminal only half the width of my screen and ls crashed my shell. I discovered it had nothing to do with the files, and that if I made my terminal large enough that the filename fit on one row, it would not crash. The script here is contrived to show it had nothing to do with my file, but rather its name length and having the emoji character.

sholderbach commented 1 month ago

Can you provide the error message for the crash and which table configuration you are using (if you diverge from the default there)

fdncred commented 1 month ago

There is a tabled fix that isn't merged yet that handles unicode/emoji better. Can you try with this PR to see if the behavior is better? https://github.com/nushell/nushell/pull/13430