Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
4412-Fix-bug-introduced-in-PR-6359.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4412-Fix-bug-introduced-in-PR-6359.patch of Package erlang
From 5f9ac02065ae7a041b4a7ff360978af58c6827de Mon Sep 17 00:00:00 2001 From: Robin Morisset <rmorisset@fb.com> Date: Thu, 1 Dec 2022 23:57:29 +0100 Subject: [PATCH] Fix bug introduced in PR 6359 In https://github.com/erlang/otp/pull/6359/files, I used the new ets:lookup_element/4 in various places in the standard library. In particular, I replaced a try/catch wrapping a call to lookup_element/3 in 3 places. Unfortunately, this catch was also catching the case where the table does not exist at all, and so now things are breaking. This patch just restores the 3 try/catches. --- lib/kernel/src/inet_db.erl | 7 ++++++- lib/kernel/src/pg.erl | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/kernel/src/inet_db.erl b/lib/kernel/src/inet_db.erl index 4937bc0751..f792069a8b 100644 --- a/lib/kernel/src/inet_db.erl +++ b/lib/kernel/src/inet_db.erl @@ -579,7 +579,12 @@ res_update(Option, TagTm) -> end. db_get(Name) -> - ets:lookup_element(inet_db, Name, 2, undefined). + try + ets:lookup_element(inet_db, Name, 2, undefined) + catch + %% Case where the table does not exist yet. + error:badarg -> undefined + end. add_rr(RR) -> %% Questionable if we need to support this; diff --git a/lib/kernel/src/pg.erl b/lib/kernel/src/pg.erl index cc8631f419..deb5a16d28 100644 --- a/lib/kernel/src/pg.erl +++ b/lib/kernel/src/pg.erl @@ -203,7 +203,12 @@ get_members(Group) -> -spec get_members(Scope :: atom(), Group :: group()) -> [pid()]. get_members(Scope, Group) -> - ets:lookup_element(Scope, Group, 2, []). + try + ets:lookup_element(Scope, Group, 2, []) + catch + %% Case where the table does not exist yet. + error:badarg -> [] + end. %%-------------------------------------------------------------------- %% @doc @@ -214,7 +219,12 @@ get_local_members(Group) -> -spec get_local_members(Scope :: atom(), Group :: group()) -> [pid()]. get_local_members(Scope, Group) -> - ets:lookup_element(Scope, Group, 3, []). + try + ets:lookup_element(Scope, Group, 3, []) + catch + %% Case where the table does not exist yet. + error:badarg -> [] + end. %%-------------------------------------------------------------------- %% @doc -- 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