MDEV-39169: Replace deprecated network functions in resolveip (testfix 2) - #5528
Merged
Conversation
…x 2) Problem: The test piped resolveip through sed patterns that rewrote its failure message into the expected success line, and the pipe also discarded the exit status - the test could not fail. Removing the masking exposes the real issue: reverse lookup results are OS dependent. The name of ::1 differs per system, and ::ffff:127.0.0.1 has a name on glibc and musl (which map it to 127.0.0.1) but none on macOS. The suite.pm check bound a socket to the address, which asks the kernel, not the resolver: it fails under net.ipv6.bindv6only=1 where the lookup works and succeeds on macOS where it doesn't. Fix: Split the test in two: - main/resolveip.test: deterministic cases, never skips. Lookup failures are pinned with addresses that resolve nowhere (192.0.2.1, nonexistent.invalid), checking the exit status and that IPv4-mapped literals take the reverse-lookup path on every OS. - main/resolveip_lookup.test: the reverse lookups. A perl probe resolves the three loopback addresses with the same call resolveip makes, getnameinfo(NI_NAMEREQD), skips unless all have names, and returns the names so the test requires them exactly. Output is normalized with replace_result/replace_regex instead of pipes, keeping the exit status checked. Co-Authored-By: Claude Fable 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes
resolveiptest failures after MDEV-39169Problem:
The test piped
resolveipthroughsedpatterns that rewrote its failure message into the expected success line, and the pipe also discarded the exit status - the test could not fail. Removing the masking exposes the real issue: reverse lookup results are OS dependent. The name of::1differs per system, and::ffff:127.0.0.1has a name on glibc and musl (which map it to127.0.0.1) but none on macOS.The suite.pm check bound a socket to the address, which asks the kernel, not the resolver: it fails under net.ipv6.bindv6only=1 where the lookup works and succeeds on macOS where it doesn't.
Fix:
Split the test in two:
main/resolveip.test: deterministic cases, never skips. Lookup failures are pinned with addresses that resolve nowhere (
192.0.2.1, nonexistent.invalid), checking the exit status and that IPv4-mapped literals take the reverse-lookup path on every OS.main/resolveip_lookup.test: the reverse lookups. A perl probe resolves the three loopback addresses with the same call resolveip makes, getnameinfo(NI_NAMEREQD), skips unless all have names, and returns the names so the test requires them exactly.
Output is normalized with replace_result/replace_regex instead of pipes, keeping the exit status checked.