You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that somewhat recently cargo metadata changed the format of the package_id field in its JSON output (presumably rust-lang/cargo#12914). Significantly, this changed the way that packages are sorted in internal data structures, such that while previously crate 1.1.1 and crate 1.1.1@git:XXX would have sorted adjacent to one-another, they now sort further apart.
// Sort the nodes by package_id to make the graph more stable and to make
// anything sorted by package_idx to also be approximately sorted by name and version.
nodes.sort_by_key(|k| k.package_id);
The new format for this field is a PackageIdSpec, which is supposedly going to be a more stable format going forwards. This format change also will have broken one case where we did inspect the internal format of the PackageId (despite it being documented as opaque).
/// Don't serialize path package ids, not stable across systems
fnpkgid_unstable(pkgid:&PackageId) -> bool{
pkgid.repr.contains("(path+file:/")
}
The file URI in this case now looks more like path+file:///path/to/example#0.1.0 rather than example 0.1.0 (path+file:///path/to/example), so will no longer match the contains check.
In order to keep tests passing with both older and newer versions of rustc, we'll likely need to tweak how we sort packages to avoid using package_id for sorting when possible. In addition, there are some commands where the output contains the package id, specifically the dump-graph test, which will likely need to be updated in some way - likely by removing the unstable PackageId check, and instead never serializing package IDs.
The text was updated successfully, but these errors were encountered:
mystor
added a commit
to mystor/cargo-vet
that referenced
this issue
Apr 1, 2024
In rust-lang/cargo#12914, the format used for
PackageId strings in cargo metadata was changed. This led to a number of
test failures due to the ordering of nodes when logging graphs changing
relative to earlier versions of cargo.
To work around this issue, the ordering of nodes in the graph was
changed to be based on package name and version explicitly, rather than
implicitly through the PackageId string. This slightly changes the
ordering of some crates in outputs.
In addition, in order to keep tests passing across all versions, the
package_id member has been hidden from the JSON graph dump output. This
field was already missing for path dependencies.
Fixesmozilla#602
It appears that somewhat recently
cargo metadata
changed the format of thepackage_id
field in its JSON output (presumably rust-lang/cargo#12914). Significantly, this changed the way that packages are sorted in internal data structures, such that while previouslycrate 1.1.1
andcrate 1.1.1@git:XXX
would have sorted adjacent to one-another, they now sort further apart.cargo-vet/src/resolver.rs
Lines 452 to 454 in abb7411
The new format for this field is a
PackageIdSpec
, which is supposedly going to be a more stable format going forwards. This format change also will have broken one case where we did inspect the internal format of thePackageId
(despite it being documented as opaque).cargo-vet/src/resolver.rs
Lines 214 to 217 in abb7411
The file URI in this case now looks more like
path+file:///path/to/example#0.1.0
rather thanexample 0.1.0 (path+file:///path/to/example)
, so will no longer match thecontains
check.In order to keep tests passing with both older and newer versions of rustc, we'll likely need to tweak how we sort packages to avoid using
package_id
for sorting when possible. In addition, there are some commands where the output contains the package id, specifically the dump-graph test, which will likely need to be updated in some way - likely by removing the unstable PackageId check, and instead never serializing package IDs.The text was updated successfully, but these errors were encountered: