-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
HardwareView: Fix fallback when hostname1 returns null values #355
base: main
Are you sure you want to change the base?
Conversation
Hi ryonakano! I'll do it tomorrow if you don't mind;) |
Thank you for your testing!
I guess this is because getting private string get_host_name () {
get_system_interface_instance ();
if (system_interface == null) {
return GLib.Environment.get_host_name ();
}
string? hostname = system_interface.pretty_hostname;
if (hostname == null || hostname.length == 0) {
hostname = system_interface.static_hostname; // maybe this still results null on your system
}
return hostname;
} I think this can be fixed by falling back to |
@pibiba Could you share the outputs of the following two commands?
|
Yes, sure:
|
Hostname1 interface is provided by systemd and Artix is a non-systemd distro 😅 |
Yes, we know. After all, the goal is to make pantheon work on non-systemd distros too. |
Yes, so the result of the dbus-send is expected, just wanted to make sure. I set up an Artix Base on a VM today, played with a test code, and noticed that It means private void get_system_interface_instance () {
if (system_interface == null) {
try {
system_interface = Bus.get_proxy_sync (
BusType.SYSTEM,
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1"
);
} catch (GLib.Error e) { // Never threw an error when the DBus name isn't provided
warning ("%s", e.message);
}
}
}
private string get_host_name () {
get_system_interface_instance ();
if (system_interface == null) { // Non-null even on Artix!
return GLib.Environment.get_host_name ();
} |
What if we force |
Please check this: private string get_host_name () {
get_system_interface_instance ();
if (system_interface != null) {
string? hostname = system_interface.pretty_hostname;
if (hostname == null || hostname.length == 0) {
hostname = system_interface.static_hostname;
}
return hostname ?? GLib.Environment.get_host_name ();
}
return GLib.Environment.get_host_name ();
} |
Yes, that would be a simple fix for this. I was wondering if we can check for existence of a name owner but my code has a racing issue so your idea would be a better solution here. https://github.com/elementary/switchboard-plug-about/tree/research/ryonakano/fix-fallback |
Excellent! It works! Thank you very much! |
Fixes #239
Fixes #338
@pibiba Could you test this PR if this really fix #338, using an environment without your workarounds like oem.conf? I haven't experienced Pantheon on Artix.