Bug 263969 - Trailing whitespace change to uname -v output not carried to motd
Summary: Trailing whitespace change to uname -v output not carried to motd
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.1-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-14 11:30 UTC by jarrod
Modified: 2022-05-14 11:30 UTC (History)
0 users

See Also:


Attachments
libexec/rc/rc.d/motd patch (461 bytes, patch)
2022-05-14 11:30 UTC, jarrod
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jarrod 2022-05-14 11:30:43 UTC
Created attachment 233907 [details]
libexec/rc/rc.d/motd patch

Commit ed87197672b44f7f76b38e6450df2b4071c88a67 to usr.bin/uname/uname.c removed a trailing space from the end of "uname -v" output however this was not carried through to the regular expression used in libexec/rc/rc.d/motd.

Prior to the removal, the installed /etc/rc.d/motd script would update /etc/motd (now /var/run/motd) with output similar to below.

amnesiac> uname -v | tr " " "-"
FreeBSD-13.0-RELEASE-p7-#8:-Thu-Feb--3-17:40:35-ACDT-2022-----root@amnesiac:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-
amnesiac> grep "uname -v" /etc/rc.d/motd | sed "s# >.*##" | sh         <-- example to run the included rc.d/motd regex
FreeBSD 13.0-RELEASE-p7 (GENERIC) #8: Thu Feb  3 17:40:35 ACDT 2022    <-- note the GENERIC kernel name and removed path
amnesiac>

Having now updated the host to FreeBSD 13.1-RELEASE, the output is no longer modified.

amnesiac> uname -v | tr " " "-"
FreeBSD-13.1-RELEASE-#15:-Sat-May-14-17:38:59-ACST-2022-----root@amnesiac:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
amnesiac> grep "uname -v" /etc/rc.d/motd | sed "s# >.*##" | sh
FreeBSD 13.1-RELEASE #15: Sat May 14 17:38:59 ACST 2022     root@amnesiac:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
amnesiac>

The attached patch makes the trailing space optional to the regular expression though it may be more appropriate to drop the requirement for the trailing space altogether. This restores the previous behaviour.

amnesiac> uname -v | tr " " "-"
FreeBSD-13.1-RELEASE-#15:-Sat-May-14-17:38:59-ACST-2022-----root@amnesiac:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
amnesiac> grep "uname -v" /etc/rc.d/motd | sed "s# >.*##" | sh
FreeBSD 13.1-RELEASE (GENERIC) #15: Sat May 14 17:38:59 ACST 2022
amnesiac>