Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
3352-Fix-option-nxdomain_reply-misspelling.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3352-Fix-option-nxdomain_reply-misspelling.patch of Package erlang
From 043911a7dbe761fc50e024b4694846dc456bf0c9 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Wed, 10 Mar 2021 10:27:27 +0100 Subject: [PATCH 2/2] Fix option nxdomain_reply misspelling Also, clean up the code a bit, and make the new test case run when the suite is run. --- lib/kernel/src/inet_res.erl | 21 ++++++++++----------- lib/kernel/test/inet_res_SUITE.erl | 16 +++++++++------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl index 536b5abccc..9da5c818f1 100644 --- a/lib/kernel/src/inet_res.erl +++ b/lib/kernel/src/inet_res.erl @@ -263,8 +263,10 @@ do_nslookup(Name, Class, Type, Opts, Timeout) -> %% options record %% -record(options, { % These must be sorted! - alt_nameservers,edns,inet6,nameservers,nxdomain_reply,recurse, - retry,servfail_retry_timeout,timeout,udp_payload_size,usevc, + alt_nameservers,edns,inet6,nameservers, + nxdomain_reply, % this is a local option, not in inet_db + recurse,retry,servfail_retry_timeout,timeout, + udp_payload_size,usevc, verbose}). % this is a local option, not in inet_db %% %% Opts when is_list(Opts) -> #options{} @@ -299,13 +301,9 @@ make_options(Opts0) -> make_options([_|_]=Opts0, []=Names0) -> erlang:error(badarg, [Opts0,Names0]); make_options([], []) -> []; -make_options([{verbose,Val}|Opts]=Opts0, [verbose|Names]=Names0) -> - if is_boolean(Val) -> - [Val|make_options(Opts, Names)]; - true -> - erlang:error(badarg, [Opts0,Names0]) - end; -make_options([{nxdomain_reply,Val}|Opts]=Opts0, [nxdomain|Names]=Names0) -> +make_options([{Opt,Val}|Opts]=Opts0, [Opt|Names]=Names0) + when Opt =:= nxdomain_reply; + Opt =:= verbose -> if is_boolean(Val) -> [Val|make_options(Opts, Names)]; true -> @@ -318,10 +316,11 @@ make_options([{Opt,Val}|Opts]=Opts0, [Opt|Names]=Names0) -> false -> erlang:error(badarg, [Opts0,Names0]) end; -make_options(Opts, [verbose|Names]) -> - [false|make_options(Opts, Names)]; +%% Handling default values (for options not in Opts) make_options(Opts, [nxdomain_reply|Names]) -> [false|make_options(Opts, Names)]; +make_options(Opts, [verbose|Names]) -> + [false|make_options(Opts, Names)]; make_options(Opts, [Name|Names]) -> [inet_db:res_option(Name)|make_options(Opts, Names)]. diff --git a/lib/kernel/test/inet_res_SUITE.erl b/lib/kernel/test/inet_res_SUITE.erl index 24e0e40e77..9beaba8b1e 100644 --- a/lib/kernel/test/inet_res_SUITE.erl +++ b/lib/kernel/test/inet_res_SUITE.erl @@ -72,7 +72,7 @@ suite() -> all() -> [basic, resolve, edns0, txt_record, files_monitor, - last_ms_answer, + nxdomain_reply, last_ms_answer, intermediate_error, servfail_retry_timeout_default, servfail_retry_timeout_1000, label_compression_limit, @@ -939,14 +939,16 @@ do_files_monitor(Config) -> %% Check that we get the error code from the first server. nxdomain_reply(Config) when is_list(Config) -> - NS = ns(Config), - Name = "nxdomain.otptest", - Class = in, - Type = a, - Opts = [{nameservers,[NS]}, {servfail_retry_timeout, 1000}, verbose], + NS = ns(Config), + Name = "nxdomain.otptest", + Class = in, + Type = a, + Opts = + [{nameservers,[NS]}, {servfail_retry_timeout, 1000}, verbose], ?P("try resolve"), {error, nxdomain} = inet_res:resolve(Name, Class, Type, Opts), - {error, {nxdomain, Rec}} = inet_res:resolve(Name, Class, Type, [nxdomain_reply|Opts]), + {error, {nxdomain, Rec}} = + inet_res:resolve(Name, Class, Type, [nxdomain_reply|Opts]), ?P("resolved: " "~n ~p", [Rec]), ok. -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor