Skip to content

bug: just lint / harper-cli crash on markdown hex test file - debug build only #545

Closed
@hippietrail

Description

@hippietrail

Describe the bug
just lint crashes on a .md file I created to test a hexadecimal number lexer on.

To Reproduce
Steps to reproduce the behavior:

  1. Download the markdown file hex.md linked below.
  2. Go to the terminal
  3. Enter just lint <path to hex.md>
  4. See error
  5. run with RUST_BACKTRACE=1 environment variable to display a backtrace

hex.md

On delving further, in a new clone of the repo, I discovered building and running as release from cargo works fine:
cargo run --release --bin harper-cli lint ~/harper-test/hex.md

But regular builds from cargo crash just as with just lint
cargo run --bin harper-cli lint ~/harper-test/hex.md

Expected behavior
Perhaps linting errors for each hex number.

Platform
Running from the Mac commandline

Additional context
Backtrace:

% just lint ../harper-test/hex.md
cargo run --bin harper-cli -- lint ../harper-test/hex.md
warning: /Users/hippietrail/harper/harper-wasm/Cargo.toml: unused manifest key: package.private
warning: /Users/hippietrail/harper/harper-cli/Cargo.toml: unused manifest key: package.private
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.30s
     Running `target/debug/harper-cli lint ../harper-test/hex.md`
thread 'main' panicked at harper-core/src/span.rs:100:9:
attempt to subtract with overflow
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:76:14
   2: core::panicking::panic_const::panic_const_sub_overflow
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:182:21
   3: harper_core::span::Span::pulled_by
             at ./harper-core/src/span.rs:100:9
   4: <harper_core::linting::correct_number_suffix::CorrectNumberSuffix as harper_core::linting::Linter>::lint
             at ./harper-core/src/linting/correct_number_suffix.rs:14:31
   5: <harper_core::linting::lint_group::LintGroup<T> as harper_core::linting::Linter>::lint
             at ./harper-core/src/linting/lint_group.rs:136:47
   6: harper_cli::main
             at ./harper-cli/src/main.rs:61:29
   7: core::ops::function::FnOnce::call_once
             at /Users/hippietrail/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: Recipe `lint` failed on line 244 with exit code 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions