[Bug 282614] ${LOCALBASE}/etc/periodic.conf is ignored

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 07 Nov 2024 19:59:44 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282614

            Bug ID: 282614
           Summary: ${LOCALBASE}/etc/periodic.conf is ignored
           Product: Base System
           Version: 14.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: conf
          Assignee: bugs@FreeBSD.org
          Reporter: freebsd@oldach.net

Fresh install from
FreeBSD-14.2-PRERELEASE-amd64-20241031-25ad37c9532b-269367-disc1.iso:

toor@t:/ # cd /usr/local
toor@t:/usr/local/etc # mkdir -p etc/periodic/test
toor@t:/usr/local/etc # cat >etc/periodic/test/test <<EOF
#!/bin/sh

if [ -r /etc/defaults/periodic.conf ]; then
        . /etc/defaults/periodic.conf
        source_periodic_confs
fi

echo "_localbase=\"\${_localbase}\""
echo "periodic_conf_files=\"\${periodic_conf_files}\""
EOF
toor@t:/usr/local/etc # chmod +x etc/periodic/test/test
toor@t:/usr/local/etc # periodic test
_localbase=""
periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local
/etc/periodic.conf"
toor@t:/usr/local/etc # 

${LOCALBASE}/etc/periodic.conf is not read as it is not mentioned in
${periodic_conf_files}. Result is, one cannot define variables for local
periodic scripts in the local periodic.conf but they have to go into the global
/etc/periodic.conf, which isn't desireable and collides with documentation.

We can make it work by tweaking the scope of _localbase (defined by
/usr/sbin/periodic):

toor@t:/usr/local/etc # echo export _localbase >etc/periodic.conf
toor@t:/usr/local/etc # periodic test
_localbase="/usr/local"
periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local
/usr/local/etc/periodic.conf"
toor@t:/usr/local/etc # 

_localbase should be exported from /usr/sbin/periodic?

-- 
You are receiving this mail because:
You are the assignee for the bug.