From: Panu Matilainen Date: Mon, 1 Oct 2018 10:41:45 +0000 (+0300) Subject: Report debuginfo size in kilobytes X-Git-Tag: debugedit-0.1~31 X-Git-Url: https://www.sourceware.org/git/?a=commitdiff_plain;h=1995e28a1f5cb880b0a86e89a653ef315ba52003;p=debugedit.git Report debuginfo size in kilobytes By standard, 'du' defaults to 512 byte units, but this differs between implementations: GNU du defaults to 1024 unless POSIXLY_CORRECT is set and also allows overriding via number of environment variables. It also supports various other ways of controlling the block size, but the only standard means to control the size is -k, and we really don't want to break portability for the sake of FYI statistics. Inspired by Marxim Liska's patch at in #554. --- diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh index 51cea86..9678145 100755 --- a/scripts/find-debuginfo.sh +++ b/scripts/find-debuginfo.sh @@ -486,7 +486,7 @@ if $run_dwz \ && [ -d "${RPM_BUILD_ROOT}/usr/lib/debug" ]; then readarray dwz_files < <(cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug | LC_ALL=C sort) if [ ${#dwz_files[@]} -gt 0 ]; then - size_before=$(du -s ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) + size_before=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) dwz_multifile_name="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}.${RPM_ARCH}" dwz_multifile_suffix= dwz_multifile_idx=0 @@ -509,8 +509,8 @@ if $run_dwz \ echo >&2 "*** ERROR: DWARF compression requested, but no dwz installed" exit 2 fi - size_after=$(du -s ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) - echo "original debug info size: ${size_before}, size after compression: ${size_after}" + size_after=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1) + echo "original debug info size: ${size_before}kB, size after compression: ${size_after}kB" # Remove .dwz directory if empty rmdir "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" 2>/dev/null if [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" ]; then