Bug 238953 - sysutils/etc_os-release: version number becomes obsolete after system updates
Summary: sysutils/etc_os-release: version number becomes obsolete after system updates
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tobias C. Berner
URL: https://reviews.freebsd.org/D22271
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-03 07:51 UTC by Ting-Wei Lan
Modified: 2019-11-08 16:26 UTC (History)
5 users (show)

See Also:
tcberner: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ting-Wei Lan 2019-07-03 07:51:50 UTC
Since this port records the version number of the system during the build, there is no way to update the version number stored in /usr/local/etc/os-release without rebuilding or updating the port. Therefore, the version number stored in the file becomes wrong as soon as the user updates the system with freebsd-update. Is it considered a problem, or it is just ignored?

I don't know what is the expected way to use the port, but it will be confusing to users if data stored in /usr/local/etc/os-release is used to show the version of the system. For example, gnome-control-center uses /etc/os-release to show OS version in its about page, and it is likely for a user to find the version number showed there is different from what freebsd-version command reports.
Comment 1 Tobias C. Berner freebsd_committer 2019-07-07 09:04:00 UTC
Hit there

Yeah, that is not great. But as long as that is not part of the base system there is no easy fix for this, other than following the rule to upgrade ports after a system upgrade.

As that file is only needed to display some Operating System information in Qt and Gtk applications, a slight mismatch won't likely cause any problems other than confusion :)


mfg Tobias
Comment 2 Ting-Wei Lan 2019-07-07 17:39:02 UTC
(In reply to Tobias C. Berner from comment #1)
Instead of shipping an os-release file directly in the package, do you think it will be better if it ships a script which can be used to update the os-release file? It can also include necessary files to update it during boot in a way similar to motd or drop a file into /usr/local/etc/cron.d to check and update it every hour.
Comment 3 Tobias C. Berner freebsd_committer 2019-07-07 17:49:23 UTC
(In reply to Ting-Wei Lan from comment #2)
That sounds like a bit of overkill for what we use it for at the moment. 
If stuff some day really requires it to be accurate, I think it should be shipped as part of the base system, and thereby be up to date through system upgrades.
Comment 4 nixuser 2019-09-01 09:35:21 UTC
Since the /usr/local/etc/os-release file is provided by the package etc_os-release can't the package version number simply be bumped, with the corrected text, so that it updates with a "pkg update && pkg upgrade" like other packages?  

This has caused me a lot of grief because although I could confirm my kernel upgraded correctly, I thought there was a userland upgrade issue because this file didn't upgrade with the userland programs.  I've been trying to hunt down what went wrong.  I think this issue is rather serious.

Is there a way to force the 11.3 version of etc_os-release package to replace the 11.2 version I have?
Comment 5 Tobias C. Berner freebsd_committer 2019-11-02 18:59:13 UTC
(In reply to nixuser from comment #4)

First of all, sorry for my long timeout here.


The only proper way is to ship this file in base -- our "well, at least we have something now"-workaround to shipping this file unfortunately has this limitation.

There is no good way to bump the pkg when needed (because how should the repo know when you updated your installation).

[Well the is a very overkill version: the port could install an rc-file that updates the ${PREFIX}/etc/os_release on boot :) ]


mfg Tobias
Comment 6 nixuser 2019-11-03 05:06:07 UTC
No Problem.

I created a script that can create the file manually as needed.  In the hope someone else may find it useful here it is:

#!/bin/sh
#
# This script will generate a new os-release file in the current directory.
# Normally the file lives in /usr/local/etc/ on freeBSD systems.

VERSION=`freebsd-version -u`
VERSION_ID=`echo "$VERSION" | sed "s/^\([0-9\.]*\).*$/\1/"`

echo "NAME=FreeBSD" > os-release
echo "VERSION=$VERSION" >> os-release
echo "VERSION_ID=$VERSION_ID" >> os-release
echo "ID=freebsd" >> os-release
echo "ANSI_COLOR=\"0;31\"" >> os-release
echo "PRETTY_NAME=\"FreeBSD $VERSION\"" >> os-release
echo "CPE_NAME=cpe:/o:freebsd:freebsd:$VERSION_ID" >> os-release
echo "HOME_URL=https://freebsd.org/" >> os-release
echo "BUG_REPORT_URL=https://bugs.freebsd.org" >> os-release
Comment 7 Warner Losh freebsd_committer 2019-11-07 01:52:12 UTC
This should be in base and generated on each boot...