Help identifying panic: `assertion failed: plain_range.start <= plain_range.end`
** Q: **
I am using cargo-spellcheck in my repo and with dev_comments set to true I receive this panic error:
cargo spellcheck --cfg=./spellcheck/era.cfg
The application panicked (crashed).
Message: assertion failed: plain_range.start <= plain_range.end
Location: /Users/dustinbrickwood/.cargo/registry/src/index.crates.io-6f17d22bba15001f/doc-chunks-0.0.5/src/markdown.rs:363
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
When I run with -vvvvv verbosity it doesn't seem to panic but perhaps I reading it wrong? Also ran with RUST_BACKTRACE=full but no clarity on the root issue is.
Question: How can I see where in my application it is causing this panic?
To reproduce
-
git clone [email protected]:matter-labs/zksync-era.git -
git checkout dutterbutter-pla-646-add-spelling-linter-for-zksync-era-core-part-2 -
cargo spellcheck --cfg=./spellcheck/era.cfg --code 1 - Error result:
The application panicked (crashed).
Message: assertion failed: plain_range.start <= plain_range.end
Location: /Users/dustinbrickwood/.cargo/registry/src/index.crates.io-6f17d22bba15001f/doc-chunks-0.0.5/src/markdown.rs:363
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
cargo-spellcheck Config file:
Click to view config file
# Project settings where a Cargo.toml exists and is passed
# ${CARGO_MANIFEST_DIR}/.config/spellcheck.toml
# Also take into account developer comments
dev_comments = true
# Skip the README.md file as defined in the cargo manifest
skip_readme = false
[Hunspell]
# lang and name of `.dic` file
lang = "en_US"
# OS specific additives
# Linux: [ /usr/share/myspell ]
# Windows: []
# macOS [ /home/alice/Libraries/hunspell, /Libraries/hunspell ]
# Additional search paths, which take presedence over the default
# os specific search dirs, searched in order, defaults last
search_dirs = ["."]
# Adds additional dictionaries, can be specified as
# absolute paths or relative in the search dirs (in this order).
# Relative paths are resolved relative to the configuration file
# which is used.
# Refer to `man 5 hunspell`
# or https://www.systutorials.com/docs/linux/man/4-hunspell/#lbAE
# on how to define a custom dictionary file.
extra_dictionaries = ["era.dic"]
# If set to `true`, the OS specific default search paths
# are skipped and only explicitly specified ones are used.
skip_os_lookups = false
# Use the builtin dictionaries if none were found in
# in the configured lookup paths.
# Usually combined with `skip_os_lookups=true`
# to enforce the `builtin` usage for consistent
# results across distributions and CI runs.
# Setting this will still use the dictionaries
# specified in `extra_dictionaries = [..]`
# for topic specific lingo.
use_builtin = true
[Hunspell.quirks]
# Transforms words that are provided by the tokenizer
# into word fragments based on the capture groups which are to
# be checked.
# If no capture groups are present, the matched word is whitelisted.
transform_regex = ["^'([^\\s])'$", "^[0-9]+x$"]
# Accepts `alphabeta` variants if the checker provides a replacement suggestion
# of `alpha-beta`.
allow_concatenation = true
# And the counterpart, which accepts words with dashes, when the suggestion has
# recommendations without the dashes. This is less common.
allow_dashed = false
[NlpRules]
# Allows the user to override the default included
# exports of LanguageTool, with other custom
# languages
# override_rules = "/path/to/rules_binencoded.bin"
# override_tokenizer = "/path/to/tokenizer_binencoded.bin"
[Reflow]
# Reflows doc comments to adhere to a given maximum line width limit.
max_line_length = 80
Version:
cargo spellcheck --version
cargo-spellcheck 0.13.1
Any assistance here would be greatly appreciated 🙏 Thanks!
Could you share the repository in question with me? Otherwise I'd recommend to find the particular file in question by running spell check on each file
@drahnr repo is: zksync-era
branch: dutterbutter-pla-646-add-spelling-linter-for-zksync-era-core-part-2
@drahnr alright I seem to have narrowed it down but I still don't see what is causing the crash in order for me to fix it. The issue is specifically when I run:
cargo spellcheck -vvv --cfg=../../../spellcheck/era.cfg . in this directory: https://github.com/matter-labs/zksync-era/tree/main/core/lib/multivm
However, if I run cargo-spellcheck inside each of the nested directories it does not crash?
Running with -vvv I see this now:
[2023-12-06T01:54:05Z DEBUG hunspell] Errorfunctionsel --{suggest}--> ["Perfunctorily"]
[2023-12-06T01:54:05Z INFO cargo_spellcheck::action] ✅ /Users/dustinbrickwood/Documents/dev/zk/zksync-era/core/lib/multivm/src/interface/types/errors/vm_revert_reason.rs
[2023-12-06T01:54:05Z DEBUG hunspell] stopreasonVmExec --{suggest}--> []
[2023-12-06T01:54:05Z DEBUG hunspell] Ocallstackdepth --{suggest}--> []
The application panicked (crashed).
Message: assertion failed: plain_range.start <= plain_range.end
Location: /Users/dustinbrickwood/.cargo/registry/src/index.crates.io-6f17d22bba15001f/doc-chunks-0.0.5/src/markdown.rs:363
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
[2023-12-06T01:54:05Z DEBUG hunspell] VmTracer --{suggest}--> []
Again, I don't see the issue but it could be staring at me in the face.
c4dc1e1d5b0e88cf22679aea46287b5725fcc9bc of the mentioned repo with your given command works for me using cargo-spellcheck 0.13.1 (or latest git).
I need a lot more context to dig into this. OS, version, git sha, the first lines of the cargo-spellcheck output to see your local options. Could you run with -j1.
Thanks @drahnr
Relevant info:
OS: MacOs 14.1.1 (Sonoma) Git Sha: 878fd2d Cargo-spellcheck version: cargo-spellcheck 0.13.1
As soon as I run cargo spellcheck --cfg=./spellcheck/era.cfg --code 1 I receive the panic so there is no output other than the provided error message.
I will try to run on a linux machine to see if its specific to my environment.
Also crashes on linux / CI :(
CI Job: https://github.com/dutterbutter/zksync-era/actions/runs/7116055857/job/19373574987?pr=2
It also seems to crash at different parts.
Your branch does trigger it, main does not.
~It's src/vm_instance.rs that triggers it.~
It turns out it only happens when run with a directory as argument, not a single file, single files don't trigger it. -j1 also does not trigger it. I run it on a 64 threads machine. It doesn't popup when using -vvvvv
@drahnr thanks for investigating. Truly appreciate it.
Can you elaborate on "-j1 also does not trigger it". When I run it with cargo spellcheck --cfg=./spellcheck/era.cfg --code 1 -j1 it still triggers a panic. I also tried running on 16 vCPU | 64 GB runner and it still triggered a panic.
CI reference: https://github.com/dutterbutter/zksync-era/actions/runs/7117204624/job/19377403555?pr=2 Workflow with command mentioned: https://github.com/dutterbutter/zksync-era/actions/runs/7117204624/workflow?pr=2#L25
RUST_BACKTRACE=1 cargo-spellcheck --cfg=../../../spellcheck/era.cfg --code 1 zksync-era/core/lib/multivm/src/versions/vm_m6/tests/bootloader.rs fails reproducibly
There is a space in line 328 in that file, after that the code is interpreted as text. Once that space is removed everything is fine. I'd recommend to comment out the mod bootloader; rather than commenting the entire file. cargo-spellcheck walks the module declration tree.
However, this is not a good reason for cargo-spellcheck to crash. It should never, regardless of input.
Thank you very much for your support here. Top notch for OS ❤️ Let me test on my side and then I can close accordingly.
👏 Thanks! Solves the issue as you described it.
Re-opening, it's not acceptable for cargo-spellcheck to crash and burn on a stray space.