File 3741-Handle-process_labels-set-as-list-of-terms.patch of Package erlang
From 8c7d192979054e9e9d6280b48c2b52f8126bbdbf Mon Sep 17 00:00:00 2001
From: Dan Gudmundsson <dgud@erlang.org>
Date: Mon, 11 Mar 2024 09:52:17 +0100
Subject: [PATCH] Handle process_labels set as list of terms
Don't crash when a list is not a string, but a list of terms.
---
lib/runtime_tools/src/appmon_info.erl | 4 +++-
lib/runtime_tools/src/observer_backend.erl | 4 +++-
lib/stdlib/src/c.erl | 4 +++-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/runtime_tools/src/appmon_info.erl b/lib/runtime_tools/src/appmon_info.erl
index 44632720cb..a263853bf3 100644
--- a/lib/runtime_tools/src/appmon_info.erl
+++ b/lib/runtime_tools/src/appmon_info.erl
@@ -731,11 +731,13 @@ format(X) ->
"???".
format_label(Id, Pid) when is_list(Id); is_binary(Id) ->
- case unicode:characters_to_binary(Id) of
+ try unicode:characters_to_binary(Id) of
{error, _, _} ->
io_lib:format("~0.tp ~w", [Id, Pid]);
BinString ->
io_lib:format("~ts ~w", [BinString, Pid])
+ catch _:_ ->
+ io_lib:format("~0.tp ~w", [Id, Pid])
end;
format_label(Id, Pid) ->
io_lib:format("~0.tp ~w", [Id, Pid]).
diff --git a/lib/runtime_tools/src/observer_backend.erl b/lib/runtime_tools/src/observer_backend.erl
index a2ff8899c2..73151e25e0 100644
--- a/lib/runtime_tools/src/observer_backend.erl
+++ b/lib/runtime_tools/src/observer_backend.erl
@@ -609,11 +609,13 @@ etop_collect([P|Ps], Acc) ->
etop_collect([], Acc) -> Acc.
id_to_binary(Id) when is_list(Id); is_binary(Id) ->
- case unicode:characters_to_binary(Id) of
+ try unicode:characters_to_binary(Id) of
{error, _, _} ->
unicode:characters_to_binary(io_lib:format("~0.tp", [Id]));
BinString ->
BinString
+ catch _:_ ->
+ unicode:characters_to_binary(io_lib:format("~0.tp", [Id]))
end;
id_to_binary(TermId) ->
unicode:characters_to_binary(io_lib:format("~0.tp", [TermId])).
diff --git a/lib/stdlib/src/c.erl b/lib/stdlib/src/c.erl
index dd9a0c96b5..a0f84e1e49 100644
--- a/lib/stdlib/src/c.erl
+++ b/lib/stdlib/src/c.erl
@@ -872,11 +872,13 @@ fetch_label(Reg, _) ->
Reg.
format_label(Id) when is_list(Id); is_binary(Id) ->
- case unicode:characters_to_binary(Id) of
+ try unicode:characters_to_binary(Id) of
{error, _, _} ->
io_lib:format("~0.tp", [Id]);
BinString ->
BinString
+ catch _:_ ->
+ io_lib:format("~0.tp", [Id])
end;
format_label(TermId) ->
io_lib:format("~0.tp", [TermId]).
--
2.43.0