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

cinnabarclone.t: unexpected error message #340

Open
riastradh opened this issue Dec 5, 2024 · 1 comment
Open

cinnabarclone.t: unexpected error message #340

riastradh opened this issue Dec 5, 2024 · 1 comment

Comments

@riastradh
Copy link

0.7.0beta2 with curl-8.11.0 on NetBSD 9

--- cinnabarclone.t
+++ cinnabarclone.t.err
@@ -110,7 +110,7 @@
   Cloning into 'repo-git'...
   Fetching cinnabar metadata from http://localhost:8080/
   \r (no-eol) (esc)
-  ERROR unable to access 'http://localhost:8080/': Failed to connect to localhost port 8080.* (re)
+  ERROR unable to access 'http://localhost:8080/': getsockname() failed with errno 22: Invalid argument
   \r (no-eol) (esc)
   WARNING Falling back to normal clone.

It looks like the string Failed to connect might come from here:

git-cinnabar/src/main.rs

Lines 856 to 857 in 4028262

let mut conn = hg_connect::get_connection(&hg_url)
.ok_or_else(|| format!("Failed to connect to {}", hg_url))?;

Plausible source of the getsockname error is from curl in this logic:

    if(getsockname(ctx->sock, (struct sockaddr*) &ssloc, &slen)) {
      int error = SOCKERRNO;
      failf(data, "getsockname() failed with errno %d: %s",
            error, Curl_strerror(error, buffer, sizeof(buffer)));
      return CURLE_FAILED_INIT;
    }

https://github.com/curl/curl/blob/b1ef0e1a01c0bb6ee5367bd9c186a603bde3615a/lib/cf-socket.c#L1064-L1069

It seems that if connect() on a non-blocking socket is refused, connect() fails with EINPROGRESS everywhere whereas subsequent getsockname() succeeds with an all-zero sockaddr on Linux but fails with EINVAL on NetBSD.

(I have not yet determined whether this is a bug in the test, a bug in curl, or a bug in NetBSD/Linux; I'm just writing this down to create an initial record that can be searched and referenced.)

@riastradh
Copy link
Author

NetBSD issue with simple reproducer of the Linux/NetBSD distinction: https://gnats.NetBSD.org/58874

(Still haven't determined whether there is a bug here or whose bug it is, just recording observations for future reference and investigation.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant