From owner-svn-src-all@freebsd.org Sun Jul 21 16:59:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3A6BB8222 for ; Sun, 21 Jul 2019 16:59:01 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D5248708E for ; Sun, 21 Jul 2019 16:59:01 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1563728333; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=WvN4zCzVHZsAPL3IbK7AZGzlCNvE494rQKYSaqgGbwo15/4tgXE1OgJE/Wx6SPgyj5du0t/gh8hqh GinRuS0Lr66RTNXmocxHB7/ZeynDSwIh5S0JP5kXNAJ9/aIJkKQ4j+qUDRl9fifNn49q/GvaHwPgzQ vji6Rrc2pNa6snIflmRmBhI9BOckHb8MuijlzOIuEhd4HsbANTBKmaXM1Ay2wqGEYEaIetOiPT54is KhDMwOW6uNd50gWKUE7ZBeJg2hq+lM1ukTlAXa603oui57coPsB2Ospcg1h3EDw4BMFKU3B9swGQJ5 +llhuoMViLCcM3JOkA9JgwxeqoEhKxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=mw6yQv8J4XQOm7WZ6ETnqjS5yXJZDWKv/aSqN7OzDgQ=; b=mCnX4inmtU7g58aetAG3W13CGdCWy4RbwnJ58POsANFEs/HusY9ocmGHRPCVUKg13mjrZWXKUG/35 cJSZBarPFz3lee25SK/YuCy7hi6bwNessxB6uAC+HzkhlcLWtWxBL/Y0MgBSBJzxmRqWrlvQSli479 n0d5D/FF5y9mxBizg9Zj2JyHwhtUUZU4dhuVPZuz85ygCciDXD/Iie8662rjvjkpkLIO4VwOVWAKUS thmJXjOFk+8lY3lZ8LOUiPR/ljaqLa4bXlF8Cld4eqWAFxf5Ny/duG9cs8rkVm2xFVjHl98q5H/wAp swMm+U6ZsRa0z4mb+nj4fZ0o5VW1blw== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=mw6yQv8J4XQOm7WZ6ETnqjS5yXJZDWKv/aSqN7OzDgQ=; b=FIfrwlzElV3VRePvvqKJZkGVshQgII4KtdfF7o2maX6XI6dJbKOcrDtMU42YPcnFhlgXDfj9zEYl6 dWjSYyMdqfK6vorju5NDd+KKO6H4k9BbfMw34Jy5Pbzu439zByjDjcLUhgJrshoW393d67gEMSPVDR yXceYvSyVxGzSn+ihXe6Q4+TPrs9CuF+4xdxl8m4E/AKZzTaksf5yiBen7S77aLcBr5WUvRBo8bJqY svJD/3Cx29Qm1y+J536rwfvB02nuuIS6Cl9Iss0OpXGOHSbvoNji9Cmydzeop6nItMKrFqnNFzvZos 7l+QD5dIhsY2L8fZHnCeGgQKmq2nu2w== X-MHO-RoutePath: aGlwcGll X-MHO-User: cfc61ec5-abd8-11e9-90e8-c17e0c9f2e02 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id cfc61ec5-abd8-11e9-90e8-c17e0c9f2e02; Sun, 21 Jul 2019 16:58:51 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x6LGwnaH057414; Sun, 21 Jul 2019 10:58:49 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r350184 - in head: libexec/rc/rc.d release/picobsd/tinyware/login share/man/man5 usr.bin/login From: Ian Lepore To: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 21 Jul 2019 10:58:49 -0600 In-Reply-To: <201907202056.x6KKuWsF011171@repo.freebsd.org> References: <201907202056.x6KKuWsF011171@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D5248708E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.994,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jul 2019 16:59:01 -0000 On Sat, 2019-07-20 at 20:56 +0000, Conrad Meyer wrote: > Author: cem > Date: Sat Jul 20 20:56:31 2019 > New Revision: 350184 > URL: https://svnweb.freebsd.org/changeset/base/350184 > > Log: > motd: Generate from template to /var/run > > Update login(1), its manual pages, similar utilities, and motd.5 to > refer to > the new location. > > Suggested by: delphij@ (re: r349256) > Reviewed by: bcr (manpages), delphij > Differential Revision: https://reviews.freebsd.org/D20721 > > Added: > head/usr.bin/login/motd.template > - copied, changed from r350183, head/usr.bin/login/motd > Deleted: > head/usr.bin/login/motd > Modified: > head/libexec/rc/rc.d/motd > head/release/picobsd/tinyware/login/pathnames.h > head/share/man/man5/motd.5 > head/usr.bin/login/Makefile > head/usr.bin/login/login.1 > head/usr.bin/login/login.conf > head/usr.bin/login/pathnames.h > > Modified: head/libexec/rc/rc.d/motd > ===================================================================== > ========= > --- head/libexec/rc/rc.d/motd Sat Jul 20 20:47:07 2019 (r350183) > +++ head/libexec/rc/rc.d/motd Sat Jul 20 20:56:31 2019 (r350184) > @@ -4,48 +4,52 @@ > # > > # PROVIDE: motd > -# REQUIRE: mountcritremote > +# REQUIRE: mountcritremote FILESYSTEMS > # BEFORE: LOGIN > > . /etc/rc.subr > > name="motd" > -desc="Update /etc/motd" > +desc="Update /var/run/motd" > rcvar="update_motd" > start_cmd="motd_start" > stop_cmd=":" > > +COMPAT_MOTD="/etc/motd" > +TARGET="/var/run/motd" > +TEMPLATE="/etc/motd.template" > PERMS="644" > > motd_start() > { > - # Update kernel info in /etc/motd > + # Update kernel info in /var/run/motd > # Must be done *before* interactive logins are possible > # to prevent possible race conditions. > # > check_startmsgs && echo -n 'Updating motd:' > - if [ ! -f /etc/motd ]; then > - install -c -o root -g wheel -m ${PERMS} /dev/null > /etc/motd > + if [ ! -f "${TEMPLATE}" ]; then > + # Create missing template from existing regular motd > file, if > + # one exists. > + if [ -f "${COMPAT_MOTD}" ]; then > + sed '1{/^FreeBSD.*/{d;};};' "${COMPAT_MOTD}" > > "${TEMPLATE}" > + chmod $PERMS "${TEMPLATE}" > + rm -f "${COMPAT_MOTD}" > + else > + # Otherwise, create an empty template file. > + install -c -o root -g wheel -m ${PERMS} > /dev/null "${TEMPLATE}" > + fi > + # Provide compatibility symlink: > + if [ ! -h "${COMPAT_MOTD}" ]; then > + ln -sF "${TARGET}" "${COMPAT_MOTD}" > + fi > fi > > - if [ ! -w /etc/motd ]; then > - echo ' /etc/motd is not writable, update failed.' > - return > - fi > - > T=`mktemp -t motd` > uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0- > 9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T} > - awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print > "\n"$0}} else {print}}' < /etc/motd >> ${T} > + cat "${TEMPLATE}" >> ${T} > > - if ! cmp -s $T /etc/motd; then > - mv -f $T /etc/.motd.tmp > - fsync /etc/.motd.tmp > - mv -f /etc/.motd.tmp /etc/motd > - chmod ${PERMS} /etc/motd > - fsync /etc > - else > - rm -f $T > - fi > + install -C -o root -g wheel -m "${PERMS}" "$T" "${TARGET}" > + rm -f "$T" > > check_startmsgs && echo '.' > } > > Modified: head/release/picobsd/tinyware/login/pathnames.h > ===================================================================== > ========= > --- head/release/picobsd/tinyware/login/pathnames.h Sat Jul 20 > 20:47:07 2019 (r350183) > +++ head/release/picobsd/tinyware/login/pathnames.h Sat Jul 20 > 20:56:31 2019 (r350184) > @@ -39,7 +39,7 @@ > #include > > #define _PATH_HUSHLOGIN ".hushlogin" > -#define _PATH_MOTDFILE "/etc/motd" > +#define _PATH_MOTDFILE "/var/run/motd" > #define _PATH_LOGACCESS "/etc/login.access" > #define _PATH_FBTAB "/etc/fbtab" > #define _PATH_LOGINDEVPERM "/etc/logindevperm" > > Modified: head/share/man/man5/motd.5 > ===================================================================== > ========= > --- head/share/man/man5/motd.5 Sat Jul 20 20:47:07 2019 (r350 > 183) > +++ head/share/man/man5/motd.5 Sat Jul 20 20:56:31 2019 (r350 > 184) > @@ -3,7 +3,7 @@ > .\" This file is in the public domain. > .\" $FreeBSD$ > .\" > -.Dd February 13, 1997 > +.Dd July 20, 2019 > .Dt MOTD 5 > .Os > .Sh NAME > @@ -11,13 +11,16 @@ > .Nd file containing message(s) of the day > .Sh DESCRIPTION > The file > -.Pa /etc/motd > +.Pa /var/run/motd > is normally displayed by > .Xr login 1 > after a user has logged in but before the shell is run. > It is generally used for important system-wide announcements. > During system startup, a line containing the kernel version string > is > -prepended to this file. > +prepended to > +.Pa /etc/motd.template > +and the contents are written to > +.Pa /var/run/motd . > .Pp > Individual users may suppress the display of this file by > creating a file named > @@ -26,11 +29,13 @@ in their home directories or through > .Xr login.conf 5 . > .Sh FILES > .Bl -tag -width $HOME/.hushlogin -compact > -.It Pa /etc/motd > +.It Pa /etc/motd.template > +The template file that system administrators can edit. > +.It Pa /var/run/motd > The message of the day. > .It Pa $HOME/.hushlogin > Suppresses output of > -.Pa /etc/motd . > +.Pa /var/run/motd . > .El > .Sh EXAMPLES > .Bd -literal > @@ -41,3 +46,9 @@ FreeBSD 2.1.6.1-RELEASE (GENERIC) #0: Sun Dec 29 > 03:08 > .Sh SEE ALSO > .Xr login 1 , > .Xr login.conf 5 > +.Sh HISTORY > +Prior to > +.Fx 13.0 , > +.Nm > +lived in > +.Pa /etc . > > Modified: head/usr.bin/login/Makefile > ===================================================================== > ========= > --- head/usr.bin/login/Makefile Sat Jul 20 20:47:07 2019 (r350 > 183) > +++ head/usr.bin/login/Makefile Sat Jul 20 20:56:31 2019 (r350 > 184) > @@ -3,7 +3,7 @@ > > .include > > -CONFS= fbtab login.conf motd login.access > +CONFS= fbtab login.conf motd.template login.access > PROG= login > SRCS= login.c login_fbtab.c > CFLAGS+=-DLOGALL > > Modified: head/usr.bin/login/login.1 > ===================================================================== > ========= > --- head/usr.bin/login/login.1 Sat Jul 20 20:47:07 2019 (r350 > 183) > +++ head/usr.bin/login/login.1 Sat Jul 20 20:56:31 2019 (r350 > 184) > @@ -28,7 +28,7 @@ > .\" @(#)login.1 8.2 (Berkeley) 5/5/94 > .\" $FreeBSD$ > .\" > -.Dd September 13, 2006 > +.Dd July 20, 2019 > .Dt LOGIN 1 > .Os > .Sh NAME > @@ -131,7 +131,7 @@ result in an error exit from > changes device protections > .It Pa /etc/login.conf > login class capabilities database > -.It Pa /etc/motd > +.It Pa /var/run/motd > message-of-the-day > .It Pa /var/mail/user > system mailboxes > > Modified: head/usr.bin/login/login.conf > ===================================================================== > ========= > --- head/usr.bin/login/login.conf Sat Jul 20 20:47:07 2019 (r350 > 183) > +++ head/usr.bin/login/login.conf Sat Jul 20 20:56:31 2019 (r350 > 184) > @@ -25,7 +25,7 @@ > default:\ > :passwd_format=sha512:\ > :copyright=/etc/COPYRIGHT:\ > - :welcome=/etc/motd:\ > + :welcome=/var/run/motd:\ > :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ > :path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin > /usr/local/bin ~/bin:\ > :nologin=/var/run/nologin:\ > @@ -120,7 +120,7 @@ russian|Russian Users Accounts:\ > ## > #standard:\ > # :copyright=/etc/COPYRIGHT:\ > -# :welcome=/etc/motd:\ > +# :welcome=/var/run/motd:\ > # :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ > # :path=~/bin /bin /usr/bin /usr/local/bin:\ > # :manpath=/usr/share/man /usr/local/man:\ > > Copied and modified: head/usr.bin/login/motd.template (from r350183, > head/usr.bin/login/motd) > ===================================================================== > ========= > --- head/usr.bin/login/motd Sat Jul 20 20:47:07 2019 (r350183, > copy source) > +++ head/usr.bin/login/motd.template Sat Jul 20 20:56:31 2019 (r350 > 184) > @@ -1,4 +1,3 @@ > -FreeBSD ?.?.? (UNKNOWN) > > Welcome to FreeBSD! > > @@ -18,4 +17,4 @@ Please include that output and any error messages > when > Introduction to manual pages: man man > FreeBSD directory layout: man hier > > -Edit /etc/motd to change this login announcement. > +Edit /etc/motd.template to change this login announcement. > > Modified: head/usr.bin/login/pathnames.h > ===================================================================== > ========= > --- head/usr.bin/login/pathnames.h Sat Jul 20 20:47:07 2019 (r350 > 183) > +++ head/usr.bin/login/pathnames.h Sat Jul 20 20:56:31 2019 (r350 > 184) > @@ -35,6 +35,6 @@ > #include > > #define _PATH_HUSHLOGIN ".hushlogin" > -#define _PATH_MOTDFILE "/etc/motd" > +#define _PATH_MOTDFILE "/var/run/motd" > #define _PATH_FBTAB "/etc/fbtab" > #define _PATH_LOGINDEVPERM "/etc/logindevperm" > This change doesn't appear to provide any mechanism for maintaining historic behavior of having an immutable /etc/motd file that gets presented to the user. If you set motd_enable=false there will be nothing in /var/run/motd so nothing will be presented to the user at login. Otherwise you end up with the user seeing a modified copy of the motd file. We have products that are mandated by the customer (and I believe by law in some cases) to provide specific exact text at login, and now I think there is no straighforward way to achieve that. -- Ian