Hi Tao,
On Thu, 28 Sep 2023 21:20:30 +0800
Tao Liu <ltao(a)redhat.com> wrote:
The first time of running kdumpctl test-check involves remote fs
mount and
file string grep, which will consume a lot of time. If user re-run test-check
multiple times with no kdump config change, there is no need to waste the
time. This patch introduce md5sum of the kdump config. If unchanged,
just return result immediately.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdumpctl | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 5e9d1e7..493aa04 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -17,6 +17,7 @@ TARGET_INITRD=""
[...]
@@ -1789,6 +1801,15 @@ output_conf()
printf -- '-%.0s' $(seq -s " " $((_line_width + 1))); echo
}
+checksum_conf()
+{
+ local -n conf=$1
+
+ for _key in "${!conf[@]}"; do
+ echo "$_key ${conf[$_key]} "
+ done | md5sum | cut -d' ' -f1
+}
+
get_all_kdump_conf()
{
local _max_width=0 _width _elem _line_width _key _func=$1
I don't think this will work as expected. Thing is that the associated
arrays in bash are unordered. So simply piping them into a hash
function might lead to different hashes even when the content of the
array is the same in both cases.
Thanks
Philipp