-
Notifications
You must be signed in to change notification settings - Fork 425
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
Do not fail parse_resolv_conf on invalid hostname #1740
Do not fail parse_resolv_conf on invalid hostname #1740
Conversation
On macOS, user's can set their hostname to something invalid such as matt.schulte's macbookpro. This will cause parse_resolv_conf to fail because "into_resolver_config" will think the hostname contains the system domain and then fail to parse that system domain. Instead, we should treat the hostname as if it contains no domain (the same as if the hostname contained no ".".
d59a8ba
to
ce230c4
Compare
If I’m understanding the change here, we’re ignoring a malformed name. I guess I don’t know what we want in that case. Im a little surprised that Apple doesn’t escape those strings. |
@bluejekyll windows doesn't either iirc |
That's correct but I look at it a little differently. I would say we are treating malformed names the same way we are treating names without a "." in them. So if your hostname is "mattscomputer" or "matt's computer", or "matt.schulte's computer" this now treats them all the same way. Previously, "mattscomputer" or "matt's computer" would result in |
Would you have time to add a test (with some documentation) to that effect? I’m ok with merging this, but I worry that we might regress this in the future as it’s not an obvious case we’re trying to support. Thanks for the explanation and the PR! |
Future regressions are a good point. I can add some documentation but unfortunately I'm not sure if there is a minimal way to add testing here. The |
@djc any reason this isn't merged? |
On macOS, user's can set their hostname to something invalid such as
matt.schulte's macbookpro. This will cause parse_resolv_conf to fail
because "into_resolver_config" will think the hostname contains the
system domain and then fail to parse that system domain.
Instead, we should treat the hostname as if it contains no domain (the
same as if the hostname contained no ".").
This fixes #1739