From 353b6e83c55d52b47a2a35063406324cec7237c4 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Wed, 21 May 2025 07:20:13 -0400 Subject: [PATCH] test that `wc` is functional https://github.com/Kicksecure/security-misc/pull/305#issuecomment-2892378246 --- usr/libexec/security-misc/apt-get-update-sanity-test | 10 ++++++++++ usr/libexec/security-misc/pam-info | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/usr/libexec/security-misc/apt-get-update-sanity-test b/usr/libexec/security-misc/apt-get-update-sanity-test index a5b7709..f96a4f8 100755 --- a/usr/libexec/security-misc/apt-get-update-sanity-test +++ b/usr/libexec/security-misc/apt-get-update-sanity-test @@ -7,5 +7,15 @@ set -x set -e set -o pipefail +if ! printf '%s\n' | wc -l >/dev/null ; then + printf "\ +$0: ERROR: command 'wc' test failed! Do not ignore this! + +'wc' can core dump. Example: +zsh: illegal hardware instruction (core dumped) wc -l +https://github.com/rspamd/rspamd/issues/5137" >&2 + exit 1 +fi + wc -L "/var/lib/apt/lists/"*InRelease wc -L "/var/lib/apt/lists/"*InRelease | awk '$1 > 1024 {print; exit 1}' diff --git a/usr/libexec/security-misc/pam-info b/usr/libexec/security-misc/pam-info index 0f30faf..3ac9a5d 100755 --- a/usr/libexec/security-misc/pam-info +++ b/usr/libexec/security-misc/pam-info @@ -35,6 +35,16 @@ ERROR: Please report this bug." >&2 trap error_handler ERR +if ! printf '%s\n' | wc -l >/dev/null ; then + printf "\ +$0: ERROR: command 'wc' test failed! Do not ignore this! + +'wc' can core dump. Example: +zsh: illegal hardware instruction (core dumped) wc -l +https://github.com/rspamd/rspamd/issues/5137" >&2 + exit 1 +fi + ## Named constants. pam_faillock_state_dir="/var/lib/security-misc/faillock"