From 0c8be405cea1ca290e410b2787f9e94c7a27d544 Mon Sep 17 00:00:00 2001 From: Joern Siglen Date: Tue, 27 Sep 2022 16:45:06 +0200 Subject: [PATCH] dbginfo.sh: fix vmcp buffer resizing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the buffer sizing did not work any longer add explaining comments and rework the variable names for claritiy refering commit f7cc14753cc9d930af804e2ac3ce108a12145db6 Reported-by: Mike Storzer Reviewed-by: Mario Held Signed-off-by: Joern Siglen Signed-off-by: Jan Höppner --- scripts/dbginfo.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh index c4916393..11e42f0e 100755 --- a/scripts/dbginfo.sh +++ b/scripts/dbginfo.sh @@ -697,8 +697,8 @@ collect_vmcmdsout() { local vm_userid local module_loaded=1 local ifs_orig="${IFS}" - local cp_buffer_size=2 - local rc_buffer_size=2 + local cp_buffer_size + local rc_buffer_check if echo "${RUNTIME_ENVIRONMENT}" | grep -qi "z/VM" >/dev/null 2>&1; then pr_collect_output "z/VM" @@ -724,11 +724,14 @@ collect_vmcmdsout() { IFS=: for vm_command in ${vm_cmds}; do IFS="${ifs_orig}" - while test ${rc_buffer_size} -eq 2 && test ${cp_buffer_size} -lt 1024; do + # initialize buffer values for automatic resizing + cp_buffer_size=2 + rc_buffer_check=2 + while test ${rc_buffer_check} -eq 2 && test ${cp_buffer_size} -lt 1024; do cp_buffer_size=$(( cp_buffer_size * 2 )) eval ${cp_command} -b ${cp_buffer_size}k "${vm_command}" \ >/dev/null 2>&1 - rc_buffer_size=$? + rc_buffer_check=$? done call_run_command "${cp_command} -b ${cp_buffer_size}k ${vm_command}" \ "${OUTPUT_FILE_VMCMD}"