dandavison / delta

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

🐛 Crash while doing git diff HEAD..FETCH_HEAD on latest delta code running on MacOS #1760

Open lrfurtado opened 3 months ago

lrfurtado commented 3 months ago

Running code from commit 5d538b23039058d50f218611f714ff40d5cd883d

on macos

when trying to do git diff HEAD..FETCH_HEAD I get the crash below

thread 'main' panicked at library/alloc/src/raw_vec.rs:25:5:
capacity overflow
stack backtrace:
   0:        0x100acedb0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7fda799bfa435f0f
   1:        0x100adb2d0 - core::fmt::write::h149c43f8c649a127
   2:        0x100abf880 - std::io::Write::write_fmt::hc658f220ee6401ee
   3:        0x100acec04 - std::sys_common::backtrace::print::hd320cb51e23d85e7
   4:        0x100aca6f8 - std::panicking::default_hook::{{closure}}::h2a019217d59e304e
   5:        0x100aca414 - std::panicking::default_hook::h7115745ac0da2b42
   6:        0x100acaa94 - std::panicking::rust_panic_with_hook::hcaae50c6a8446a46
   7:        0x100acf160 - std::panicking::begin_panic_handler::{{closure}}::h3511e01278c0eee1
   8:        0x100acefdc - std::sys_common::backtrace::__rust_end_short_backtrace::hb40ac48f98b88c7f
   9:        0x100aca7dc - _rust_begin_unwind
  10:        0x100af9a5c - core::panicking::panic_fmt::hd81673e1b116ffee
  11:        0x100ada570 - alloc::raw_vec::capacity_overflow::he177c4fad30c3064
  12:        0x100af99f4 - alloc::raw_vec::handle_error::h814061ff56cfdcc0
  13:        0x100ada494 - alloc::slice::<impl [T]>::repeat::heea357c6bbc4f473
  14:        0x1008b47fc - delta::paint::Painter::paint_lines::h2270367d410b0326
  15:        0x1008b439c - delta::paint::Painter::paint_zero_line::h6c548bfff5cbc41f
  16:        0x1008da244 - delta::handlers::hunk::<impl delta::delta::StateMachine>::handle_hunk_line::h2d0a5765982fdc3b
  17:        0x1008d4100 - delta::delta::delta::hab6a5759a13c6797
  18:        0x1008b9d78 - delta::main::h5909ee6f2ee73102
  19:        0x100909d88 - std::sys_common::backtrace::__rust_begin_short_backtrace::h7d1b12fed2fc7b08
  20:        0x1008df6dc - std::rt::lang_start::{{closure}}::h92cf623c35598587
  21:        0x100aca730 - std::panicking::try::hd72586cf9ddb09aa
  22:        0x100ab809c - std::rt::lang_start_internal::ha2b1bf612bcbfcfb
  23:        0x1008bae70 - _main
th1000s commented 3 months ago

Oh, capacity_overflow! In what repo were when you called diff, and can you reconstruct where HEAD and FETCH_HEAD (that one is tricky as it is quite ephemeral) were at?

lrfurtado commented 3 months ago

Sorry for the lack of information on the original report.

(ins)> cd projects/delta/
(ins)> git rev-parse HEAD
5d538b23039058d50f218611f714ff40d5cd883d
(ins)> git rev-parse FETCH_HEAD
4127abc8075d9e0d2385f7148db9e34a99340ad7
(ins)> git remote -v
origin https://github.com/dandavison/delta (fetch)
origin https://github.com/dandavison/delta (push)
(ins)>

On Tue, Jul 16, 2024 at 3:03 AM Thomas Otto @.***> wrote:

Oh, capacity_overflow! In what repo were when you called diff, and can you reconstruct where HEAD and FETCH_HEAD (that one is tricky as it is quite ephemeral) were at?

— Reply to this email directly, view it on GitHub https://github.com/dandavison/delta/issues/1760#issuecomment-2230271900, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHGIWXUYBK7RSQ7TRVYQZLZMTHUJAVCNFSM6AAAAABK5BWAWKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZQGI3TCOJQGA . You are receiving this because you authored the thread.Message ID: @.***>

