File 2531-otp-Fix-usages-of-deprecated-format_status-2-callbac.patch of Package erlang

From 67513dcdd3823fa75dbd6b8a255bf8e642ca556e Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Fri, 1 Mar 2024 10:47:03 +0100
Subject: [PATCH 1/6] otp: Fix usages of deprecated format_status/2 callback

---
 .../src/http_server/httpd_request_handler.erl |  2 +-
 lib/kernel/src/erl_signal_handler.erl         |  5 +---
 lib/os_mon/src/disksup.erl                    | 17 +++++++------
 lib/os_mon/src/memsup.erl                     | 25 ++++++++++---------
 lib/ssh/src/Makefile                          |  2 +-
 lib/ssl/src/Makefile                          |  2 +-
 lib/stdlib/src/supervisor.erl                 |  9 +------
 7 files changed, 27 insertions(+), 35 deletions(-)

diff --git a/lib/inets/src/http_server/httpd_request_handler.erl b/lib/inets/src/http_server/httpd_request_handler.erl
index 4b745c8aed..f96bf8a531 100644
--- a/lib/inets/src/http_server/httpd_request_handler.erl
+++ b/lib/inets/src/http_server/httpd_request_handler.erl
@@ -22,7 +22,7 @@
 %% 
 
 -module(httpd_request_handler).
-
+-compile(nowarn_deprecated_callback).
 -behaviour(gen_server).
 
 %% Application internal API
diff --git a/lib/kernel/src/erl_signal_handler.erl b/lib/kernel/src/erl_signal_handler.erl
index 11146063c9..4a11646950 100644
--- a/lib/kernel/src/erl_signal_handler.erl
+++ b/lib/kernel/src/erl_signal_handler.erl
@@ -21,7 +21,7 @@
 
 -module(erl_signal_handler).
 -behaviour(gen_event).
--export([start/0, init/1, format_status/2,
+-export([start/0, init/1,
          handle_event/2, handle_call/2, handle_info/2,
          terminate/2, code_change/3]).
 
@@ -58,9 +58,6 @@ handle_info(_Info, S) ->
 handle_call(_Request, S) ->
     {ok, ok, S}.
 
-format_status(_Opt, [_Pdict,_S]) ->
-    ok.
-
 code_change(_OldVsn, S, _Extra) ->
     {ok, S}.
 
diff --git a/lib/os_mon/src/disksup.erl b/lib/os_mon/src/disksup.erl
index 465c00ea0d..22613a4c1c 100644
--- a/lib/os_mon/src/disksup.erl
+++ b/lib/os_mon/src/disksup.erl
@@ -84,7 +84,7 @@ value of configuration parameters.
 	 terminate/2]).
 
 %% Other exports
--export([format_status/2, parse_df/2]).
+-export([format_status/1, parse_df/2]).
 
 -type time() :: pos_integer() | {TimeUnit :: erlang:time_unit(), Time :: pos_integer()}.
 
@@ -370,13 +370,14 @@ terminate(_Reason, State) ->
 %% Other exports
 %%----------------------------------------------------------------------
 
-format_status(_Opt, [_PDict, #state{os = OS, threshold = Threshold,
-				    timeout = Timeout,
-				    diskdata = DiskData}]) ->
-    [{data, [{"OS", OS},
-	     {"Timeout", Timeout},
-	     {"Threshold", Threshold},
-	     {"DiskData", DiskData}]}].
+format_status(#{ state := #state{os = OS, threshold = Threshold,
+                                 timeout = Timeout,
+                                 diskdata = DiskData}} = Status) ->
+    Status#{ state := [{"OS", OS},
+                       {"Timeout", Timeout},
+                       {"Threshold", Threshold},
+                       {"DiskData", DiskData}]
+           }.
 
 %%----------------------------------------------------------------------
 %% Internal functions
diff --git a/lib/os_mon/src/memsup.erl b/lib/os_mon/src/memsup.erl
index b8484cff76..6c53311fc9 100644
--- a/lib/os_mon/src/memsup.erl
+++ b/lib/os_mon/src/memsup.erl
@@ -120,7 +120,7 @@ value of configuration parameters.
 	 terminate/2]).
 
 %% Other exports
--export([format_status/2]).
+-export([format_status/1]).
 
 -include("memsup.hrl").
 
@@ -779,19 +779,20 @@ terminate(_Reason, State) ->
 %% Other exports
 %%----------------------------------------------------------------------
 
-format_status(_Opt, [_PDict, #state{timeout=Timeout, mem_usage=MemUsage,
-				    worst_mem_user=WorstMemUser}]) ->
+format_status(#{ state := #state{timeout=Timeout, mem_usage=MemUsage,
+                                 worst_mem_user=WorstMemUser} } = Status) ->
     {Allocated, Total} = MemUsage,
     WorstMemFormat = case WorstMemUser of
-			 {Pid, Mem} ->
-			     [{"Pid", Pid}, {"Memory", Mem}];
-			 undefined ->
-			     undefined
-		     end,
-    [{data, [{"Timeout", Timeout}]},
-     {items, {"Memory Usage", [{"Allocated", Allocated},
-			       {"Total", Total}]}},
-     {items, {"Worst Memory User", WorstMemFormat}}].
+                         {Pid, Mem} ->
+                             [{"Pid", Pid}, {"Memory", Mem}];
+                         undefined ->
+                             undefined
+                     end,
+    Status#{ state := 
+                 [{"Timeout", Timeout},
+                  {"Memory Usage", [{"Allocated", Allocated},
+                                    {"Total", Total}]},
+                  {"Worst Memory User", WorstMemFormat}] }.
 
 
 %%----------------------------------------------------------------------
diff --git a/lib/ssh/src/Makefile b/lib/ssh/src/Makefile
index 2fcb164301..a620495438 100644
--- a/lib/ssh/src/Makefile
+++ b/lib/ssh/src/Makefile
@@ -135,7 +135,7 @@ endif
 # ----------------------------------------------------
 # FLAGS
 # ----------------------------------------------------
-EXTRA_ERLC_FLAGS = +warn_unused_vars
+EXTRA_ERLC_FLAGS = +warn_unused_vars +nowarn_deprecated_callback
 ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/kernel/src \
 	-pz $(EBIN) \
 	-pz $(ERL_TOP)/lib/public_key/ebin \
diff --git a/lib/ssl/src/Makefile b/lib/ssl/src/Makefile
index 1a840a9e59..61f506aa78 100644
--- a/lib/ssl/src/Makefile
+++ b/lib/ssl/src/Makefile
@@ -170,7 +170,7 @@ endif
 # ----------------------------------------------------
 # FLAGS
 # ----------------------------------------------------
-EXTRA_ERLC_FLAGS = +warn_unused_vars -Werror
+EXTRA_ERLC_FLAGS = +warn_unused_vars -Werror +nowarn_deprecated_callback
 ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/kernel/src \
 	-pz $(EBIN) \
 	-pz $(ERL_TOP)/lib/public_key/ebin \
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl
index b95c3cc18f..628b196591 100644
--- a/lib/stdlib/src/supervisor.erl
+++ b/lib/stdlib/src/supervisor.erl
@@ -290,7 +290,7 @@ but the map is preferred.
 
 %% Internal exports
 -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
-	 terminate/2, code_change/3, format_status/2]).
+	 terminate/2, code_change/3]).
 
 %% logger callback
 -export([format_log/1, format_log/2]).
@@ -2243,12 +2243,6 @@ single(false) -> "".
 mod(latin1) -> "";
 mod(_) -> "t".
 
-format_status(terminate, [_PDict, State]) ->
-    State;
-format_status(_, [_PDict, State]) ->
-    [{data, [{"State", State}]},
-     {supervisor, [{"Callback", State#state.module}]}].
-
 %%%-----------------------------------------------------------------
 %%% Dynamics database access.
 %%%
-- 
2.35.3

openSUSE Build Service is sponsored by