port: sysutils/plasma5-kinfocenter After install the kde5 by ports, after run systemsetting, click "System Information" (which I believe is actually calling kinfocenter, the window reminds me my system is FreeBSD 12.1, but it is 12.2. "uname -a" gives "FreeBSD HPC-BSD 12.2-RELEASE FreeBSD 12.2-RELEASE r367095 GENERIC amd64" so I checked the pkg-plist file, and it seems would install "/usr/local/etc/xdg/kcm-about-distrorc file. which is as follows: [General] Name=FreeBSD LogoPath=/usr/local/share/kinfocenter/images/freebsd_logo.svg Website=https://www.freebsd.org After I add a line "Version=12.2" the kinfocenter gives right FreeBSD release version information. But I've checked the "kinfocenter/Modules/about-distro/src/KernelEntry.cpp" file, which include the '<sys/utsname.h>', and looks like: KernelEntry::KernelEntry() : Entry(ki18n("Kernel Version:"), kernelVersion()) { } QString KernelEntry::kernelVersion() { struct utsname utsName; if (uname(&utsName) == 0) { return QString::fromLatin1(utsName.release); } return QString(); } which means kinfocenter would give correct version number even without "Version=12.2" in kcm-about-distrorc file. So I add a line to printf the utsName.release as: if (uname(&utsName) == 0) { printf("*******:%s\n", utsName.release); return QString::fromLatin1(utsName.release); } But strange thing happened, after I run /usr/ports/.../stage/usr/local/bin/kinfocenter, there is nothing show out on console related with "prinf...". It looks like this code had not been executed at all. So, I was totally confused, and the only thing I can do is reported to you. Thanks alot.
does it read /var/run/os-release?
(In reply to Mikael Urankar from comment #1) No, It did not read the /var/run/os-release on my PC, the output of "cat /var/run/os-release" are: NAME=FreeBSD VERSION=12.2-RELEASE VERSION_ID=12.2 ID=freebsd ANSI_COLOR="0;31" PRETTY_NAME="FreeBSD 12.2-RELEASE" CPE_NAME=cpe:/o:freebsd:freebsd:12.2 HOME_URL=https://FreeBSD.org/ BUG_REPORT_URL=https://bugs.FreeBSD.org/ So the bug is somehow the program does not take release information using "uname" function defined in <sys/utsname.h>, instead of read the 12.1 string form some place..... By the way, my os is upgraded from 12.2 according to handbook by source. But both the "uanme -a" "freebsd-version" gives "12.2", So I was really confused by where the "12.1" came from.
(In reply to Mikael Urankar from comment #1) No, It did not read the /var/run/os-release on my PC, the output of "cat /var/run/os-release" are: NAME=FreeBSD VERSION=12.2-RELEASE VERSION_ID=12.2 ID=freebsd ANSI_COLOR="0;31" PRETTY_NAME="FreeBSD 12.2-RELEASE" CPE_NAME=cpe:/o:freebsd:freebsd:12.2 HOME_URL=https://FreeBSD.org/ BUG_REPORT_URL=https://bugs.FreeBSD.org/ So the bug is somehow the program does not take release information using "uname" function defined in <sys/utsname.h>, instead of read the "12.1" from some place..... By the way, my os is upgraded from 12.1 according to handbook by source. But both the "uanme -a" "freebsd-version" gives "12.2", So I was really confused by where the "12.1" came from.
Created attachment 219631 [details] v1 Can you try the attached patch (suggested by tcberner@)? or just edit /usr/local/etc/xdg/kcm-about-distrorc as root and add this line: UseOSReleaseVersion=true
(In reply to Mikael Urankar from comment #4) Hi, Miakel: Thanks for your patch, but things get more strange. After I add "UseOSReleaseVersion=true" into "/usr/local/etc/xdg/kcm-about-distrorc". Now the kinfocenter gives "FreeBSD 12.1-RLEASE-p10" above the "https://www.freebsd.org". If I remove this line, the information was "FreeBSD 12.1" The following version information seems ok: ... Qt Version: 5.15.0 Kernel Version: 12.2-RELEASE OS Type: 64-bit So, sadly, it did not work on my computer, I think maybe there is some "12.1-RLEASE-p10" string in some place of my system, since I upgrade it from 12.1-RELEASE-p10 to 12.2 by rebuilding the word. my /usr/src fold is totally 12.2 release, and the upgrade process was followed by FreeBSD Handbook.
ls -l /etc/os-release if it's not a symlink to /var/run/os-release, post the content of the file
(In reply to Mikael Urankar from comment #6) Thanks for your kind help, I am sorry for I can not test it until next monday. I would reply your ASAP. Thanks again.
For @marshall, you could try the following program, just to see if the `uname()` function which **presumably** is being called by kinfocenter, is returning the thing that you think it is (or what it should be): ``` #include <sys/utsname.h> #include <stdio.h> int main(int argc, char** argv) { struct utsname u; int r = uname(&u); printf("%d: %s\n", r, r ? "<error>" : u.release); return 0; } ``` After that, check if the environment variable affects this program, and also kinfocenter: ``` UNAME_r="derpderp" kinfocenter UNAME_r="derpderp" ./a.out ``` (Both of those should show "derpderp" as kernel version, because the environment variable takes precedence).
(In reply to Mikael Urankar from comment #6) The output of "ls -l /etc/os-release" is: /etc/os-release -> ../var/run/os-release and output of "cat /var/run/os-release" is: NAME=FreeBSD VERSION=12.2-RELEASE VERSION_ID=12.2 ID=freebsd ANSI_COLOR="0;31" PRETTY_NAME="FreeBSD 12.2-RELEASE" CPE_NAME=cpe:/o:freebsd:freebsd:12.2 HOME_URL=https://FreeBSD.org/ BUG_REPORT_URL=https://bugs.FreeBSD.org/
(In reply to Adriaan de Groot from comment #8) Okey, I made a test.c file with what you give me and compile it by clang here is the test output: $ ./a.out 0: 12.2-RELEASE $ UNAME_r="derpderp" ./a.out 0: derpderp $ UNAME_r="something_not_fun" ./a.out 0: something_not_fun But this is still weird, it can not explain where is the "12.1-P10" comes from. Anyway, thanks.
Hi, all: I have no choice but read the kinfocenter source code more carefully, Now I have a little knowledge of what function in KDE gives the mistake-version string. The related source code is "kinfocenter/Modules/about-distro/src/Module.cpp" after line 104: void Module::loadOSData() { ...... KOSRelease os; ...... // well this line is okey with kcm-about-distrorc file const QString distroName = cg.readEntry("Name", os.name()); // and this line gives the wrong version string const QString osrVersion = cg.readEntry("UseOSReleaseVersion", false) ? os.version() : os.versionId(); const QString versionId = cg.readEntry("Version", osrVersion); ...... } case 1: say there is no Version and UseOSReleaseVersion information, osrVersion=os.version() which is 12.1 defined by KDE KOSRelease module and if UseOSRleaseVersion=true, then osrVersion=os.versionId(), which is "12.1-RELEASE-p10" case 2: say I set Version=12.2 then versionId = 12.2 Okey, So we know the class KOSRelease os gives wrong string. So Trace it into "/coreaddons/src/lib/util/kosrelease.cpp" and find it would read /etc/os-release file as: static QString defaultFilePath() { if (QFile::exists(QStringLiteral("/etc/os-release"))) { return QStringLiteral("/etc/os-release"); } else if (QFile::exists(QStringLiteral("/usr/lib/os-release"))) { return QStringLiteral("/usr/lib/os-release"); } else { return QString(); } } The I cat "/etc/os-release", it gives: NAME=FreeBSD VERSION=12.2-RELEASE VERSION_ID=12.2 ID=freebsd ANSI_COLOR="0;31" PRETTY_NAME="FreeBSD 12.2-RELEASE" CPE_NAME=cpe:/o:freebsd:freebsd:12.2 HOME_URL=https://FreeBSD.org/ BUG_REPORT_URL=https://bugs.FreeBSD.org/ This is crazy. everything looks okey, but where is the "12.1-RELEASE-p10" comes from?
Hi, all: Today I get sometime and finally solved this little problem. Here is what I've done. 1.I try to find all os-release file in my computer: > cd / > locate os-release then I get the output as: /compat/linux/etc/centos-release /compat/linux/etc/centos-release-upstream /compat/linux/etc/os-release /compat/linux/usr/lib/os-release /compat/linux/usr/share/centos-release /compat/linux/usr/share/centos-release/EULA /compat/linux/usr/share/doc/centos-release /compat/linux/usr/share/doc/centos-release/Contributors /compat/linux/usr/share/doc/centos-release/GPL /etc/os-release /etc/rc.d/os-release /usr/local/etc/os-release /usr/obj/usr/src/amd64.amd64/share/man/man5/os-release.5.gz /usr/ports/sysutils/etc_os-release /usr/ports/sysutils/etc_os-release/Makefile /usr/ports/sysutils/etc_os-release/pkg-descr /usr/share/man/man5/os-release.5.gz /usr/src/libexec/rc/rc.d/os-release /usr/src/share/man/man5/os-release.5 /var/db/etcupdate/current/etc/os-release /var/db/etcupdate/current/etc/rc.d/os-release /var/run/os-release 2. It seems only 4 files looks related with the bug /etc/os-release /etc/rc.d/os-release /usr/local/etc/os-release /var/run/os-release so I `cat` them one by one, and find the 12.1-p10 comes from /usr/local/etc/os-release, which means this file have not been upgraded after I upgrade the system from 12.1 to 12.2. 3. Solve the problem After I overwrite the /usr/local/etc/os-release by /etc/os-release, now the kinfocenter dialog can gives right version. 4. still confuse me Since the source code of plasma5 indicate that they read the release info. only from "/etc/os-release" and "/usr/lib/os-release", why my "/etc/os-release" does not work and strangely read the "/usr/local/etc/os-release" file. 5. recommendation I think it is better to remove the "/usr/local/etc/os-release" on future releases, or add some automatic process to overwrite it after the user install the world.
I think you shouldn't delete /usr/local/etc/os-release. This file is installed by the sysutils/etc_os-release package or port https://svnweb.freebsd.org/ports/head/sysutils/etc_os-release/pkg-descr?revision=HEAD. It is enough to do the following: portsnap fetch extract cd /usr/ports/sysutils/etc_os-release make deinstall reinstall clean Or do the same with a package.
(In reply to Serge Volkov from comment #13) Thanks a lot. You are right, the '/usr/ports/sysutils/etc_os-release' would generate that /usr/local/etc/os-release file correctly, which has the same contents of /etc/os-release generated by make install the 12.2 world. I do not what's the point for that port, and still make me confused when and why kinfocenter read that file instead of /etc/os-release. Anyway, the problem was solved, and thanks for all you kind people.
os-release is part of base in 12.2, the sysutils/etc_os-release servers no purpose on 12.2 sysutils/gnome-control-center and devel/qt5-core should be fixed and not impose sysutils/etc_os-release on 12.2
Created attachment 220160 [details] v0 fix dep
@mikael, lgtm to both patches -- v0 should likely get PORTREVISION bumps though. mfg Tobias
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=1ef5284b234036d33f1afbbfc4c1e4a67dafdf3f commit 1ef5284b234036d33f1afbbfc4c1e4a67dafdf3f Author: Mikael Urankar <mikael@FreeBSD.org> AuthorDate: 2021-04-22 22:14:37 +0000 Commit: Adriaan de Groot <adridg@FreeBSD.org> CommitDate: 2021-04-22 23:10:06 +0000 Handle os-release more smartly The Qt ports, and GNOME control center, can read /etc/os-release, and have patches to read /usr/local/etc/os-release -- however, the two files update differently, and /etc/os-release is preferred. Tighten up the .if to select when to depend on the extra port for /usr/local/etc/os-release (basically: pre 11.4 and 12.1) - Bumps PORTREVISION because dependencies may change. - Note that I used the --author command-line option to set that mikael@ wrote this patch. PR: 251073 devel/qt5-core/Makefile | 6 ++---- sysutils/gnome-control-center/Makefile | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=c237911a72ac5890045007e7929954a9d48eee96 commit c237911a72ac5890045007e7929954a9d48eee96 Author: Adriaan de Groot <adridg@FreeBSD.org> AuthorDate: 2021-04-26 11:47:25 +0000 Commit: Adriaan de Groot <adridg@FreeBSD.org> CommitDate: 2021-04-26 14:38:11 +0000 [Qt, GNOME] Handle os-release a little more smartly Synth -- and therefore not all FreeBSD installations that *could* have an /etc/os-release, or that *ought* to have an os-release file at runtime -- doesn't have the RC script installed, so was triggering the "depend on ports os-release" clause. Partly revert, to checking for existence, but **also** assume that sufficiently-new 13 (or later) releases have os-release in base. This means that 12.2 (which ought to have it) will rely on base, while 12.1 and 11.4 and other legacy releases will rely on the port. PR: 255354 251073 devel/qt5-core/Makefile | 9 +++++++-- sysutils/gnome-control-center/Makefile | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-)