lrfurtado commented 3 months ago

Was able to do debug build and reproduce

-> state: HunkZero(Unified, None)
 140⋮ 140│## Features
-> state: HunkZero(Unified, None)
 141⋮ 141│
-> state: HunkZero(Unified, None)
thread 'main' panicked at src/paint.rs:266:43:
attempt to subtract with overflow
stack backtrace:
   0:        0x102f0a5a4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7fda799bfa435f0f
   1:        0x102f16b50 - core::fmt::write::h149c43f8c649a127
   2:        0x102efb074 - std::io::Write::write_fmt::hc658f220ee6401ee
   3:        0x102f0a3f8 - std::sys_common::backtrace::print::hd320cb51e23d85e7
   4:        0x102f05eec - std::panicking::default_hook::{{closure}}::h2a019217d59e304e
   5:        0x102f05c08 - std::panicking::default_hook::h7115745ac0da2b42
   6:        0x102f06288 - std::panicking::rust_panic_with_hook::hcaae50c6a8446a46
   7:        0x102f0a954 - std::panicking::begin_panic_handler::{{closure}}::h3511e01278c0eee1
   8:        0x102f0a7d0 - std::sys_common::backtrace::__rust_end_short_backtrace::hb40ac48f98b88c7f
   9:        0x102f05fd0 - _rust_begin_unwind
  10:        0x102f37280 - core::panicking::panic_fmt::hd81673e1b116ffee
  11:        0x102f376ac - core::panicking::panic_const::panic_const_sub_overflow::hcf454aa206276e25
  12:        0x10295567c - delta::paint::Painter::paint_lines::h8947a5e580b4338d
                               at /Users/l.furtado/projects/delta/src/paint.rs:266:43
  13:        0x10295504c - delta::paint::Painter::paint_zero_line::h9a1e57c297b5329b
                               at /Users/l.furtado/projects/delta/src/paint.rs:198:13
  14:        0x102996408 - delta::handlers::hunk::<impl delta::delta::StateMachine>::handle_hunk_line::hdbadcccc6ab12167
                               at /Users/l.furtado/projects/delta/src/handlers/hunk.rs:113:17
  15:        0x1029dd4c4 - delta::delta::StateMachine::consume::h7a4d5a5d0e021dfc
                               at /Users/l.furtado/projects/delta/src/delta.rs:171:20
  16:        0x1029dcc40 - delta::delta::delta::h12334100afa0cfe8
                               at /Users/l.furtado/projects/delta/src/delta.rs:120:5
  17:        0x102962e6c - delta::run_app::hb0d42b3d18bfd5e4
                               at /Users/l.furtado/projects/delta/src/main.rs:143:25
  18:        0x102962500 - delta::main::h787972296b3c44a8
                               at /Users/l.furtado/projects/delta/src/main.rs:67:21
  19:        0x1028a6ce8 - core::ops::function::FnOnce::call_once::hf2da28e6984ca297
                               at /private/tmp/rust-20240614-8052-s56n23/rustc-1.79.0-src/library/core/src/ops/function.rs:250:5
  20:        0x1029b27ac - std::sys_common::backtrace::__rust_begin_short_backtrace::h6dc1b15fbd88db03
                               at /private/tmp/rust-20240614-8052-s56n23/rustc-1.79.0-src/library/std/src/sys_common/backtrace.rs:155:18
  21:        0x1028fcb54 - std::rt::lang_start::{{closure}}::h00df7bbe2afe4c15
                               at /private/tmp/rust-20240614-8052-s56n23/rustc-1.79.0-src/library/std/src/rt.rs:159:18
  22:        0x102f05f24 - std::panicking::try::hd72586cf9ddb09aa
  23:        0x102ef3890 - std::rt::lang_start_internal::ha2b1bf612bcbfcfb
  24:        0x1028fcb20 - std::rt::lang_start::h95111824976377b2
                               at /private/tmp/rust-20240614-8052-s56n23/rustc-1.79.0-src/library/std/src/rt.rs:158:17
  25:        0x102963258 - _main
(ins)>
(ins)>
lrfurtado commented 3 months ago
image