nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

`cargo install-update -l` fails with `fatal: unable to connect to github.com` #217

Closed amberisvibin closed 1 year ago

amberisvibin commented 1 year ago

I have installed cargo-update as normal, but when I run cargo install-update -l it returns with:

Updating registry 'git://github.com/rust-lang/crates.io-index.git'
fatal: unable to connect to github.com:
github.com[0: 140.82.112.3]: errno=Connection timed out

Failed to update index repository: exit status: 128.

my rust version is stable-x86_64-unknown-linux-gnu 1.67.0 (fc594f156 2023-01-24)

The dependency versions are: libgit2-dev 1.3.2+dfsg.1-0ubuntu1 libssh-dev 0.9.6-2build1 libssl-dev 3.0.5-2ubuntu2 pkg-config 0.29.2-1ubuntu3

I am running Ubuntu 22.10 on kernel version 5.19.0-29.

amberisvibin commented 1 year ago

My bad, misclick

nabijaczleweli commented 1 year ago

As a quick test, can you try re-trying after echo 'net.git-fetch-with-cli = true' >> ~/.cargo/config.toml? Do you have anything special configured in your git or cargo config?

amberisvibin commented 1 year ago

alright it caused this error:

warning: Both `/home/amber/.cargo/config` and `/home/amber/.cargo/config.toml` exist. Using `/home/amber/.cargo/config`

looking at my ~/.cargo/config it has:

[net]
git-fetch-with-cli = true

[source.crates-io]
registry = "git://github.com/rust-lang/crates.io-index.git"

I deleted the config.toml file to resolve the error as the config file had the same option. when I run git config --list I get:

credential.https://github.com.helper=
credential.https://github.com.helper=!/usr/bin/gh auth git-credential
credential.https://gist.github.com.helper=
credential.https://gist.github.com.helper=!/usr/bin/gh auth git-credential

as I am using gh for github auth. I checked my auth status and it's good, but it shouldnt need auth to pull a repo. I tried commenting those lines out and it made no difference.

nabijaczleweli commented 1 year ago

That's bizarre. Are you sure that's a valid URL? Because git ls-remote git://github.com/rust-lang/crates.io-index.git straces to

17:42:20 poll([{fd=3, events=POLLIN}], 1, 4998) = 1 ([{fd=3, revents=POLLIN}])
17:42:20 ioctl(3, FIONREAD, [44])       = 0
17:42:20 recvfrom(3, "\210\211\201\200\0\1\0\1\0\0\0\0\6github\3com\0\0\1\0\1\300\f\0\1"..., 65536, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [28 => 16]) = 44
17:42:20 close(3)                       = 0
17:42:20 socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
17:42:20 connect(3, {sa_family=AF_INET, sin_port=htons(9418), sin_addr=inet_addr("140.82.121.4")}, 16

sleeps in the connect, then ends with

17:42:20 connect(3, {sa_family=AF_INET, sin_port=htons(9418), sin_addr=inet_addr("140.82.121.4")}, 16) = -1 ETIMEDOUT (Connection timed out)
17:44:31 openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 4
...
17:44:31 write(2, "fatal: unable to connect to gith"..., 97fatal: unable to connect to github.com:
github.com[0: 140.82.121.4]: errno=Connection timed out

) = 97
17:44:31 exit_group(128)                = ?
17:44:31 +++ exited with 128 +++

So I'm tempted to say this is expected (I'd be surprised if github supported the git: protocol, frankly). Using http:// instead works for me, so what if you tried that?

amberisvibin commented 1 year ago

Oh, that fixed it. strange. I don't know how that option got set to git://. Cargo itself worked fine with that, I wonder if it uses that same config file.

nabijaczleweli commented 1 year ago

Even if latest cargo doesn't, then previous cargo used to, presumably? Closing as works-as-expected.