Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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

    Scheduled Pinned Locked Moved Support
    cargoconnectors
    2 Posts 2 Posters 2 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      m.karing_2439
      last edited by

      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-deny handle the line breaks differently.

      • Cargo breaks at \n and uses serde_json for parsing the individual lines as json. serde_json handles \r as whitespace and ignores it.
      • cargo-deny uses tame-index to 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 cargo and read by cargo-deny, does contain the index files just as produced by the source index and not the parsed and cleaned versions. This means the additional \r are present in the local cached index.

      This problem surfaced with the cargo-deny 0.22.0 update, that contained an update of tame-index.

      While the actual problem is a stricter reader on the cargo-deny side, 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-index library: https://github.com/EmbarkStudios/tame-index/issues/129

      For completeness: I am currently running ProGet 2026.14.

      Best regards,
      Martin

      atrippA 1 Reply Last reply Reply Quote
      • atrippA Offline
        atripp inedo-engineer @m.karing_2439
        last edited by

        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 uv client 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 (or tame-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

        1 Reply Last reply Reply Quote

        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
        • 1 / 1
        • First post
          Last post
        Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation