From d8f8b09fa088fd45795717d6874f36e823091887 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Nov 09 2021 13:53:37 +0000 Subject: kdump-lib.sh: fix arithmetic operation syntax upstream: fedora resolves: bz2003832 conflict: none commit c0edb80b8f2d6b859d7f7118942e825d35be5c51 Author: Kairui Song Date: Wed Sep 8 13:31:31 2021 +0800 kdump-lib.sh: fix arithmetic operation syntax Get rid of let, and remove useless '$' on arithmetic variables. Signed-off-by: Kairui Song Acked-by: Philipp Rudo Signed-off-by: Tao Liu --- diff --git a/kdump-lib.sh b/kdump-lib.sh index 0b50494..6efec78 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -768,7 +768,7 @@ get_system_size() # replace '-' with '+0x' and '+' with '-0x' sum=$( echo $result | sed -e 's/-/K0x/g' | sed -e 's/+/-0x/g' | sed -e 's/K/+/g' ) size=$(printf "%d\n" $(($sum))) - let size=$size/1024/1024/1024 + size=$((size / 1024 / 1024 / 1024)) echo $size } @@ -794,7 +794,7 @@ get_recommend_size() size=${end: : -1} unit=${end: -1} if [[ $unit == 'T' ]]; then - let size=$size*1024 + size=$((size * 1024)) fi if [[ $mem_size -lt $size ]]; then echo $recommend @@ -890,7 +890,7 @@ get_vmlinux_size() local size=0 while read _type _offset _virtaddr _physaddr _fsize _msize _flg _aln; do - size=$(( $size + $_msize )) + size=$(( size + _msize )) done <<< $(readelf -l -W $1 | grep "^ LOAD" 2>/dev/stderr) echo $size @@ -945,7 +945,7 @@ get_kernel_size() # Fallback to use iomem local _size=0 for _seg in $(grep -E "Kernel (code|rodata|data|bss)" /proc/iomem | cut -d ":" -f 1); do - _size=$(( $_size + 0x${_seg#*-} - 0x${_seg%-*} )) + _size=$(( _size + 0x${_seg#*-} - 0x${_seg%-*} )) done echo $_size }