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 #6550

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

lcheylus
Copy link
Contributor

@lcheylus lcheylus commented Jul 7, 2024

  • Use dns-lookup crate to get the network address(es) of the host => fix error for this DNS request on FreeBSD and OpenBSD
  • Enable test test_hostname_ip for FreeBSD and OpenBSD

Fix #6546


Build and tests OK on OpenBSD/amd64 and Debian testing/amd64

$ 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

$ cargo nextest run --no-fail-fast --no-default-features --features "unix" -E 'test(test_hostname)'
  (...)
      Finished `test` profile [unoptimized + debuginfo] target(s) in 2m 12s
      Starting 4 tests across 3 binaries (3341 skipped; run ID: d4397d4d-78a5-4b72-a7b7-fbca7ebb02e1, nextest profile: default)
          PASS [   0.102s] coreutils::tests test_hostname::test_hostname
          PASS [   0.147s] coreutils::tests test_hostname::test_hostname_full
          PASS [   0.070s] coreutils::tests test_hostname::test_hostname_ip
          PASS [   0.061s] coreutils::tests test_hostname::test_invalid_arg
  ------------
       Summary [   0.319s] 4 tests run: 4 passed, 3341 skipped

Copy link

github-actions bot commented Jul 7, 2024

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

@lcheylus lcheylus force-pushed the hostname-dns-lookup branch 2 times, most recently from 84181c5 to bf83b7d Compare July 7, 2024 17:56
@sylvestre
Copy link
Sponsor Contributor

i would prefer to avoid adding a new dependency for all platforms if this isn't needed.
could you please make this dependency platform specific ? thanks

@lcheylus
Copy link
Contributor Author

lcheylus commented Jul 8, 2024

OK, dependency on dns-lookup crate added to use it only on FreeBSD and OpenBSD + keep the original code on the other platforms.

@lcheylus lcheylus force-pushed the hostname-dns-lookup branch 2 times, most recently from ac40e84 to 7fca585 Compare July 8, 2024 07:14
Copy link

github-actions bot commented Jul 8, 2024

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

…host

- on OpenBSD and FreeBSD, unable to get the network address(es) of the host with DNS request for
  hostname + ":1"
- use dns-lookup crate for this request with lookup_host function

Signed-off-by: Laurent Cheylus <[email protected]>
@sylvestre sylvestre merged commit c3a3370 into uutils:main Jul 9, 2024
64 of 68 checks passed
@lcheylus lcheylus deleted the hostname-dns-lookup branch July 9, 2024 23:39
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

Successfully merging this pull request may close these issues.

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