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

Topgrade panics when trying to update nix packages on a pre-release version of nix #956

Open
2 of 4 tasks
lapkowski opened this issue Oct 16, 2024 · 3 comments
Open
2 of 4 tasks
Labels
C-bug Something isn't working

Comments

@lapkowski
Copy link

Erroneous Behavior

Topgrade panics when trying to update nix packages on a pre-release version of nix (in this case 2.25.0pre20240920_ca3fc169) with the following message:

Message:  invalid version: Error("unexpected character 'p' after patch version number")
Location: src/steps/os/unix.rs:455

Expected Behavior

Topgrade should parse the version string with the pre(..) suffix and update the packages.

Steps to reproduce

  1. Install a pre-release version of nix.
  2. Run topgrade to update nix packages.

Possible Cause (Optional)

The nix --version parser passes a version string with the pre(...) suffix to Version::parse, but it needs a x.x.x-pre(...) syntax to parse properly (according to Version::parse documentation)

Problem persists without calling from topgrade

  • Yes
  • No

Did you run topgrade through Remote Execution

  • Yes
  • No

Additional Details

  • Operation System/Version

Debian 12 Bookworm

  • Installation

Nix package manager

  • Topgrade version (topgrade -V)
    16.0.0

Verbose Output (topgrade -v)

DEBUG Step "nix"
DEBUG Detected "/home/USER/.nix-profile/bin/nix" as "nix"
DEBUG Detected "/home/USER/.nix-profile/bin/nix-channel" as "nix-channel"
DEBUG Detected "/home/USER/.nix-profile/bin/nix-env" as "nix-env"
DEBUG nix profile: "/home/USER/.nix-profile"

── 09:46:25 - Nix ──────────────────────────────────────────────────────────────
DEBUG Executing command /home/USER/nix-profile/bin/nix-channel --update
unpacking 2 channels...
DEBUG Executing command /home/USER/.nix-profile/bin/nix --version
The application panicked (crashed).
Message: invalid version: Error("unexpected character 'p' after patch version number")
Location: src/steps/os/unix.rs:455

@lapkowski lapkowski added the C-bug Something isn't working label Oct 16, 2024
@SteveLauC
Copy link
Member

Thanks for the bug report and digging possible root cause!

I am thinking maybe we can just trim the prexxx part and pass the remaining part to Version::parse(), then we treat pre-releases just like normal nix🤔

@lapkowski
Copy link
Author

I think semver just treats -pre* as a boolean, so it wouldn't make any diffrence, and unix.rs just uses the version string to make sure it is above 2.21 so it should be fine.

@SteveLauC
Copy link
Member

I think semver just treats -pre* as a boolean, so it wouldn't make any difference

Get it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants