Bug 2039854 - getaddrinfo for empty hostname returns unexpected error
Summary: getaddrinfo for empty hostname returns unexpected error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-12 14:43 UTC by Tom Deseyn
Modified: 2022-04-10 19:52 UTC (History)
12 users (show)

Fixed In Version: systemd-249.11-1.fc35
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-04-10 19:52:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tom Deseyn 2022-01-12 14:43:26 UTC
Description of problem:

Calling getaddrinfo for an empty hostname returns an unexpected error.

Version-Release number of selected component (if applicable):

Fedora Rawhide

Steps to Reproduce:

```
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <stdio.h>

int main() {
   struct addrinfo* info;
   struct addrinfo hint;
   memset(&hint, 0, sizeof(struct addrinfo));
   hint.ai_flags = AI_CANONNAME;
   hint.ai_family = AF_INET;

   int result = getaddrinfo("", NULL, &hint, &info);
   if (result != 0) {
     fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(result));
   }
   return result;
}
```

Actual results:

```
result is 253: getaddrinfo: Temporary failure in name resolution
```

Expected results:

```
result is 254: getaddrinfo: Name or service not known
```

Comment 1 Tom Deseyn 2022-01-20 15:44:46 UTC
Can someone please take a look at this issue?

I've assigned it to systemd, but the cause may be elsewhere in the name resolution.

The issue causes a .NET test (https://github.com/dotnet/runtime/) to fail on Rawhide.

Thanks, Tom

Comment 2 Yu Watanabe 2022-01-20 18:21:12 UTC
I created a PR for this issue in upstream: https://github.com/systemd/systemd/pull/22197

Comment 3 Yu Watanabe 2022-01-23 21:49:51 UTC
The previous PR is already merged, but will be replaced by https://github.com/systemd/systemd/pull/22231

Comment 4 Tom Deseyn 2022-02-07 12:18:52 UTC
Thanks for fixing the issue.

Since last week, the issue is also appearing in our Fedora 35 CI VM. Previously it was only on Rawhide.

Comment 5 Ben Cotton 2022-02-08 20:09:21 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 6 Fedora Update System 2022-04-06 20:26:55 UTC
FEDORA-2022-423231bb82 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-423231bb82

Comment 7 Fedora Update System 2022-04-07 16:01:01 UTC
FEDORA-2022-423231bb82 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-423231bb82`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-423231bb82

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2022-04-10 19:52:33 UTC
FEDORA-2022-423231bb82 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.