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

panic during envelope listing when envelope contains non-ASCII char #497

Open
echo-bravo-yahoo opened this issue Nov 7, 2024 · 8 comments
Labels
bug Something isn't working question Further information is requested

Comments

@echo-bravo-yahoo
Copy link

echo-bravo-yahoo commented Nov 7, 2024

~ ❯ himalaya
Cannot find configuration at /Users/REDACTED/Library/Application Support/himalaya/config.toml.
> Would you like to create one with the wizard? Yes

Configuring your default account

> Email address: [email protected]
> Account name: gmail
> Full display name: REDACTED
> Downloads directory: ~/Downloads

Warning: Google passwords cannot be used directly, see:
https://github.com/pimalaya/himalaya?tab=readme-ov-file#configuration

> Default backend: IMAP
> IMAP hostname: imap.gmail.com
> IMAP encryption: SSL/TLS
> IMAP port: 993
> IMAP login: [email protected]
> IMAP authentication strategy: Ask my password, then save it in the configuration file (not safe)
> IMAP password: REDACTED
> Backend for sending messages: SMTP
> SMTP hostname: smtp.gmail.com
> SMTP encryption: SSL/TLS
> SMTP port: 465
> SMTP login: [email protected]
> SMTP authentication strategy: Ask my password, then save it in the configuration file (not safe)
> SMTP password: REDACTED
> Where to save the configuration? /Users/REDACTED/Library/Application Support/himalaya/config.toml
Writing configuration to /Users/REDACTED/Library/Application Support/himalaya/config.toml…
Done! Exiting the wizard…

The application panicked (crashed).
Message:  assertion failed: self.is_char_boundary(new_len)
Location: /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/alloc/src/string.rs:1407
~ ❯ himalaya accounts list                                                                               task !2/385

| NAME                               | BACKENDS                               | DEFAULT                             |
|------------------------------------|----------------------------------------|-------------------------------------|
| gmail                              | IMAP, SMTP                             | yes                                 |
~ ❯ himalaya

The application panicked (crashed).
Message:  assertion failed: self.is_char_boundary(new_len)
Location: /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/alloc/src/string.rs:1407
@echo-bravo-yahoo echo-bravo-yahoo changed the title himalaya wizard writes a config file that causes panics on default command himalaya wizard writes a config file that causes panics on most commands Nov 7, 2024
@soywod soywod self-assigned this Nov 11, 2024
@soywod soywod added the bug Something isn't working label Nov 11, 2024
@soywod soywod added this to Pimalaya Nov 11, 2024
@soywod soywod moved this to In Progress in Pimalaya Nov 11, 2024
@soywod
Copy link
Member

soywod commented Nov 11, 2024

Looks like a char is breaking the table system managed by comfy-table. Could you try to identify which one by playing with pagination --page-size 1 and --page?

@echo-bravo-yahoo echo-bravo-yahoo changed the title himalaya wizard writes a config file that causes panics on most commands himalaya 1.0.0-beta wizard writes a config file that causes panics on most commands Nov 12, 2024
@echo-bravo-yahoo
Copy link
Author

i can no longer reproduce using the version installed from github - either the bug's fixed, or the problematic email's fallen out of my inbox. i'll keep an eye out for this in the future, but closing for now.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Pimalaya Nov 17, 2024
@soywod
Copy link
Member

soywod commented Nov 17, 2024

Do you remember by any chance some subject with special char? Or an emoji?

@echo-bravo-yahoo
Copy link
Author

Regrettably, no, and moving a chunk of thing from archive back to inbox did not reproduce. I'll reply here if I can repro in the future!

@soywod soywod moved this from Done to Cancelled in Pimalaya Nov 18, 2024
@soywod soywod closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
@github-project-automation github-project-automation bot moved this from Cancelled to Done in Pimalaya Nov 18, 2024
@soywod soywod moved this from Done to Cancelled in Pimalaya Nov 18, 2024
@BasixKOR
Copy link

BasixKOR commented Dec 21, 2024

I just got this error from Himalaya and I'm quite confused as the resulting file doesn't seem to contain any special characters outside ASCII. Here's the full backtrace:

The application panicked (crashed).
Message:  assertion failed: self.is_char_boundary(new_len)
Location: /private/tmp/rust-20241128-8064-v5d6qj/rustc-1.83.0-src/library/alloc/src/string.rs:1472

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 9 frames hidden ⋮
  10: core::panicking::panic::h9889520f556572c5
      at <unknown source file>:<unknown line>
  11: comfy_table::utils::formatting::content_format::format_row::h67a0e3142574c94a
      at <unknown source file>:<unknown line>
  12: comfy_table::utils::formatting::content_format::format_content::hb5b881fb511b6da2
      at <unknown source file>:<unknown line>
  13: comfy_table::utils::build_table::hbd151f5ec2f6f694
      at <unknown source file>:<unknown line>
  14: <comfy_table::table::Table as core::fmt::Display>::fmt::h0c1d9e6a112bf7aa
      at <unknown source file>:<unknown line>
  15: core::fmt::write::h40c2acd4666eb4d3
      at <unknown source file>:<unknown line>
  16: <pimalaya_tui::himalaya::config::EnvelopesTable as core::fmt::Display>::fmt::h315768dee37fdfac
      at <unknown source file>:<unknown line>
  17: core::fmt::write::h40c2acd4666eb4d3
      at <unknown source file>:<unknown line>
  18: <&std::io::stdio::Stdout as std::io::Write>::write_fmt::h93e115a4222d5ee0
      at <unknown source file>:<unknown line>
  19: <std::io::stdio::Stdout as std::io::Write>::write_fmt::h799426fa44dcc531
      at <unknown source file>:<unknown line>
  20: <pimalaya_tui::terminal::cli::printer::StdoutPrinter as pimalaya_tui::terminal::cli::printer::Printer>::out::hf3d6c922225ef7d9
      at <unknown source file>:<unknown line>
  21: himalaya::email::envelope::command::list::EnvelopeListCommand::execute::{{closure}}::h482f2e0b44508598
      at <unknown source file>:<unknown line>
  22: tokio::runtime::park::CachedParkThread::block_on::h7e96193c5fb85341
      at <unknown source file>:<unknown line>
  23: tokio::runtime::context::runtime::enter_runtime::h7d85df5fa09ad85a
      at <unknown source file>:<unknown line>
  24: himalaya::main::h574575333fd0f3b6
      at <unknown source file>:<unknown line>
  25: std::sys::backtrace::__rust_begin_short_backtrace::h6af89625baf75aa1
      at <unknown source file>:<unknown line>
  26: std::rt::lang_start::{{closure}}::h19f1674ba8d457f5
      at <unknown source file>:<unknown line>
  27: std::rt::lang_start_internal::hadea728b8c40134b
      at <unknown source file>:<unknown line>
  28: _main<unknown>
      at <unknown source file>:<unknown line>

Update: I was able to reliably reproduce this by setting the terminal width under 100 characters, which causes the comfy_table to panic.

@soywod
Copy link
Member

soywod commented Dec 24, 2024

Update: I was able to reliably reproduce this by setting the terminal width under 100 characters, which causes the comfy_table to panic.

No matter the content, do you confirm?

@BasixKOR
Copy link

BasixKOR commented Dec 31, 2024

No matter the content, do you confirm?

Oops, yeah I missed that I had some CJK titled messages coming in. It seems like comfy_table is unable to calculate the width properly when Unicode letters are involved. When only ASCII characters are displayed the bug wasn't reproducible.

@Nukesor
Copy link

Nukesor commented Jan 1, 2025

@BasixKOR

Can you print the content of the table that breaks when squashed into a narrow terminal? Best case scenario would be a minimal reproducable input.

Furthermore, it would be good to know which OS you're on and maybe even what terminal emulator you're using.

What's interesting is, is that that panic doesn't originate from inside comfy-table but rather from inside the standard library on self.is_char_boundary(new_len) even though the content doesn't have any UTF-8 symbols. Are the borders utf-8 chars?

@soywod soywod reopened this Jan 2, 2025
@soywod soywod changed the title himalaya 1.0.0-beta wizard writes a config file that causes panics on most commands panic during envelope listing when envelope contains non-ASCII char Jan 2, 2025
@soywod soywod moved this from Done to Pending in Pimalaya Jan 2, 2025
@soywod soywod added the question Further information is requested label Jan 2, 2025
@soywod soywod removed their assignment Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
Status: Pending
Development

No branches or pull requests

4 participants