From ae8bfef981296461e1a656b378df3c74223c4a2c Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 11 Jul 2024 18:02:04 -0700 Subject: [PATCH] lib.sh: workaround "sudo ... &" corruption issue 1151 for stable-v2.2 Should finally fix terminal corruption issue #1151. Commit 834163887828 was a good workaround but it was applied only for Zephyr's mtrace. - Apply the same workaround for stable-v2.2 sof-logger - Explain better in the source what causes the corruption - Change owner of mtrace.txt logs to "ubuntu" instead of root. Signed-off-by: Marc Herbert --- case-lib/lib.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/case-lib/lib.sh b/case-lib/lib.sh index 519e4205..35f8d1ef 100644 --- a/case-lib/lib.sh +++ b/case-lib/lib.sh @@ -394,11 +394,13 @@ func_mtrace_collect() local mtraceCmd=("$MTRACE") dlogi "Starting ${mtraceCmd[*]} >& $clogfile &" + # Cleaned up by func_exit_handler() in hijack.sh - # The use of 'bash -c' is a workaround for below issue: - # https://github.com/thesofproject/sof-test/issues/1151 + # + # We need "bash -c" because "sudo ... &" corrupts the terminal among + # other issues, see bug #1151. # shellcheck disable=SC2024 - sudo bash -c "${mtraceCmd[*]} >& $clogfile &" + sudo bash -c "${mtraceCmd[*]} &" >& "$clogfile" } func_lib_log_post_process() @@ -461,9 +463,13 @@ func_sof_logger_collect() # shellcheck disable=SC2206 local loggerCmd=("$SOFLOGGER" $logopt -l "$ldcFile") dlogi "Starting ${loggerCmd[*]} > $logfile &" + # Cleaned up by func_exit_handler() in hijack.sh + # + # We need "bash -c" because "sudo ... &" corrupts the terminal among + # other issues, see bug #1151. # shellcheck disable=SC2024 - sudo "${loggerCmd[@]}" > "$logfile" & + sudo bash -c "${loggerCmd[*]} &" > "$logfile" } SOF_LOG_COLLECT=0