Re: periodic(8) pkg_* tasks not in /etc/defaults/periodic.conf ?

From: Steve Rikli <sr_at_genyosha.net>
Date: Tue, 06 Aug 2024 20:13:46 UTC
On Thu, Aug 01, 2024 at 08:56:38AM -0700, Steve Rikli wrote:
> On Thu, Aug 01, 2024 at 08:39:50AM +0100, Matthew Seaman wrote:
> > On 31/07/2024 17:32, Steve Rikli wrote:
> > > I usually start with /etc/defaults/periodic.conf for candidates I might
> > > want for customizing periodic(8) behavior.  I also check the various
> > > periodic man pages, and scripts themselves occasionally.
> > > 
> > > Recently I checked periodic.conf(5) and found there are some documented
> > > variables which do not also appear in /etc/defaults/periodic.conf e.g.:
> > > 
> > >      weekly_status_pkg_enable
> > > 
> > > as well as pkg_version and pkg_version_index, possibly others.
> > > 
> > > It seems like most of the man page variables have default settings in
> > > /etc/defaults/periodic.conf so maybe the missing pkg_* variable(s)
> > > entries are a simple omission?
> > > 
> > > Adding weekly_status_pkg_enable="YES" to /etc/periodic.conf[.local]
> > > works as expected, it just seems atypical there's no default for it.
> > > 
> > > Happy to file a bug if that's appropriate.
> > 
> > /etc/defaults/periodic.conf documents the variables used by the periodic
> > scripts shipped with the base OS.  However, installing pkg(8) adds some
> > periodic scripts that aren't part of the base.  There isn't really a
> > mechanism to gather the defaults for (effectively) 3rd party periodic
> > scripts into one place -- which might be a nice enhancement if someone can
> > come up with a clean way of doing it.
> > 
> > Basically the same thing applies to rc scripts installed from ports.
> 
> That makes sense, though one could argue pkg(8) itself is (nearly) part
> of base.  It somewhat straddles the line, and I recognize it's possible
> to have a system without bootstrapping pkg(8) or installing additional
> pkgs (or ports).
> 
> One difference I see between pkg(8) periodic defaults and periodics
> from other pkgs/ports is
> 
>   pkg(8) has periodic defaults documented in a base man page
>   (i.e. periodic.conf(5)), whereas other ports and pkgs do not
> 
> That's generally a good thing -- more docs usually is :-).  But it seems
> like having info in a base man page means (implies?) that base defaults
> entries for it should also be present. The man page info alone is much
> better than having neither, of course.
> ...

Followup to myself...

This is probably a smaller issue, but there should likely be some change
to periodic.conf(5) man page regardless of pkg_ variables inclusion in
the /etc/defaults/periodic.conf file.

That is, today the pkg_* periodic variables are described in the man page
section which begins with this text:

    The following variables are used by the standard scripts that reside in
    /etc/periodic/weekly:
    ...

but that appears to not be accurate; i.e. these variables:

    weekly_status_pkg_enable
    pkg_version
    pkg_version_index

are used in ${_localbase}/etc/periodic/ rather than /etc/periodic/:

    $ grep -Rl pkg_ /etc/periodic/weekly/
    $ 
    $ grep -Rl pkg_ /usr/local/etc/periodic/weekly/
    /usr/local/etc/periodic/weekly/400.status-pkg
    $ uname -rv
    14.1-STABLE FreeBSD 14.1-STABLE stable/14-n268238-4f5440f2abe9 GENERIC

It's not a fatal problem, because at least the variables are documented.
But perhaps an additional man page section (after the daily, weekly,
monthly, and security variables sections?) which has something like:

    The following variables are used by the pkg scripts that reside in
    ${_localbase}/etc/periodic/weekly:
    ...

Cheers,
sr.