From cfbc63921d645fd1940a1b8aa5a5346811a6e19c Mon Sep 17 00:00:00 2001 From: Davide Madrisan Date: Sun, 15 Jan 2012 14:43:29 +0100 Subject: [PATCH] test: rework coloring schema and make output a bit more compact Signed-off-by: Davide Madrisan --- ChangeLog | 5 +++++ po/it/test01_pkgquality.po | 4 ++-- po/it/test02_pkgsecurity.po | 4 ++-- tests/test01_pkgquality.in | 4 ++-- tests/test02_pkgsecurity.in | 20 ++++++++------------ 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 72303b9..5e9a444 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,11 @@ Sun Jan 15 2012 Davide Madrisan * tests/test02_pkgsecurity - Davide Madrisan: New test: check for setgid directories. ++ update + tests/test01_pkgquality + tests/test02_pkgsecurity - Davide Madrisan: + Rework coloring schema and make output a bit more compact. + -------------------------------------------------------------------------------- Changes in version 1.8.2 diff --git a/po/it/test01_pkgquality.po b/po/it/test01_pkgquality.po index b89bde2..be96a3b 100644 --- a/po/it/test01_pkgquality.po +++ b/po/it/test01_pkgquality.po @@ -103,5 +103,5 @@ msgstr "ricerca di pacchetti con errato tag BuildArch" msgid "this package should be tagged \\`noarch'" msgstr "questo pacchetto dovrebbe essere di tipo \\`noarch'" -msgid "Quality checks: ${#rpmpkg_name[@]} package(s) checked: $total_issues warning(s)." -msgstr "Controlli di qualità: pacchetti controllati: ${#rpmpkg_name[@]}; problemi riscontrati: $total_issues" +msgid "Quality checks: ${#rpmpkg_name[@]} package(s) checked: ${WARN}$total_issues${NOTE} warning(s)." +msgstr "Controlli di qualità: pacchetti rpm: ${#rpmpkg_name[@]}; problemi riscontrati: ${WARN}$total_issues${NOTE}" diff --git a/po/it/test02_pkgsecurity.po b/po/it/test02_pkgsecurity.po index 7f0966e..d9f214f 100644 --- a/po/it/test02_pkgsecurity.po +++ b/po/it/test02_pkgsecurity.po @@ -64,5 +64,5 @@ msgstr "Suggerimento per script bash (richiede \\`mktemp')" msgid "Hint for perl scripts" msgstr "Suggerimento per script perl" -msgid "Security checks: ${#rpmpkg_name[@]} package(s) checked: $total_issues warning(s)." -msgstr "Ccntrolli di sicurezza: pacchetti controllati: ${#rpmpkg_name[@]}; problemi riscontrati: $total_issues" +msgid "Security checks: ${#rpmpkg_name[@]} package(s) checked: ${WARN}$total_issues${NOTE} warning(s)." +msgstr "Controlli di sicurezza: pacchetti rpm: ${#rpmpkg_name[@]}; problemi riscontrati: ${WARN}$total_issues${NOTE}" diff --git a/tests/test01_pkgquality.in b/tests/test01_pkgquality.in index 8b10d31..7409466 100644 --- a/tests/test01_pkgquality.in +++ b/tests/test01_pkgquality.in @@ -373,6 +373,6 @@ BuildArch: noarch fi notify.note "\ - --> ${NOTE}"$"Quality checks: \ -${#rpmpkg_name[@]} package(s) checked: $total_issues warning(s).""${NORM}" + --> ${NOTE}"$"Quality checks: ${#rpmpkg_name[@]} \ +package(s) checked: ${WARN}$total_issues${NOTE} warning(s).""${NORM}" } diff --git a/tests/test02_pkgsecurity.in b/tests/test02_pkgsecurity.in index cdfef6b..d11addf 100644 --- a/tests/test02_pkgsecurity.in +++ b/tests/test02_pkgsecurity.in @@ -83,8 +83,8 @@ function alltests() { if [[ "$(file $f | grep " ELF ")" ]]; then rpath="$(security.filecheckrpath $f)" if [ "$rpath" ]; then - notify.warning "${NOTE}${pck##*/}${NORM}" - notify.note "${f/./}\nRPATH: $rpath" + notify.warning "${NORM}${pck##*/} --> ${f/./}" + notify.note "RPATH: $rpath" let "total_issues += 1" fi fi @@ -99,12 +99,9 @@ function alltests() { let "i = 0" for pck in ${rpmpkg_name[@]}; do pushd $tmpextractdir/$i >/dev/null - # find setuid binaries - # NOTE: find output is different for normal and root users - for f in $(find -mindepth 2 -perm +111 -type f); do - if [[ "$(file $f | grep " setuid ")" ]]; then - notify.warning "${NOTE}${pck##*/}${NORM}" - notify.note "${NOTE}${f/./}${NORM}" + for f in $(find -mindepth 2 -perm +111 -type f 2>/dev/null); do + if [[ "$(LC_ALL=C file $f | grep " setuid ")" ]]; then + notify.warning "${NORM}${pck##*/} --> ${f/./}" let "total_issues += 1" fi done @@ -118,9 +115,8 @@ function alltests() { let "i = 0" for pck in ${rpmpkg_name[@]}; do pushd $tmpextractdir/$i >/dev/null - # find setuid directories for d in $(find -mindepth 2 -perm -2000 -type d 2>/dev/null); do - notify.warning "${NORM}${pck##*/} --> ${NOTE}${d/./}${NORM}" + notify.warning "${NORM}${pck##*/} --> ${d/./}" let "total_issues += 1" done popd >/dev/null @@ -169,6 +165,6 @@ ${NOTE}"$"Hint for perl scripts"":${NORM} -----------------------------" notify.note "\ - --> ${NOTE}"$"Security checks: \ -${#rpmpkg_name[@]} package(s) checked: $total_issues warning(s).""${NORM}" + --> ${NOTE}"$"Security checks: ${#rpmpkg_name[@]} \ +package(s) checked: ${WARN}$total_issues${NOTE} warning(s).""${NORM}" }