Skip to content
New issue

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

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

Already on GitHub? # to your account

🐛 Crash searching a long diff #210

Closed
jlawton opened this issue May 30, 2020 · 3 comments
Closed

🐛 Crash searching a long diff #210

jlawton opened this issue May 30, 2020 · 3 comments

Comments

@jlawton
Copy link

jlawton commented May 30, 2020

delta --version: 0.1.1
git config core.pager: delta --dark

I have a 25MB diff that unfortunately I can't share. It's a mixture of various code, XML, PDFs, etc. I'm sorry if that leaves this a little lean on detail. My main lead is that the diff has a lot of inexact renames, but that could be a red herring.

Two bad behaviors happen with delta.

  1. I can git show and hit G to jump to the end, I only get to line 184,066, with the rest of the diff cut off. The same with git show | less, I get to 547,184.

  2. If I kick off a search that doesn't match instead, I get an out of bounds error with the following trace:

thread 'main' panicked at 'byte index 2 is out of bounds of `&`', src/libcore/str/mod.rs:2131:9
stack backtrace:
   0:        0x10732cac5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h30b85a1761190f28
   1:        0x1073431ce - core::fmt::write::h5b0722e6ee659e34
   2:        0x10732bce9 - std::io::Write::write_fmt::hf468289e762fa2f9
   3:        0x10731d86a - std::panicking::default_hook::{{closure}}::h836d46ca6b872224
   4:        0x10731d58f - std::panicking::default_hook::h2afcf1998cd93f8c
   5:        0x10731de4d - std::panicking::rust_panic_with_hook::he4f5d8b43533efd5
   6:        0x10731da12 - rust_begin_unwind
   7:        0x10734f32f - core::panicking::panic_fmt::h3559129da805eab4
   8:        0x10734f0ae - core::str::slice_error_fail::hd6f6d2e5a693e978
   9:        0x1071d84c4 - core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::Range<usize>>::index::{{closure}}::h24851af3c1dab157
  10:        0x1071da39f - delta::parse::get_file_extension_from_diff_line::h02d721288dfd8178
  11:        0x1071cd157 - delta::delta::delta::hef7771a97efa631e
  12:        0x1071d67fe - delta::main::hfdd82967b734b176
  13:        0x1071d7505 - std::rt::lang_start::{{closure}}::h5d2da361401c3ca8
  14:        0x10731d928 - std::panicking::try::do_call::h29bd6a8b4eb65398
  15:        0x10733025b - __rust_maybe_catch_panic
  16:        0x107322389 - std::rt::lang_start_internal::h1cbb853ed77189ce
  17:        0x1071d74d9 - main

The same with git show | less spits out the following (on stderr, CTRL-L repaints without the lines) but then G does get to the end of the diff.

warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 4020 and retry the command.
@dandavison
Copy link
Owner

Hi @jlawton, thanks for reporting and no worries, happy to try to get to the bottom of it without the original problematic diff.

Are you able to build delta from the git repo and try the version in master? The function that's crashing for you has changed so it would be great if we could debug this against master.

https://github.com/dandavison/delta#build-delta-from-source

@jlawton
Copy link
Author

jlawton commented Jun 5, 2020

It looks like it's fixed on master! Thanks! The whole diff paged.

I'm impressed with how simple the whole installation of rust and the build was. Just another reminder I should give rust a try. A huge contrast to a ruby environment I had to set up the other day.

Of course, I also realized that the two behaviors I was seeing was probably an artifact of G causing a repaint, but a failed search causing a read without a repaint of the screen, letting stderr show.

@dandavison
Copy link
Owner

Great. I'm aiming to get a new release out soon, but a lot of bug fixes, features and refactoring got bundled together this time so it's taking a while!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants