🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
2 messages
2 total messages Started by bugzilla-noreply Wed, 11 Nov 2026 06:08
[Bug 300676] periodic(8): <basedir>_show_empty_output has no effect; empty runs never print "No output" (tests TRUE, not YES)
#413
Author: bugzilla-noreply
Date: Wed, 11 Nov 2026 06:08
113 lines
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
[Bug 300676] periodic(8): <basedir>_show_empty_output has no effect; empty runs never print "No output" (tests TRUE, not YES)
#418
Author: bugzilla-noreply
Date: Wed, 11 Nov 2026 14:53
22 lines
2983 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300676

Dag-Erling Smørgrav <des@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|bugs@FreeBSD.org            |des@FreeBSD.org
              Flags|                            |mfc-stable15+,
                   |                            |mfc-stable14+
                 CC|                            |des@FreeBSD.org
                URL|                            |https://reviews.freebsd.org
                   |                            |/D61435
             Status|New                         |Open

-- 
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads