Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS (Linux): prioritize prettyName over name #1038

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

xbt573
Copy link
Contributor

@xbt573 xbt573 commented Jun 24, 2024

PR title pretty much says all about changes in code. Currently fastfetch uses os-release's name over prettyName, which are not always equal (for example Gentoo's name is Gentoo, but prettyName is Gentoo Linux)

This change just swaps order of name and prettyName in if-else if-else chain

@CarterLi
Copy link
Member

CarterLi commented Jun 25, 2024

This PR is known to break alpine linux and debian.

The pretty name of apline linux is Alpine Linux v3.20 while its version is 3.20.0, which results in OS: Alpine Linux v3.20 3.20.0 aarch64

It may also break debian. We fetch point release version of debian in /etc/debian_version, while the pretty name of debian contains only the major version. so that fastfetch will print Debian GNU/Linux 12 (bookworm) 12.1 x86_64. See dylanaraps/neofetch#2381

@CarterLi
Copy link
Member

CarterLi commented Jun 25, 2024

Fastfetch uses NAME instead of PRETTY_NAME to generate more constant and accurate results. Unless this change gets tested in every linux distro, I want the old behavior being kept

@xbt573
Copy link
Contributor Author

xbt573 commented Jun 25, 2024

I tested some popular distros with docker (and my own Gentoo), and i can categorize the results into some categories:

  1. Everything is okay, name equals prettyName: Arch Linux, Clear Linux
  2. Everything is okay, prettyName contains version_id (version duplication prevented by condition): Fedora, RockyLinux
  3. Patch did output better: Alt Linux (Alt name is "starter kit"), Alma Linux (codename added, version duplication prevented by condition), Amazon Linux (version from prettyName is more verbose), Gentoo Linux
  4. Broken: Alpine Linux, Ubuntu Linux, Debian Linux

I propose these solutions:

  1. Introduce some sort of exception list, and use name over prettyName if exception list contains name
  2. Fuzzy version contains: Allow matching version in prettyName by parts, will help with v3.20-3.20.0 and similar, harder
  3. Don't include version if prettyName is used, radical but most of distros specify version in prettyName (8 of 11 tested, 2 is rolling)

I'm ready to assist with every solution you choose and test all fastfetch supported distros (by logo) if needed.

If none of solutions is suitable then just close this PR

@CarterLi
Copy link
Member

I would rather fix the name and version.

For example: test if prettyName contains name + " Linux"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants