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

clangfmt creates index out of bounds error #673

Closed
matu3ba opened this issue Aug 29, 2021 · 2 comments
Closed

clangfmt creates index out of bounds error #673

matu3ba opened this issue Aug 29, 2021 · 2 comments
Labels
A-language-server Area: Language server client C-bug Category: This is a bug

Comments

@matu3ba
Copy link

matu3ba commented Aug 29, 2021

Reproduction steps

I can not reproduce this reliably, so this looks like a spurious error, probably introduced by weird behavior from clangfmt (and clangd?). This looks incredibly cursed, but may help figuring out some edge cases of ropey so I posted here.

  1. open file myexample.c
  2. run :format to execute clangfmt
  3. index out of bounds error from ropey with the following shell output:
[user@pc freetypeexample]$ hx myexample.c
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Byte index out of bounds: byte index 1418, Rope/RopeSlice byte length 1416', $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.3.1/src/rope.rs:637:41
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Environment

  • Platform: Linux
  • Helix version: v0.3.0-236-g815ee9e
~/.cache/helix/helix.log
2021-08-06T13:27:17.676 helix_lsp::transport [ERROR] err <- [ERROR project_model::workspace] cyclic deps: ion_shell(CrateId(208)) -> builtins_proc(CrateId(48))

2021-08-06T13:27:18.394 helix_lsp::transport [ERROR] err <- [ERROR project_model::workspace] cyclic deps: ion_shell(CrateId(208)) -> builtins_proc(CrateId(48))

2021-08-06T13:39:52.295 helix_lsp::transport [ERROR] err <- [ERROR project_model::workspace] cyclic deps: ion_shell(CrateId(208)) -> builtins_proc(CrateId(48))

2021-08-06T13:39:53.025 helix_lsp::transport [ERROR] err <- [ERROR project_model::workspace] cyclic deps: ion_shell(CrateId(208)) -> builtins_proc(CrateId(48))

2021-08-29T17:36:53.097 helix_lsp::transport [ERROR] err <- I[17:36:53.097] clangd version 12.0.1

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.097] PID: 645648

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.097] Working directory: $HOME/dev/git/c/freetypeexample

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.097] argv[0]: clangd

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.097] Starting LSP over stdin/stdout

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.097] <-- initialize(0)

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.097] --> reply:initialize(0) 0 ms

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.098] <-- initialized

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.098] <-- textDocument/didOpen

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.098] Loaded compilation database from $HOME/dev/git/c/freetypeexample/compile_commands.json

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- I[17:36:53.098] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 0 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:36:53.098 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:36:53.164 helix_lsp::transport [ERROR] err <- I[17:36:53.163] --> textDocument/publishDiagnostics

2021-08-29T17:36:57.690 helix_lsp::transport [ERROR] err <- I[17:36:57.690] <-- textDocument/references(1)

2021-08-29T17:36:57.692 helix_lsp::transport [ERROR] err <- I[17:36:57.692] --> reply:textDocument/references(1) 1 ms

2021-08-29T17:37:17.600 helix_lsp::transport [ERROR] err <- I[17:37:17.600] <-- textDocument/formatting(2)

2021-08-29T17:37:17.603 helix_lsp::transport [ERROR] err <- I[17:37:17.603] --> reply:textDocument/formatting(2) 3 ms

2021-08-29T17:37:17.607 helix_lsp::transport [ERROR] err <- I[17:37:17.607] <-- textDocument/didChange

2021-08-29T17:37:54.815 helix_lsp::transport [ERROR] err <- I[17:37:54.815] clangd version 12.0.1

2021-08-29T17:37:54.815 helix_lsp::transport [ERROR] err <- I[17:37:54.815] PID: 645678

2021-08-29T17:37:54.815 helix_lsp::transport [ERROR] err <- I[17:37:54.815] Working directory: $HOME/dev/git/c/freetypeexample

2021-08-29T17:37:54.815 helix_lsp::transport [ERROR] err <- I[17:37:54.815] argv[0]: clangd

