Article View: muc.lists.freebsd.bugs
Article #413[Bug 300676] periodic(8): <basedir>_show_empty_output has no effect; empty runs never print "No output" (tests TRUE, not YES)
From: bugzilla-noreply
Date: Wed, 11 Nov 2026 06:08
Date: Wed, 11 Nov 2026 06:08
113 lines
5798 bytes
5798 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300676
Bug ID: 300676
Summary: periodic(8): <basedir>_show_empty_output has no
effect; empty runs never print "No output" (tests
TRUE, not YES)
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: bugs@FreeBSD.org
Reporter: jaitken@aitken.com
Created attachment 277181
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277181&action=edit
patch for usr/src/usr.sbin/periodic/periodic.sh
periodic.sh normalises <basedir>_show_empty_output to YES or NO (lines 101-107
in main), then tests
it against TRUE (line 147):
success=YES info=YES badconfig=NO empty_output=YES # Defaults when
${run}_* aren't YES/NO
...
if [ $empty = TRUE ]; then
if [ $empty_output = TRUE ]; then
The test can never succeed, so a run with no output never prints "No output
from the N files
processed", whatever the setting. The script's own flags (empty, output) use
TRUE/FALSE; the four
configuration variables use YES/NO, and line 147 uses the wrong convention.
Effect: when <basedir>_output is a mail address, output_pipe uses "mail -E",
which drops an empty
message. So a run whose scripts are all quiet, or all hidden by
<basedir>_show_success=NO, sends no
mail at all, even with show_empty_output at its default of YES. periodic(8)
documents the
opposite: "If <basedir>_show_empty_output is set to NO, then no mail will be
sent if the output was
empty." Anyone treating the periodic mail as a heartbeat loses it on quiet
runs.
History: the test came in with the option itself, 68c35072f914 (2007-06-22, PR
88486). Before that
commit periodic printed the "No output" line unconditionally, so since 2007
empty runs have been
silent by default, contrary to the manual. The bug is easy to miss because the
option was added to
make empty runs quiet, and the bug makes them quiet regardless.
Present in 14.5-RELEASE-p3, 15.1-RELEASE and main (2af08ab3f125, 2026-11-11).
How to reproduce (no root needed: LOCKED skips the lock file in /var/run):
mkdir -p /tmp/ptest/ptest
printf '#!/bin/sh\necho all good\nexit 0\n' > /tmp/ptest/ptest/100.ok
chmod +x /tmp/ptest/ptest/100.ok
env ptest_show_success=NO ptest_show_empty_output=YES /bin/sh
/usr/sbin/periodic LOCKED /tmp/ptest/ptest
Expected: "No output from the 1 file processed".
Actual: no output at all. Setting ptest_show_empty_output=NO gives the same
(correct for NO).
Control: without ptest_show_success=NO the script's "all good" and the "-- End
of ... output --"
trailer print as usual, so the run itself works.
With the patch below, YES prints the line and NO prints nothing, matching
periodic(8).
Fix:
--- a/usr.sbin/periodic/periodic.sh
+++ b/usr.sbin/periodic/periodic.sh
@@ -144,7 +144,7 @@
done
done
if [ $empty = TRUE ]; then
- if [ $empty_output = TRUE ]; then
+ if [ $empty_output = YES ]; then
[ $processed = 1 ] && plural= || plural=s
echo "No output from the $processed file$plural processed"
fi
Note for MFC: the fix changes behavior that has been stable since 2007.
Systems with the default (YES) start receiving a short mail for every empty
run; sites that prefer silence set <basedir>_show_empty_output=NO, which is
what the option is documented to do.
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<bug-300676-227@https.bugs.freebsd.org/bugzilla/>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail From: bugzilla-noreply@freebsd.org Newsgroups: muc.lists.freebsd.bugs Subject: [Bug 300676] periodic(8): <basedir>_show_empty_output has no effect; empty runs never print "No output" (tests TRUE, not YES) Date: Wed, 11 Nov 2026 06:08:28 +0000 Organization: Newsgate at muc.de e.V. Approved: news-admin@muc.de Distribution: world Message-ID: <bug-300676-227@https.bugs.freebsd.org/bugzilla/> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="43167"; mail-complaints-to="news-admin@muc.de" X-Original-To: bugs@mlmmj.nyi.freebsd.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794377308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LB7czUJTexvoHUc1tTTb/SVW3mVYRTPJ9qDssKTcuKg=; b=DriLH9rdiB2VMyrepYAWMdEMdsQU/I+ztYK/0Ak0Jg1SOFp5BE0W39xMBbvaBKB+j3Wzff 0ris8Im5CXEBzOUi9NeWXcofZLcJkqkKDlr/WO2GoLlwGZi5CdPwJordbx/s6VGuYSakbi VGO3ktAEEsHowyeTn+0GoE0glO/TyTdlfK5uJC8RYEehkMBMqYSCzVn3buyGZW9Gjfq9cj 1tDhpn6C4x6MjF51OrVl/JW5wk/4snvWq0rVDGtbUr2Xx4R22oavTfdWJeDkMjLuuZoCsR /UWZb/SdsMMhrEQuvXFGZDD6KAly/6F3z7ghCKjLKLfXOp03XCtIPU3+XGoKug== X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Auto-Submitted: auto-generated Precedence: list X-Newsgate-Id: f02c70b8849f+ X-No-Archive: Yes