From ce8ae46054b2f399e1cf0a78f1f570492d52c925 Mon Sep 17 00:00:00 2001 From: Osama Albahrani <54853250+osalbahr@users.noreply.github.com> Date: Tue, 2 Sep 2025 22:38:48 +0300 Subject: [PATCH] config: prioritize `::OS_VERSION` On the [beta Bluefin LTS](https://docs.projectbluefin.io/lts), `brew config` reports: ```console OS: CentOS Stream release 10 (Coughlan) ``` This is due to the `/etc/redhat-release` file being prioritized over `::OS_VERSION` (`PRETTY_NAME` from `/etc/os-release`). On Bluefin LTS, `PRETTY_NAME` is `Bluefin LTS`. This commit reverses the order so `brew config` has better detection: ``` OS: Bluefin LTS ``` I tested on RHEL 10 and the OS line only changed in that the word "release" was omitted: ``` $ cat /etc/redhat-release Red Hat Enterprise Linux release 10.0 (Coughlan) $ grep PRETTY_NAME /etc/os-release PRETTY_NAME="Red Hat Enterprise Linux 10.0 (Coughlan)" ``` - This is an improvement on my previous PR https://github.com/Homebrew/brew/pull/15788 --- Library/Homebrew/os/linux.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/os/linux.rb b/Library/Homebrew/os/linux.rb index e605ae5eb0..25096f7ab5 100644 --- a/Library/Homebrew/os/linux.rb +++ b/Library/Homebrew/os/linux.rb @@ -29,10 +29,10 @@ module OS else "#{description} (#{codename})" end - elsif (redhat_release = Pathname.new("/etc/redhat-release")).readable? - redhat_release.read.chomp elsif ::OS_VERSION.present? ::OS_VERSION + elsif (redhat_release = Pathname.new("/etc/redhat-release")).readable? + redhat_release.read.chomp else "Unknown" end