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

cargo install --git accepts malformed URL with #, discards it for cloning, then re-adds it into crates.toml #15336

Open
nabijaczleweli opened this issue Mar 20, 2025 · 1 comment
Labels
A-git Area: anything dealing with git C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@nabijaczleweli
Copy link
Contributor

Problem

Downstream report: nabijaczleweli/cargo-update#293 (comment)

Steps

  1. cargo install --git https://github.com/simonrupf/convert2json.git#65d1408a46668787ba34bf10134ac767c5035710
  2. grep convert2json ~/.cargo/crates.toml
  3. "convert2json 1.1.6 (git+https://github.com/simonrupf/convert2json.git#65d1408a46668787ba34bf10134ac767c5035710#74a150d03308dee5a084469ca57623e62560b60b)" = [

Possible Solution(s)

Either parse the "anchor" as the rev or don't discard it, since cloning a URL like this is actually illegal

$ git clone https://github.com/simonrupf/convert2json.git#65d1408a46668787ba34bf10134ac767c5035710
Cloning into 'convert2json.git#65d1408a46668787ba34bf10134ac767c5035710'...
fatal: unable to update url base from redirection:
  asked for: https://github.com/simonrupf/convert2json.git#65d1408a46668787ba34bf10134ac767c5035710/info/refs?service=git-upload-pack
   redirect: https://github.com/simonrupf/convert2json

Notes

No response

Version

cargo 1.85.1 (d73d2caf9 2024-12-31) I think, the original reporter didn't say.
@nabijaczleweli nabijaczleweli added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Mar 20, 2025
@rickhg12hs
Copy link

Original reporter here:

$ cargo --version
cargo 1.85.1 (d73d2caf9 2024-12-31)

@epage epage added the A-git Area: anything dealing with git label Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants