Date: Tue, 19 Oct 2021 10:55:26 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259265] PERIODIC DAILY script errors (under certain circumstances) Message-ID: <bug-259265-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259265 Bug ID: 259265 Summary: PERIODIC DAILY script errors (under certain circumstances) Product: Base System Version: 13.0-STABLE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: iandstanley@gmail.com Created attachment 228831 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D228831&action= =3Dedit patched version of periodic with correct path ENVIRONMENT """"""""""" - Running FreeBSD 13.0 uname -a=20 FreeBSD frodo 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr 9 04:24:09 UTC 2021=20=20=20=20 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 - GNU mailutils installed (either explicitly or as in my case as a by-produ= ct of installing another tool). PERIODIC DAILY SCRIPT """"""""""""""""""""" I am using the unmodified daily script shipped with 13.0-release HISTORY """"""" Something I noticed recently that my periodic daily script wasn't running properly as I was getting mail complaining about the -s flag. It was working after original install but now complains despite not touching the script. REPRODUCING """"""""""" 1. Install Freebsd 13.0-release 2. Check periodic daily can be run with 'sudo periodic daily' 3. Install emacs with 'sudo pkg install emacs-nox' 4. Check periodic daily can be run with 'sudo periodic daily' Example test run:=20 ian@frodo:/etc $ sudo periodic daily Password: mail: Unknown command: -s This works without error if you pkg remove emacs-nox, change the path to use /usr/bin before /usr/local/bin or as I noticed it I switched to csh which I have a different path order in $PATH DIAGNOSIS """"""""" The 'bug' [not really a bug but more of an oversight] is that GNU mail from mailutils doesn't like the -s flag in line 24 I think this is because GNU mail is interpreting the -E flag differently. Some may argue that /usr/local/bin should come after /usr/bin but there are valid reasons for a user to place /usr/local/bin prior to /usr/bin in their path (eg deliberately overriding the internal tools).=20 It is better to be explicit where there is a chance of both BSD and GNU too= ls being installed particularly when using switches that aren't cross compatib= le SOLUTION """""""" give the full path to the BSD mail tool so that the user's environment does= n't override and mess up the script. As emacs-nox installs the gnu mailtutils with GNU's own mail util it will depend on the user's environment variable as to which mail tool is run. Using the full path (patch below) will ensure that FreeBSD uses it's own to= ol and prevents GNU from messing up the system. PATCH """"" root@frodo:/usr/sbin # diff -u periodic periodic_fixed --- periodic 2021-10-19 11:15:24.731207000 +0100 +++ periodic_fixed 2021-10-19 11:15:18.282797000 +0100 @@ -21,7 +21,7 @@ case "$output" in /*) pipe=3D"cat >>$output";; "") pipe=3Dcat;; - *) pipe=3D"mail -E -s '$host ${2}${2:+ }${1##*/} run output' $output"= ;; + *) pipe=3D"/usr/bin/mail -E -s '$host ${2}${2:+ }${1##*/} run output' $output";; esac eval $pipe } thanks --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-259265-227>