Skip to content

Strip hostnamectl icons#1909

Merged
jaymzh merged 3 commits intochef:mainfrom
nvwls:strip-hostnamectl-icons
Jan 28, 2026
Merged

Strip hostnamectl icons#1909
jaymzh merged 3 commits intochef:mainfrom
nvwls:strip-hostnamectl-icons

Conversation

@nvwls
Copy link
Copy Markdown
Contributor

@nvwls nvwls commented Dec 27, 2025

Description

In RHEL 10 (and other modern systemd-based distributions), the hostnamectl command has been updated to include visual icons using UTF-8 characters for the Chassis field.

This change is part of the upstream systemd project's effort to make the CLI output more visually informative for users. Instead of just seeing the word "laptop" or "server," you now see a corresponding symbol.

This leads to following:

warning: JSON.generate: UTF-8 string passed as BINARY, this will raise an
encoding error in json 3.0

Related Issue

#1908

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

In RHEL 10 (and other modern systemd-based distributions), the hostnamectl
command has been updated to include visual icons using UTF-8 characters for
the Chassis field.

This change is part of the upstream systemd project's effort to make the CLI
output more visually informative for users. Instead of just seeing the word
"laptop" or "server," you now see a corresponding symbol.

This leads to following:
```
warning: JSON.generate: UTF-8 string passed as BINARY, this will raise an
encoding error in json 3.0
```

Signed-off-by: Joseph J Nuspl Jr <nuspl@nvwls.com>
@nvwls nvwls requested review from a team and jaymzh as code owners December 27, 2025 21:50
@johnmccrae johnmccrae added the Status: Waiting on Contributor A pull request that has unresolved requested actions from the author. label Dec 30, 2025
@nvwls
Copy link
Copy Markdown
Contributor Author

nvwls commented Jan 13, 2026

That regex works except for the tablet emoji which is CJK

https://github.com/systemd/systemd/blob/main/src/hostname/hostnamectl.c#L82

I'll add a .tr to strip out that icon.

Add unit tests.

Signed-off-by: Joseph J Nuspl Jr <nuspl@nvwls.com>
@nvwls
Copy link
Copy Markdown
Contributor Author

nvwls commented Jan 19, 2026

@jaymzh Please review the updated changes.

@jaymzh
Copy link
Copy Markdown
Collaborator

jaymzh commented Jan 27, 2026

ping @nvwls

Signed-off-by: Joseph J Nuspl Jr <nuspl@nvwls.com>
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Collaborator

@jaymzh jaymzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks.

I will say, I think we should extend the tests to have the emoji tested in places other than just the end of the line, but since that's where they are today, I'm not gonna block on that.

I've requested the tests unblocked, and then we'll merge.

@jaymzh jaymzh merged commit aabc1bc into chef:main Jan 28, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Waiting on Contributor A pull request that has unresolved requested actions from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants