From 3ab477b0c700cf7a16dadd57a656fa1cff408c12 Mon Sep 17 00:00:00 2001 From: Oliver Sedlbauer Date: Thu, 2 Jul 2026 17:16:36 +0200 Subject: [PATCH] agents: fix rare broken pipe warning in stat version detection head -1 closes the pipe after reading the first line. If stat --version has not finished writing yet, this causes a spurious warning, especially on low performance targets: stat: write error: broken pipe Fix this by redirecting stderr to /dev/null. Signed-off-by: Oliver Sedlbauer --- agents/check_mk_agent.linux | 2 +- agents/check_mk_agent.openwrt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux index 1a354f1fdd4..ed6e5f4e920 100755 --- a/agents/check_mk_agent.linux +++ b/agents/check_mk_agent.linux @@ -812,7 +812,7 @@ section_nfs_mounts() { proc_mounts_file=${1} if inpath waitmax; then - STAT_VERSION=$(stat --version | head -1 | cut -d" " -f4) + STAT_VERSION=$(stat --version 2>/dev/null | head -1 | cut -d" " -f4) STAT_BROKE="5.3.0" json_templ() { diff --git a/agents/check_mk_agent.openwrt b/agents/check_mk_agent.openwrt index 74c24bd53e0..764dae9c141 100755 --- a/agents/check_mk_agent.openwrt +++ b/agents/check_mk_agent.openwrt @@ -490,7 +490,7 @@ section_mounts() { # call statfs()). If this lasts more then 2 seconds we # consider it as hanging. We need waitmax. if inpath waitmax; then - STAT_VERSION=$(stat --version | head -1 | cut -d" " -f4) + STAT_VERSION=$(stat --version 2>/dev/null | head -1 | cut -d" " -f4) STAT_BROKE="5.3.0" echo '<<>>'