Skip to content

Panic with invalid reference on gix-0.70.0/src/revision/spec/parse/error.rs:108 #1914

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

Closed
35VLG84 opened this issue Mar 30, 2025 · 1 comment · Fixed by #1916
Closed

Panic with invalid reference on gix-0.70.0/src/revision/spec/parse/error.rs:108 #1914

35VLG84 opened this issue Mar 30, 2025 · 1 comment · Fixed by #1916
Assignees
Labels
acknowledged an issue is accepted as shortcoming to be fixed

Comments

@35VLG84
Copy link

35VLG84 commented Mar 30, 2025

Current behavior 😯

Calling gix::repository::revision::rev_parse_single with invalid reference will cause panic in Gix:

For example, with references:

  • ^^^HEAD
  • ^^^
thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/revision/spec/parse/error.rs:108:9:
assertion failed: !errors.is_empty()
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/std/src/panicking.rs:692:5
   1: core::panicking::panic_fmt
             at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/panicking.rs:75:14
   2: core::panicking::panic
             at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/panicking.rs:145:5
   3: gix::revision::spec::parse::error::<impl gix::revision::spec::parse::types::Error>::from_errors
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/revision/spec/parse/error.rs:108:9
   4: gix::revision::spec::parse::delegate::<impl gix::revision::spec::parse::Delegate>::into_err
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/revision/spec/parse/delegate/mod.rs:44:9
   5: gix::revision::spec::parse::<impl gix::revision::Spec>::from_bstr
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/revision/spec/parse/mod.rs:37:48
   6: gix::repository::revision::<impl gix::types::Repository>::rev_parse
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/repository/revision.rs:16:9
   7: gix::repository::revision::<impl gix::types::Repository>::rev_parse_single
             at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/repository/revision.rs:34:9
   8: tackler_core::parser::tackler_txns::git_to_txns
             at ./tackler-core/src/parser/tackler_txns.rs:83:22
   9: tackler::run
             at ./tackler-cli/src/main.rs:59:13
  10: tackler::main
             at ./tackler-cli/src/main.rs:147:35
  11: core::ops::function::FnOnce::call_once
             at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/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.

Expected behavior 🤔

With bad references, gix::repository::revision::rev_parse_single & co. should return error as they normally do.

Git behavior

$ git --version
git version 2.48.1

$ git show '^^^HEAD'
fatal: bad revision '^^^HEAD'

$ git show ^^^
fatal: bad revision '^^^'

Steps to reproduce 🕹

  1. Call gix::repository::revision::rev_parse_single with bad reference

Original triggering test case:

Original test data repository - but this doesn't seem to be related to the repository data, as it's reference parsing issue.

Tacker Test Suite: Git error path tests

Tackler GIX repository code - @Byron has very kindly looked this code already in the past, so the calling code should be ok, and it works just fine in normal cases (with syntactically valid references).

@Byron Byron added the acknowledged an issue is accepted as shortcoming to be fixed label Mar 30, 2025
@Byron Byron self-assigned this Mar 30, 2025
@Byron
Copy link
Member

Byron commented Mar 30, 2025

Thanks a lot for reporting, I will take care of that.

This one should be easy to test for and subsequently fix.

@Byron Byron mentioned this issue Mar 31, 2025
35VLG84 added a commit to tackler-ng/tackler that referenced this issue Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged an issue is accepted as shortcoming to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants