From nobody Tue Oct 19 10:55:26 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 95B8F1805B26 for ; Tue, 19 Oct 2021 10:55:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HYVyQ3gKPz4sXV for ; Tue, 19 Oct 2021 10:55:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F7071308D for ; Tue, 19 Oct 2021 10:55:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 19JAtQ1A044924 for ; Tue, 19 Oct 2021 10:55:26 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 19JAtQuq044923 for bugs@FreeBSD.org; Tue, 19 Oct 2021 10:55:26 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259265] PERIODIC DAILY script errors (under certain circumstances) Date: Tue, 19 Oct 2021 10:55:26 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: iandstanley@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N 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.=