2021-08-29T17:37:54.815 helix_lsp::transport [ERROR] err <- I[17:37:54.815] Starting LSP over stdin/stdout

2021-08-29T17:37:54.815 helix_lsp::transport [ERROR] err <- I[17:37:54.815] <-- initialize(0)

2021-08-29T17:37:54.816 helix_lsp::transport [ERROR] err <- I[17:37:54.816] --> reply:initialize(0) 0 ms

2021-08-29T17:37:54.816 helix_lsp::transport [ERROR] err <- I[17:37:54.816] <-- initialized

2021-08-29T17:37:54.816 helix_lsp::transport [ERROR] err <- I[17:37:54.816] <-- textDocument/didOpen

2021-08-29T17:37:54.817 helix_lsp::transport [ERROR] err <- I[17:37:54.816] Loaded compilation database from $HOME/dev/git/c/freetypeexample/compile_commands.json

2021-08-29T17:37:54.817 helix_lsp::transport [ERROR] err <- I[17:37:54.817] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 0 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:37:54.817 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:37:54.817 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:37:54.877 helix_lsp::transport [ERROR] err <- I[17:37:54.877] --> textDocument/publishDiagnostics

2021-08-29T17:37:57.144 helix_lsp::transport [ERROR] err <- I[17:37:57.144] <-- textDocument/formatting(1)

2021-08-29T17:37:57.152 helix_lsp::transport [ERROR] err <- I[17:37:57.152] --> reply:textDocument/formatting(1) 8 ms

2021-08-29T17:37:57.158 helix_lsp::transport [ERROR] err <- I[17:37:57.158] <-- textDocument/didChange

2021-08-29T17:37:57.210 helix_lsp::transport [ERROR] err <- I[17:37:57.210] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 1 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:37:57.210 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:37:57.210 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:37:57.267 helix_lsp::transport [ERROR] err <- I[17:37:57.267] --> textDocument/publishDiagnostics

2021-08-29T17:37:59.725 helix_lsp::transport [ERROR] err <- I[17:37:59.725] <-- textDocument/didChange

2021-08-29T17:37:59.776 helix_lsp::transport [ERROR] err <- I[17:37:59.776] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 2 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:37:59.776 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:37:59.776 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:37:59.826 helix_lsp::transport [ERROR] err <- I[17:37:59.826] --> textDocument/publishDiagnostics

2021-08-29T17:38:03.856 helix_lsp::transport [ERROR] err <- I[17:38:03.856] <-- textDocument/formatting(2)

2021-08-29T17:38:03.861 helix_lsp::transport [ERROR] err <- I[17:38:03.861] --> reply:textDocument/formatting(2) 5 ms

2021-08-29T17:38:03.865 helix_lsp::transport [ERROR] err <- I[17:38:03.865] <-- textDocument/didChange

2021-08-29T17:38:03.916 helix_lsp::transport [ERROR] err <- I[17:38:03.916] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 3 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:38:03.916 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:38:03.916 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:38:03.976 helix_lsp::transport [ERROR] err <- I[17:38:03.976] --> textDocument/publishDiagnostics

2021-08-29T17:38:32.485 helix_lsp::transport [ERROR] err <- I[17:38:32.485] <-- textDocument/didSave

2021-08-29T17:38:32.485 helix_lsp::transport [ERROR] err <- I[17:38:32.485] <-- shutdown(3)

2021-08-29T17:38:32.485 helix_lsp::transport [ERROR] err <- I[17:38:32.485] --> reply:shutdown(3) 0 ms

2021-08-29T17:38:32.486 helix_lsp::transport [ERROR] err <- I[17:38:32.486] <-- exit

2021-08-29T17:38:32.486 helix_lsp::transport [ERROR] err <- I[17:38:32.486] LSP finished, exiting with status 0

2021-08-29T17:38:32.486 helix_lsp::transport [ERROR] err <- I[17:38:32.486] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 3 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:38:32.487 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:38:32.487 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:43:25.554 helix_lsp::transport [ERROR] err <- I[17:43:25.554] clangd version 12.0.1

2021-08-29T17:43:25.554 helix_lsp::transport [ERROR] err <- I[17:43:25.554] PID: 645948

2021-08-29T17:43:25.554 helix_lsp::transport [ERROR] err <- I[17:43:25.554] Working directory: $HOME/dev/git/c/freetypeexample

2021-08-29T17:43:25.554 helix_lsp::transport [ERROR] err <- I[17:43:25.554] argv[0]: clangd

2021-08-29T17:43:25.554 helix_lsp::transport [ERROR] err <- I[17:43:25.554] Starting LSP over stdin/stdout

2021-08-29T17:43:25.554 helix_lsp::transport [ERROR] err <- I[17:43:25.554] <-- initialize(0)

2021-08-29T17:43:25.555 helix_lsp::transport [ERROR] err <- I[17:43:25.555] --> reply:initialize(0) 0 ms

2021-08-29T17:43:25.555 helix_lsp::transport [ERROR] err <- I[17:43:25.555] <-- initialized

2021-08-29T17:43:25.555 helix_lsp::transport [ERROR] err <- I[17:43:25.555] <-- textDocument/didOpen

2021-08-29T17:43:25.556 helix_lsp::transport [ERROR] err <- I[17:43:25.556] Loaded compilation database from $HOME/dev/git/c/freetypeexample/compile_commands.json

2021-08-29T17:43:25.557 helix_lsp::transport [ERROR] err <- I[17:43:25.556] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 0 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:43:25.557 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:43:25.557 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:43:25.614 helix_lsp::transport [ERROR] err <- I[17:43:25.614] --> textDocument/publishDiagnostics

2021-08-29T17:43:28.247 helix_lsp::transport [ERROR] err <- I[17:43:28.247] <-- textDocument/formatting(1)

2021-08-29T17:43:28.253 helix_lsp::transport [ERROR] err <- I[17:43:28.252] --> reply:textDocument/formatting(1) 5 ms

2021-08-29T17:43:28.253 helix_lsp::transport [ERROR] err <- I[17:43:28.253] <-- textDocument/didChange

2021-08-29T17:43:28.304 helix_lsp::transport [ERROR] err <- I[17:43:28.303] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 1 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:43:28.304 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:43:28.304 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:43:30.795 helix_lsp::transport [ERROR] err <- I[17:43:30.795] <-- shutdown(2)

2021-08-29T17:43:30.795 helix_lsp::transport [ERROR] err <- I[17:43:30.795] --> reply:shutdown(2) 0 ms

2021-08-29T17:43:30.795 helix_lsp::transport [ERROR] err <- I[17:43:30.795] <-- exit

2021-08-29T17:43:30.795 helix_lsp::transport [ERROR] err <- I[17:43:30.795] LSP finished, exiting with status 0

2021-08-29T17:43:32.073 helix_lsp::transport [ERROR] err <- I[17:43:32.073] clangd version 12.0.1

2021-08-29T17:43:32.073 helix_lsp::transport [ERROR] err <- I[17:43:32.073] PID: 645969

2021-08-29T17:43:32.073 helix_lsp::transport [ERROR] err <- I[17:43:32.073] Working directory: $HOME/dev/git/c/freetypeexample

2021-08-29T17:43:32.073 helix_lsp::transport [ERROR] err <- I[17:43:32.073] argv[0]: clangd

2021-08-29T17:43:32.073 helix_lsp::transport [ERROR] err <- I[17:43:32.073] Starting LSP over stdin/stdout

2021-08-29T17:43:32.073 helix_lsp::transport [ERROR] err <- I[17:43:32.073] <-- initialize(0)

2021-08-29T17:43:32.074 helix_lsp::transport [ERROR] err <- I[17:43:32.074] --> reply:initialize(0) 0 ms

2021-08-29T17:43:32.074 helix_lsp::transport [ERROR] err <- I[17:43:32.074] <-- initialized

2021-08-29T17:43:32.074 helix_lsp::transport [ERROR] err <- I[17:43:32.074] <-- textDocument/didOpen

