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 diffing text file with --display inline (apparently interpreted as sql) #682

Open
HannesFranke-smartoptics opened this issue Mar 26, 2024 · 0 comments

Comments

@HannesFranke-smartoptics

I hit a reproducible panic diffing some text file. Running on windows with difft.exe in the path, calling via WSL terminal.

difft.exe --version
Difftastic 0.56.1 (built with rustc 1.77.0)

wget https://raw.githubusercontent.com/FFmpeg/FFmpeg/master/COPYING.LGPLv2.1

RUST_BACTRACE=full difft.exe --display inline deleted_file ./COPYING.LGPLv2.1 commit_hash 10644 nul . .

thread 'main' panicked at C:\Users\Hannes.Franke\.cargo\registry\src\index.crates.io-6f17d22bba15001f\difftastic-0.56.1\src\display\inline.rs:129:38:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0:     0x7ff6a90e2d71 - <unknown>
   1:     0x7ff6a8f3000d - <unknown>
   2:     0x7ff6a90df421 - <unknown>
   3:     0x7ff6a90e2b4a - <unknown>
   4:     0x7ff6a90e5379 - <unknown>
   5:     0x7ff6a90e4fe5 - <unknown>
   6:     0x7ff6a90e5a04 - <unknown>
   7:     0x7ff6a90e58e9 - <unknown>
   8:     0x7ff6a90e3469 - <unknown>
   9:     0x7ff6a90e55d6 - <unknown>
  10:     0x7ff6a98c6837 - tree_sitter_sql
  11:     0x7ff6a98c69e4 - tree_sitter_sql
  12:     0x7ff6a8f8726a - <unknown>
  13:     0x7ff6a8f72011 - <unknown>
  14:     0x7ff6a8f6c457 - <unknown>
  15:     0x7ff6a8f7a496 - <unknown>
  16:     0x7ff6a8fc7cfc - <unknown>
  17:     0x7ff6a90d86d5 - <unknown>
  18:     0x7ff6a8f724bc - <unknown>
  19:     0x7ff6a98c1fac - tree_sitter_sql
  20:     0x7ffd3e19257d - BaseThreadInitThunk
  21:     0x7ffd3f16aa58 - RtlUserThreadStart
JonathanxD added a commit to JonathanxD/difftastic that referenced this issue Apr 5, 2024
JonathanxD added a commit to JonathanxD/difftastic that referenced this issue Apr 5, 2024
JonathanxD added a commit to JonathanxD/difftastic that referenced this issue Apr 6, 2024
Fixes Wilfred#688, fixes Wilfred#694, fixes Wilfred#682 and fixes Wilfred#681.

This works around the fact that `str::lines` does not include last
newline character.
This means that `"a\n".lines().count() == "a".lines().count()`, which
breaks the 1:1 assumption made by display implementations.
JonathanxD added a commit to JonathanxD/difftastic that referenced this issue Apr 6, 2024
Fixes Wilfred#688, fixes Wilfred#694, fixes Wilfred#682 and fixes Wilfred#681.

This works around the fact that `str::lines` does not include last
newline character.
This means that `"a\n".lines().count() == "a".lines().count()`, which
breaks the 1:1 assumption made by display implementations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant