Relative --config-file panics in debug builds and skips the config in release builds

Open Beginner friendly
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Start in crates/bumpversion/src/lib.rs near line 718, where config_path is asserted to be absolute and checked against working_dir. Reproduce with a relative --config-file such as sub/.bumpversion.toml; verify both debug and release behavior. Done when the config path is resolved against the current directory and the config and version files advance together.

Written by the indexing model from the issue text.

Description

bug

A relative --config-file breaks the bump:

$ # repository with sub/.bumpversion.toml (current_version = "1.0.0", files = [VERSION])
$ bumpversion --config-file sub/.bumpversion.toml patch
The application panicked (crashed).
Message:  assertion failed: config_path.is_absolute()
Location: crates/bumpversion/src/lib.rs:718

A debug build panics on the debug_assert!, after VERSION has already been rewritten to 1.0.1. In a release build the assertion is gone, and config_path.starts_with(working_dir) is false for the relative path, so the config's own current_version is silently left at 1.0.0 while the files move on. The next bump then starts from the wrong version.

An absolute path works. Expected: resolve --config-file against the current directory before using it.

Dominant language
Rust
Stars
1
Forks
0
Avg merge
12m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from romnn/bumpversion

All issues in romnn/bumpversion

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.