From: Eugene Syromiatnikov Date: Mon, 7 Jul 2025 14:13:24 +0000 (+0200) Subject: util/analyze-contention-log: call the bash interpreter with -eu flags X-Git-Tag: openssl-3.6.0-alpha1~254 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d6b1f50cbff0badfc20373f0cb06f5dfcf186d1;p=thirdparty%2Fopenssl.git util/analyze-contention-log: call the bash interpreter with -eu flags Signed-off-by: Eugene Syromiatnikov Reviewed-by: Neil Horman Reviewed-by: Saša Nedvědický (Merged from https://github.com/openssl/openssl/pull/27983) --- diff --git a/util/analyze-contention-log.sh b/util/analyze-contention-log.sh index 6ad58e489b2..b8cd6d0f774 100755 --- a/util/analyze-contention-log.sh +++ b/util/analyze-contention-log.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -eu # Copyright 2025 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). @@ -37,7 +37,7 @@ awk ' BEGIN {RS = ""; FS = "\n"} {file_num++; print > ("stacktrace" file_num ".txt")}' ./$LOGFILEBASE popd > /dev/null -rm $TEMPDIR/individual_files/$LOGFILEBASE +rm -f $TEMPDIR/individual_files/$LOGFILEBASE # # Make some associative arrays to track our stats @@ -48,7 +48,7 @@ declare -A latency_counts echo "Gathering latencies" FILECOUNT=$(ls $TEMPDIR/individual_files/stacktrace*.* | wc -l) -let currentidx=0 +currentidx=0 # # Look at every stack trace, get and record its latency, and hash value @@ -61,8 +61,8 @@ do #now compute its sha1sum SHA1SUM=$(sha1sum $i | awk '{print $1}') filenames["$SHA1SUM"]=$i - let CUR_LATENCY=0 - let LATENCY_COUNT=0 + CUR_LATENCY=0 + LATENCY_COUNT=0 # # If we already have a latency total for this hash value @@ -71,8 +71,8 @@ do # if [[ -v total_latency["$SHA1SUM"] ]] then - let CUR_LATENCY=${total_latency["$SHA1SUM"]} - let LATENCY_COUNT=${latency_counts["$SHA1SUM"]} + CUR_LATENCY=${total_latency["$SHA1SUM"]} + LATENCY_COUNT=${latency_counts["$SHA1SUM"]} fi # @@ -82,7 +82,7 @@ do total_latency["$SHA1SUM"]=$(dc -e "$CUR_LATENCY $LATENCY + p") latency_counts["$SHA1SUM"]=$(dc -e "$LATENCY_COUNT 1 + p") echo -e -n "FILE $currentidx/$FILECOUNT \r" - let currentidx=$currentidx+1 + currentidx=$((currentidx + 1)) done #