Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Cargo sparse index files are served with CRLF line endings
-
Hello,
our ProGet Cargo feed (a connector to crates.io, used by Cargo as a sparse registry) serves the
sparse index files with CRLF line endings. crates.io serves the same files with LF line endings.Example: for the crate axum, the index file /ax/um/axum of the feed has 94 lines, and all 94
end with\r\n. The file from https://index.crates.io/ax/um/axum has the same 94 lines with
\n only.Now the problem is that the cargo index format does not specify anywhere, how the line breaks are handled. It only states that each version has a separate line in the file.
Cargo itself and
cargo-denyhandle the line breaks differently.- Cargo breaks at
\nand usesserde_jsonfor parsing the individual lines as json.serde_jsonhandles\ras whitespace and ignores it. cargo-denyusestame-indexto parse the index files. The problem here is, that it as well splits the lines at\n, but does not ignore the trailing\r.
The cached local index, that is maintained by
cargoand read bycargo-deny, does contain the index files just as produced by the source index and not the parsed and cleaned versions. This means the additional\rare present in the local cached index.This problem surfaced with the
cargo-deny 0.22.0update, that contained an update oftame-index.While the actual problem is a stricter reader on the
cargo-denyside, one could argue that ProGet should produce the index files just in the same way, as they provided by the upstream index.This is likely an easy fix on either side. I also created an but report for the
tame-indexlibrary: https://github.com/EmbarkStudios/tame-index/issues/129For completeness: I am currently running ProGet 2026.14.
Best regards,
Martin - Cargo breaks at
-
Hi @m.karing_2439,
Thanks for the detailed analysis of this; we investigated this a bit and found that the Cargo book does not seem to specify what line ending to use as this user states. From https://doc.rust-lang.org/cargo/reference/registry-index.html#index-files
Each version of the package has a separate line in the file.
The details are rather.... sparse. While this would be an absolutely trivial change to make on our end, we've learned the hard way that simple changes like this can cause big problems like the feed just breaking. Not too long ago, the smallest change we made to the PyPI API broke the
uvclient for whatever reason. Anyway.... it's just not something users expect in a maintenance release.We are not CARGO users and don't really know the inner workings of this, and would hate for this to have some kind of weird unexpected outcome. But it "seems" to work now, just not in the
cargo-deny 0.22.0(ortame-index) side of things.Since the specification is unclear (and it seems to be a relatively new package), I wonder imagine it's just as trivial of a change for that library to work with both types.
Either way, it's something we can easily do in a major release (everyone expects everything to break anyway)... but if it's a challenge to get that changed on the client side, we can also try to explore a maintenance release solution.
Thanks,
Alana
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login