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

hostname: use dns-lookup crate to get the network address(es) of the host #6546

Closed
lcheylus opened this issue Jul 7, 2024 · 0 comments · Fixed by #6550
Closed

hostname: use dns-lookup crate to get the network address(es) of the host #6546

lcheylus opened this issue Jul 7, 2024 · 0 comments · Fixed by #6550

Comments

@lcheylus
Copy link
Contributor

lcheylus commented Jul 7, 2024

On FreeBSD, MacOS and OpenBSD, hostname -i does not work:

$ target/debug/coreutils hostname -i
hostname: failed to resolve socket addresses: failed to lookup address information: no address associated with name

In src/uu/hostname/src/hostname.rs, there is a comment that proposes to use dns-lookup crate to do this DNS request (hostname -> IP addrs).

I have a local branch using dns-lookup crate for hostname -i => works on OpenBSD :)

$ uname -a
OpenBSD openbsd-dev.home.lan 7.5 GENERIC.MP#170 amd64

$ target/debug/coreutils hostname
openbsd-dev.home.lan
$ target/debug/coreutils hostname -i
10.0.2.15

Thus, I propose to use dns-lookup for hostname tool and to push a PR for it. Agree ?

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

Successfully merging a pull request may close this issue.

2 participants