Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
0154-sasl-duplicate-atoms-in-an-app-parameter-i...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0154-sasl-duplicate-atoms-in-an-app-parameter-is-an-error.patch of Package erlang
From 1c90a977cf9168992efd103b8c104f08ffb4b239 Mon Sep 17 00:00:00 2001 From: frazze-jobb <frazze@erlang.org> Date: Mon, 24 Oct 2022 09:33:39 +0200 Subject: [PATCH] sasl: duplicate atoms in an app parameter is an error --- lib/sasl/src/sasl.app.src | 2 +- lib/sasl/src/systools_make.erl | 12 +++++++++- lib/sasl/test/systools_SUITE.erl | 41 ++++++++++++++++++++++++++++---- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/lib/sasl/src/sasl.app.src b/lib/sasl/src/sasl.app.src index 8fc41ca506..9441cced60 100644 --- a/lib/sasl/src/sasl.app.src +++ b/lib/sasl/src/sasl.app.src @@ -42,6 +42,6 @@ {applications, [kernel, stdlib]}, {env, []}, {mod, {sasl, []}}, - {runtime_dependencies, ["tools-2.6.14","stdlib-3.4","kernel-6.0", + {runtime_dependencies, ["tools-2.6.14","stdlib-4.0","kernel-6.0", "erts-10.2"]}]}. diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl index b875c445c6..671eaf7745 100644 --- a/lib/sasl/src/systools_make.erl +++ b/lib/sasl/src/systools_make.erl @@ -696,7 +696,15 @@ specified([], _) -> []. get_items([H|T], Dict) -> - Item = check_item(keysearch(H, 1, Dict),H), + Item = case check_item(keysearch(H, 1, Dict),H) of + [Atom|_]=Atoms when is_atom(Atom), is_list(Atoms) -> + %% Check for duplicate entries in lists + case Atoms =/= lists:uniq(Atoms) of + true -> throw({dupl_entry, H, lists:subtract(Atoms, lists:uniq(Atoms))}); + false -> Atoms + end; + X -> X + end, [Item|get_items(T, Dict)]; get_items([], _Dict) -> []. @@ -2436,6 +2444,8 @@ form_reading({read,File}) -> io_lib:format("Cannot read ~tp~n",[File]); form_reading({{bad_param, P},_}) -> io_lib:format("Bad parameter in .app file: ~tp~n",[P]); +form_reading({{dupl_entry, P, DE},_}) -> + io_lib:format("~tp parameter contains duplicates of: ~tp~n", [P, DE]); form_reading({{missing_param,P},_}) -> io_lib:format("Missing parameter in .app file: ~p~n",[P]); form_reading({badly_formatted_application,_}) -> diff --git a/lib/sasl/test/systools_SUITE.erl b/lib/sasl/test/systools_SUITE.erl index 6065c099fa..e57b559105 100644 --- a/lib/sasl/test/systools_SUITE.erl +++ b/lib/sasl/test/systools_SUITE.erl @@ -63,7 +63,7 @@ groups() -> src_tests_script, crazy_script, optional_apps_script, included_script, included_override_script, included_fail_script, included_bug_script, exref_script, - duplicate_modules_script, + duplicate_modules_script, duplicate_entries_script, otp_3065_circular_dependenies, included_and_used_sort_script]}, {tar, [], [tar_options, relname_tar, normal_tar, no_mod_vsn_tar, system_files_tar, @@ -467,6 +467,18 @@ variable_script(Config) when is_list(Config) -> ok = file:set_cwd(OldDir), ok. +%% make_script: Duplicate entries in app file +duplicate_entries_script(Config) when is_list(Config) -> + DataDir = ?datadir, + create_apps_duplicate_entry(DataDir), + {LatestDir, LatestName} = create_script(latest_t21,Config), + error = systools:make_script(LatestName, + [{path, [DataDir, LatestDir]}]), + {LatestDir2, LatestName2} = create_script(latest_t22,Config), + ok = systools:make_script(LatestName2, + [{path, [DataDir, LatestDir2]}]), + ok. + %% make_script: Abnormal cases. abnormal_script(Config) when is_list(Config) -> {ok, OldDir} = file:get_cwd(), @@ -2575,6 +2587,12 @@ create_script(latest_app_start_type2,Config) -> {xmerl,current,none}], Apps = core_apps(current) ++ OtherApps, do_create_script(latest_app_start_type2,Config,current,Apps); +create_script(latest_t21, Config) -> + Apps = core_apps(current) ++ [{t21, "1.0"}], + do_create_script(latest_t21, Config, "4.4", Apps); +create_script(latest_t22, Config) -> + Apps = core_apps(current) ++ [{t22, "1.0"}], + do_create_script(latest_t22, Config, "4.4", Apps); create_script(current_all_no_sasl,Config) -> Apps = [{kernel,current},{stdlib,current},{db,"2.1"},{fe,"3.1"}], do_create_script(current_all_no_sasl,Config,current,Apps); @@ -2906,7 +2924,6 @@ create_include_files(sort_apps_rev, Config) -> file:write_file(Name ++ ".rel", list_to_binary(Rel)), {filename:dirname(Name), filename:basename(Name)}. - create_apps(Dir) -> T1 = "{application, t1,\n" " [{vsn, \"1.0\"},\n" @@ -3025,8 +3042,6 @@ create_apps2(Dir) -> " {registered, []}]}.\n", file:write_file(fname(Dir, 't13.app'), list_to_binary(T13)). - - create_apps_3065(Dir) -> T11 = "{application, chTraffic,\n" " [{vsn, \"1.0\"},\n" @@ -3119,6 +3134,24 @@ create_sort_apps(Dir) -> " {registered, []}]}.\n", file:write_file(fname(Dir, 't20.app'), list_to_binary(T20)). +create_apps_duplicate_entry(Dir) -> + T21 = "{application, t21,\n" + " [{vsn, \"1.0\"},\n" + " {description, \"test\"},\n" + " {modules, []},\n" + " {applications, []},\n" + " {included_applications, []},\n" + " {registered, [test, test]}]}.\n", + file:write_file(fname(Dir, 't21.app'), list_to_binary(T21)), + T22 = "{application, t22,\n" + " [{vsn, \"1.0\"},\n" + " {description, \"test\"},\n" + " {modules, []},\n" + " {applications, []},\n" + " {included_applications, []},\n" + " {registered, [test]}]}.\n", + file:write_file(fname(Dir, 't22.app'), list_to_binary(T22)). + fname(N) -> filename:join(N). -- 2.35.3
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