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

Index out of bounds error in src/popups/blame_file.rs, line: 622, col: 38 #2130

Closed
BrunoWallner opened this issue Mar 14, 2024 · 4 comments · Fixed by #2133
Closed

Index out of bounds error in src/popups/blame_file.rs, line: 622, col: 38 #2130

BrunoWallner opened this issue Mar 14, 2024 · 4 comments · Fixed by #2133
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@BrunoWallner
Copy link

Describe the bug
An index out of bounds error occurs when navigating specific file and then blaming it by pressing shift + B.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Clone https://codeberg.org/BrunoWallner/apoxel
  2. Go to commit ID: 312629cb98556f883533fe65faea2387eff2e8ff (git checkout 312629cb98556f883533fe65faea2387eff2e8ff)
  3. Run gitui inside the cloned repo
  4. Press tab to go to "Files" header and navigate to apoxel/path/shader/stage_1/chunks.wgsl
  5. press shift + B keys

Expected behavior
The Blame page should appear but instead the application crashes.

Error output

PanicInfo { payload: Any { .. }, message: Some(index out of bounds: the len is 339 but the index is 339), location: Location { file: "src/popups/blame_file.rs", line: 622, col: 38 }, can_unwind: true, force_no_backtrace: false }
trace:

Context

  • OS: Linux archlinux 6.7.8-arch1-1 use watcher instead of polling #1 SMP PREEMPT_DYNAMIC Sun, 03 Mar 2024 00:30:36 +0000 x86_64 GNU/Linux
  • Gitui version: gitui 0.25.1 installed via pacman
  • Rust version: rustc 1.78.0-nightly (9c3ad802d 2024-03-07) (should not matter)
@BrunoWallner BrunoWallner added the bug Something isn't working label Mar 14, 2024
@BrunoWallner BrunoWallner changed the title Index out of bounds error on src/popups/blame_file.rs, line: 622, col: 38 Index out of bounds error in src/popups/blame_file.rs, line: 622, col: 38 Mar 14, 2024
@extrawurst
Copy link
Owner

extrawurst commented Mar 15, 2024

ok this is a regression introduced by af9da95 by @tdtrung17693.

@tdtrung17693 can you look into this?

@extrawurst extrawurst added this to the v0.25.2 milestone Mar 15, 2024
@extrawurst
Copy link
Owner

relevant backtrace:

PanicInfo { payload: Any { .. }, message: Some(index out of bounds: the len is 339 but the index is 339), location: Location { file: "src/components/blame_file.rs", line: 619, col: 38 }, can_unwind: true, force_no_backtrace: false }
trace:
  13: gitui::components::blame_file::BlameFileComponent::get_line_blame::{{closure}}
             at src/components/blame_file.rs:619:23
  15: gitui::components::blame_file::BlameFileComponent::get_line_blame
             at src/components/blame_file.rs:612:19
  16: gitui::components::blame_file::BlameFileComponent::get_rows::{{closure}}::{{closure}}
             at src/components/blame_file.rs:541:7
  29: gitui::components::blame_file::BlameFileComponent::get_rows::{{closure}}
             at src/components/blame_file.rs:536:5
  31: gitui::components::blame_file::BlameFileComponent::get_rows
             at src/components/blame_file.rs:530:3
  32: <gitui::components::blame_file::BlameFileComponent as gitui::components::DrawableComponent>::draw
             at src/components/blame_file.rs:111:15
  33: gitui::app::App::draw_popups
             at src/components/mod.rs:133:16
  34: gitui::app::App::draw
             at src/app.rs:272:3

@extrawurst extrawurst added the help wanted Extra attention is needed label Mar 15, 2024
@tdtrung17693
Copy link
Contributor

ok this is a regression introduced by af9da95 by @tdtrung17693.

@tdtrung17693 can you look into this?

Ok. Let me take a look at it.

@tdtrung17693
Copy link
Contributor

Hi @extrawurst, I fixed this issue in #2133.

hendrikmaus added a commit to hendrikmaus/gitui that referenced this issue Mar 23, 2024
…signing

* 'master' of github.com:extrawurst/gitui: (52 commits)
  Git Config Commit Comments (extrawurst#2145)
  update changelog for 0.25.2
  fix another github action warning
  upgrade version
  prepare release
  preapre for release
  changelog
  fixes tag annotation being broken in 0.25 (extrawurst#2139)
  update changelog
  fix: 2114
  Bump backtrace from 0.3.69 to 0.3.70
  Fixed: - Cargo clippy errors
  cargo updates
  cargo update
  todo
  update changelog
  fix: index out of bounds when blaming a file ending with a blank line (extrawurst#2130)
  Bump bitflags from 2.4.2 to 2.5.0
  Bump clap from 4.5.2 to 4.5.3
  fix chrono deprecations
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants