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

Update bitflags to latest version #2352

Closed

Conversation

neumann-paulmann
Copy link

What does this PR do

Update dependency of bitflags to latest release to avoid duplicate crate versions in serialport.

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly, this PR combines formatting changes with content changes. Don't do that. Secondly, instead of requiring the latest bitflags, can you relax the range? Maybe make the requirement "2.3" instead? That would allow cargo to choose anything from 2.3.0 or later, but not 3.0 .

@neumann-paulmann
Copy link
Author

Sorry about the formatting changes. I assumed this project would use cargo fmt like most other projects.
Can you please point me to the code style guidelines so that I can configure my code formatter accordingly?
I will then draft a new PR with a relaxed dependency. Should this be 2.3 or 2.5 then?

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks better. Can you confirm that with this setting, cargo will let you do either cargo update -p bitflags --precise 2.3.1 or cargo update -p bitflags --precise 2.5.0? And can you please squash your commits?

As for style settings, they're right in rustfmt.toml. But they aren't applied to Cargo.toml, only to .rs files.

Finally, you should probably add a "added" entry in the changelog dir.

@neumann-paulmann
Copy link
Author

Thank you for the hint.
Alas, both commands fail:

~/RustroverProjects/nix> cargo update -p bitflags --precise 2.3.1
error: There are multiple `bitflags` packages in your project, and the specification `bitflags` is ambiguous.
Please re-run this command with one of the following specifications:
  [email protected]
  [email protected]
~/RustroverProjects/nix> cargo update -p bitflags --precise 2.5.0
error: There are multiple `bitflags` packages in your project, and the specification `bitflags` is ambiguous.
Please re-run this command with one of the following specifications:
  [email protected]
  [email protected]
~/RustroverProjects/nix>                         

@asomers
Copy link
Member

asomers commented Apr 2, 2024

Thank you for the hint. Alas, both commands fail:

~/RustroverProjects/nix> cargo update -p bitflags --precise 2.3.1
error: There are multiple `bitflags` packages in your project, and the specification `bitflags` is ambiguous.
Please re-run this command with one of the following specifications:
  [email protected]
  [email protected]
~/RustroverProjects/nix> cargo update -p bitflags --precise 2.5.0
error: There are multiple `bitflags` packages in your project, and the specification `bitflags` is ambiguous.
Please re-run this command with one of the following specifications:
  [email protected]
  [email protected]
~/RustroverProjects/nix>                         

That means that you have some other dependency pulling in bitflags-1.3.2. In that case, modify the commands I posted to specify the exact version of bitflags that you want to update, like this for example: cargo update -p [email protected] --precise 2.5.0

@neumann-paulmann
Copy link
Author

neumann-paulmann commented Apr 3, 2024

Hi. Thank you for being patient with me.

~/RustroverProjects/nix> cargo update -p bitflags@2.3.1 --precise 2.5.0                                                                                                                                                         2024-04-03T08:42:29
error: package ID specification `bitflags@2.3.1` did not match any packages
Did you mean one of these?

  bitflags@1.3.2
  bitflags@2.5.0
~/RustroverProjects/nix>                    

From my original project:

│   └── serialport v4.3.0
│       ├── bitflags v2.5.0
│       ├── cfg-if v1.0.0
│       ├── libudev v0.3.0
│       │   ├── libc v0.2.153
│       │   └── libudev-sys v0.1.4
│       │       └── libc v0.2.153
│       │       [build-dependencies]
│       │       └── pkg-config v0.3.30
│       ├── nix v0.26.4
│       │   ├── bitflags v1.3.2
│       │   ├── cfg-if v1.0.0
│       │   └── libc v0.2.153

As you can see, the pulled-in dependency by nix to bitflags 1.3.2 is really the issue here, while 2.3.1 appears to be updated to 2.5.0 without any issues already.
I honestly have no idea, where 1.3.2 is coming from.

Update:
Okay. So the issue really appears to be serialport itself, which uses an outdated version of nix.
If I update nix from 0.26 to 0.28 there, the multiple-version issue is gone.

This can be closed. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants