dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
21.32k stars 358 forks source link

πŸ› Updating bat cache with new theme crashes delta #1721

Closed aaharr closed 2 weeks ago

aaharr commented 2 weeks ago

Hi Folks,

After adding a .thTheme to bat and rebuilding its cache, no delta calls work.

Seems related to https://github.com/dandavison/delta/issues/1304. I also installed with brew.


thread 'main' panicked at library/alloc/src/raw_vec.rs:571:5:
capacity overflow
stack backtrace:
   0:     0x555638f86855 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb2d11bf794d51a44
   1:     0x555638fb51d0 - core::fmt::write::hc9c39fd060f58be5
   2:     0x555638f783b5 - std::io::Write::write_fmt::h0f12046d62ab82d9
   3:     0x555638f86614 - std::sys_common::backtrace::print::had20f5e369bd8b8b
   4:     0x555638f66cc4 - std::panicking::default_hook::{{closure}}::h5f274992636625c8
   5:     0x555638f669ce - std::panicking::default_hook::hda96c8e22c1e561c
   6:     0x555638f670f8 - std::panicking::rust_panic_with_hook::hb9ee0580a171cf05
   7:     0x555638f86d8e - std::panicking::begin_panic_handler::{{closure}}::h6a91c522b14e319c
   8:     0x555638f86a96 - std::sys_common::backtrace::__rust_end_short_backtrace::h0c1987780043709b
   9:     0x555638f66e00 - rust_begin_unwind
  10:     0x555638c119a5 - core::panicking::panic_fmt::haffa8b258e06944a
  11:     0x555638fb3169 - alloc::raw_vec::capacity_overflow::h0039e6905d35d5d0
  12:     0x555638c08030 - alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle::h0bf3b37da7ee2892
  13:     0x555638e3573b - <&mut bincode::de::Deserializer<R,O> as serde::de::Deserializer>::deserialize_string::h8c00e657ab2fd658
  14:     0x555638e34603 - <&mut bincode::de::Deserializer<R,O> as serde::de::Deserializer>::deserialize_map::h582f77c898db8fbc
  15:     0x555638e2fc0a - bat::assets::asset_from_contents::hdddd8aecedd32312
  16:     0x555638e2ecaa - bat::assets::HighlightingAssets::from_cache::h53adb9e58963f324
  17:     0x555638cbd188 - delta::main::h204dcb8f4ed121a4
  18:     0x555638cc0153 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8dcf7ac18805b7c1
  19:     0x555638d1c2ed - std::rt::lang_start::{{closure}}::h371801be79583f4a
  20:     0x555638f66cf4 - std::panicking::try::he8668e2b0b38c1ab
  21:     0x555638f68b4b - std::rt::lang_start_internal::h18187536d7e524f6
  22:     0x555638cbf9b5 - main
  23:     0x7f43d3aef1b7 - __libc_start_call_main
  24:     0x7f43d3aef26c - __libc_start_main_alias_2
  25:     0x555638c122e5 - _start
  26:                0x0 - <unknown>

image

aaharr commented 2 weeks ago

Installing with cargo gives similar output.

Deb install wants me to upgrade libc6 which seems too risky for today.. (on Ubuntu focal)

aaharr commented 2 weeks ago

Installing a newer version of Bat seems to have resolved this issue (0.24.0) (via binary release). Also a temporary way to get out of the bad state is to delete the offending bat cache.

Looks like the version of bat in apt is quite old (0.12..) might be good to throw an error right away if it's a broken version πŸ™Œ

aaron ~/Downloads -❯ bat cache --build
No syntaxes were found in '/home/aaron/.config/bat/syntaxes', using the default set.
Writing theme set to /home/aaron/.cache/bat/themes.bin ... okay
Writing syntax set to /home/aaron/.cache/bat/syntaxes.bin ... okay
Writing metadata to folder /home/aaron/.cache/bat ... okay

Closing