Closed alexcrichton closed 7 years ago
Suggestions for how this would handle yanking every version of a crate (e.g. publish a crate for the first time accidentally and then yank it, leaving no valid version at all)?
That's a good question! I think that the returned value would just be null
in that case as we just won't have a maximum version available.
Right now, this bug makes it look like the Rust url crate is completely gone, leaving a big hole in the ecosystem. Apparently, this is not the case, but I was badly confused by it the other day.
I just published url 0.4.0 to avoid confusion until this is fixed. It’s identical to 0.2.38, which is not compatible with 0.3.0 which was yanked. When the change from 0.3.0 lands again it’ll be 0.5.0. Version numbers are cheap.
Surprising this issue has been around so long. Poor crates.io!
Poor crates.io indeed! Let's get this issue on the mentored list :)
Here's how I see the fix for this going:
yank
parameter, respectively), add code to update the crate record's max_version value in the database.yank
is false (meaning we're doing an unyank), the code can do something very similar to this code in krate.rs that updates the max_version if the vers
we're unyanking is greater than the value in max_version
.yank
is true (meaning we're doing a yank), AND the crate's max_version is equal to the version being yanked, then we need to look up the next highest version number and set the crate max_version to that.
SELECT num FROM versions WHERE crate_id=(this crate's id) AND id != (the version id that we're yanking
, then parse them as semver::Version
s and sort them in Rust, then use the maximum one.And also tests, we should have tests for each of these cases. This is sounding like a medium.
And don't forget to update all the existing cases where max_version
is currently yanked.
Has anyone started work on this? If not, I would like to volunteer.
One situation that has not been covered is if the version being yanked is the last unyanked version. Should the max version be set to zero, the current version, or the max yanked version?
@yodaldevoid Is this earlier comment not sufficient?
@retep998 Ah, thank you for reminding me of that. Guess I should take a short break if I am missing a comment in a set of 11 comments.
We decided to remove the max_version column instead, in #592.
If a crate has its max version yanked, it should update the max_version field to go back to the otherwise maximum version.