2021-08-29T17:43:32.074 helix_lsp::transport [ERROR] err <- I[17:43:32.074] Loaded compilation database from $HOME/dev/git/c/freetypeexample/compile_commands.json

2021-08-29T17:43:32.075 helix_lsp::transport [ERROR] err <- I[17:43:32.075] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 0 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:43:32.075 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:43:32.075 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:43:32.128 helix_lsp::transport [ERROR] err <- I[17:43:32.127] --> textDocument/publishDiagnostics

2021-08-29T17:43:36.030 helix_lsp::transport [ERROR] err <- I[17:43:36.030] <-- textDocument/formatting(1)

2021-08-29T17:43:36.036 helix_lsp::transport [ERROR] err <- I[17:43:36.036] --> reply:textDocument/formatting(1) 6 ms

2021-08-29T17:43:36.036 helix_lsp::transport [ERROR] err <- I[17:43:36.036] <-- textDocument/didChange

2021-08-29T17:43:36.087 helix_lsp::transport [ERROR] err <- I[17:43:36.087] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 1 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:43:36.087 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:43:36.087 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:43:39.035 helix_lsp::transport [ERROR] err <- I[17:43:39.035] <-- shutdown(2)

2021-08-29T17:43:39.035 helix_lsp::transport [ERROR] err <- I[17:43:39.035] --> reply:shutdown(2) 0 ms

2021-08-29T17:43:39.035 helix_lsp::transport [ERROR] err <- I[17:43:39.035] <-- exit

2021-08-29T17:43:39.035 helix_lsp::transport [ERROR] err <- I[17:43:39.035] LSP finished, exiting with status 0

2021-08-29T17:43:40.679 helix_lsp::transport [ERROR] err <- I[17:43:40.679] clangd version 12.0.1

2021-08-29T17:43:40.679 helix_lsp::transport [ERROR] err <- I[17:43:40.679] PID: 645992

2021-08-29T17:43:40.679 helix_lsp::transport [ERROR] err <- I[17:43:40.679] Working directory: $HOME/dev/git/c/freetypeexample

2021-08-29T17:43:40.679 helix_lsp::transport [ERROR] err <- I[17:43:40.679] argv[0]: clangd

2021-08-29T17:43:40.679 helix_lsp::transport [ERROR] err <- I[17:43:40.679] Starting LSP over stdin/stdout

2021-08-29T17:43:40.679 helix_lsp::transport [ERROR] err <- I[17:43:40.679] <-- initialize(0)

2021-08-29T17:43:40.680 helix_lsp::transport [ERROR] err <- I[17:43:40.680] --> reply:initialize(0) 0 ms

2021-08-29T17:43:40.680 helix_lsp::transport [ERROR] err <- I[17:43:40.680] <-- initialized

2021-08-29T17:43:40.680 helix_lsp::transport [ERROR] err <- I[17:43:40.680] <-- textDocument/didOpen

2021-08-29T17:43:40.680 helix_lsp::transport [ERROR] err <- I[17:43:40.680] Loaded compilation database from $HOME/dev/git/c/freetypeexample/compile_commands.json

2021-08-29T17:43:40.681 helix_lsp::transport [ERROR] err <- I[17:43:40.681] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 0 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:43:40.681 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:43:40.681 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:43:40.735 helix_lsp::transport [ERROR] err <- I[17:43:40.735] --> textDocument/publishDiagnostics

2021-08-29T17:43:43.590 helix_lsp::transport [ERROR] err <- I[17:43:43.590] <-- textDocument/formatting(1)

2021-08-29T17:43:43.595 helix_lsp::transport [ERROR] err <- I[17:43:43.595] --> reply:textDocument/formatting(1) 5 ms

2021-08-29T17:43:43.595 helix_lsp::transport [ERROR] err <- I[17:43:43.595] <-- textDocument/didChange

2021-08-29T17:43:43.646 helix_lsp::transport [ERROR] err <- I[17:43:43.646] ASTWorker building file $HOME/dev/git/c/freetypeexample/myexample.c version 1 with command inferred from $HOME/dev/git/c/freetype_experiments/myexample.c

2021-08-29T17:43:43.646 helix_lsp::transport [ERROR] err <- [$HOME/dev/git/c/freetype_experiments]

2021-08-29T17:43:43.646 helix_lsp::transport [ERROR] err <- /usr/bin/cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm $HOME/dev/git/c/freetypeexample/myexample.c -fsyntax-only -resource-dir=/usr/lib/clang/12.0.1

2021-08-29T17:43:45.163 helix_lsp::transport [ERROR] err <- I[17:43:45.163] <-- shutdown(2)

2021-08-29T17:43:45.163 helix_lsp::transport [ERROR] err <- I[17:43:45.163] --> reply:shutdown(2) 0 ms

2021-08-29T17:43:45.164 helix_lsp::transport [ERROR] err <- I[17:43:45.163] <-- exit

2021-08-29T17:43:45.164 helix_lsp::transport [ERROR] err <- I[17:43:45.164] LSP finished, exiting with status 0
myexample.c
// font: /usr/share/fonts/TTF/DejaVuSans.ttf
// text: "testtext"
// compile with cc `pkg-config --cflags --libs freetype2` -lm myexample.c
#include <assert.h>
#include <ft2build.h>
#include <stdio.h>
#include FT_FREETYPE_H

int main() {
  FT_Library library;
  FT_Face face;
  const char *filepath = "/usr/share/fonts/truetype/arial.tff";

  // neovim how to align code
  int error = 0; // 0 is success
  error = FT_Init_FreeType(&library);
  if (error != FT_Err_Ok) {
    printf("could not load library\n");
    printf(-1);
  }
  assert(library != NULL);

  error = FT_New_Face(library, filepath, 0, &face);
  // to know how many faces a given font contains:
  // 1. set face_index = -1
  // 2. prinft("count of embedded faces in font file: %d\n", face->num_faces);
  // if file was loaded into memory,
  // error = FT_New_Memory_Face(library, buffer, size, 0, &face);

  if (error == FT_Err_Unknown_File_Format) {
    printf("unknown file format\n");
    exit(-2);
  } else if (error != FT_Err_Ok) {
    printf("could not load face\n");
    exit(-3);
  }
  assert(face != NULL);
  // face->num_glyphs
  // complete list of available fields: FT_FaceRec

  // 2. char_width,char_height in 1/64th of points, horizontal and vertical
  // device resolution
  error = FT_Set_Char_Size(face, 0, 16 * 64, 300, 300);
  if (error != FT_Err_Ok) {
    printf("invalid character size\n");
    exit(-4);
  }
  // what more???
}
compile_command.json
[
{
  "directory": "/home/misterspoon/dev/git/c/freetype_experiments",
  "command": "cc -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lfreetype -lm myexample.c",
  "file": "/home/misterspoon/dev/git/c/freetype_experiments/myexample.c"
}
]

neovim gives up completely editing with ASAN resulting in stuff like

=================================================================
==620094==ERROR: AddressSanitizer: SEGV on unknown address 0xfffffffffffffff8 (pc 0x55947f8cddba bp 0x7fe668c28e80 sp 0x7ffebeb36f40 T0)
==620094==The signal is caused by a READ memory access.
    #0 0x55947f8cddba  (<unknown module>)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (<unknown module>) 
==620094==ABORTING
@matu3ba matu3ba added the C-bug Category: This is a bug label Aug 29, 2021
@kirawi kirawi added the A-language-server Area: Language server client label Aug 29, 2021
@matoous
Copy link
Contributor

matoous commented Dec 11, 2022

Very old issue but I believe this might have been related to: #4047. Either way I guess we could close this given it's for a year and a half old version? cc @the-mikedavis

@dead10ck
Copy link
Member

Yeah let's close this to clean up. If it resurfaces, we can make a new issue or reopen this one.

@dead10ck dead10ck closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants