File 3433-kernel-Fix-bug-in-shell_history-with-corrupt-disk_lo.patch of Package erlang
From 13355faee18eb75e5c5a6e99dd5ea5c9f17dc96d Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Thu, 4 Mar 2021 14:58:19 +0100
Subject: [PATCH 03/11] kernel: Fix bug in shell_history with corrupt disk_log
chunk
---
lib/kernel/src/group_history.erl | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lib/kernel/src/group_history.erl b/lib/kernel/src/group_history.erl
index 131bfad394..b6888cf251 100644
--- a/lib/kernel/src/group_history.erl
+++ b/lib/kernel/src/group_history.erl
@@ -239,6 +239,9 @@ read_full_log(Name) ->
{error, no_such_log} ->
show_unexpected_close_warning(),
[];
+ {error, Reason} ->
+ show_invalid_chunk_warning(Name, Reason),
+ [];
eof ->
[];
{Cont, Logs} ->
@@ -261,6 +264,9 @@ read_full_log(Name, Cont) ->
{error, no_such_log} ->
show_unexpected_close_warning(),
[];
+ {error, Reason} ->
+ show_invalid_chunk_warning(Name, Reason),
+ [];
eof ->
[];
{NextCont, Logs} ->
@@ -384,6 +390,12 @@ show_rename_warning() ->
"name will keep being used for this session.~n",
[]).
+show_invalid_chunk_warning(Name, Reason) ->
+ show('$#erlang-history-invalid-chunk-warn',
+ "Invalid chunk in the file ~ts.~n"
+ "Some entries may have been lost.~nReason ~p.",
+ [proplists:get_value(file,disk_log:info(Name)), Reason]).
+
show_invalid_file_warning(FileName) ->
show('$#erlang-history-invalid-file',
"Shell history expects to be able to use the file ~ts "
--
2.26.2