Skip to content

Commit 6bad125

Browse files
authored
Merge pull request #6 from Ryanmello07/upstream/gui-fixes
gui: initialize the SDK on the primary instance only, and fix the resolv.conf log line
2 parents fc44b1e + 13a271a commit 6bad125

2 files changed

Lines changed: 35 additions & 6 deletions

File tree

app/src/Tunnel.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2887,8 +2887,21 @@ DnsHostProbe ProbeDnsHost() {
28872887
(!p.resolvconf_present ? "absent"
28882888
: (p.resolvconf_is_resolvectl ? "is resolvectl's shim"
28892889
: "present")) +
2890-
", " + kResolvConfPath + " -> " +
2891-
(p.resolv_conf_realpath.empty() ? std::string("(missing)") : p.resolv_conf_realpath) +
2890+
", " + kResolvConfPath +
2891+
// ONLY render the arrow when the path actually resolves somewhere ELSE.
2892+
// On Arch/CachyOS /etc/resolv.conf is commonly a REGULAR FILE that
2893+
// systemd-resolved writes in place rather than a symlink into its
2894+
// runtime dir, so realpath() returns the path itself and the old
2895+
// unconditional " -> " printed
2896+
// /etc/resolv.conf -> /etc/resolv.conf (resolved's)
2897+
// which reads as a self-referential symlink and sent a tester's log
2898+
// triage chasing a misdetection that was not there. The tier
2899+
// selection was always correct; only this line was wrong.
2900+
(p.resolv_conf_realpath.empty()
2901+
? std::string(" missing")
2902+
: (p.resolv_conf_realpath == kResolvConfPath
2903+
? std::string(" is a regular file")
2904+
: " -> " + p.resolv_conf_realpath)) +
28922905
(p.resolv_conf_points_at_resolved ? " (resolved's)" : "");
28932906
return p;
28942907
}

app/src/main.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ int main(int argc, char** argv) {
6969
// glibmm on core24 (the 2.68 ABI series) has no Glib::get_user_state_dir wrapper;
7070
// call the C g_get_user_state_dir() (glib 2.72+) directly for XDG_STATE_HOME.
7171
const std::string logDir = EnsureDir(g_get_user_state_dir(), "urnetwork");
72-
if (!host->Initialize(storageDir, logDir)) {
73-
g_printerr("failed to initialize SDK\n");
74-
return 1;
75-
}
7672

7773
// Must match the .desktop StartupWMClass + common-id so the shell associates
7874
// the window with the app (and the hide-to-tray window keeps its identity).
@@ -88,6 +84,26 @@ int main(int argc, char** argv) {
8884
std::shared_ptr<urnw::Tray> tray;
8985

9086
app->signal_startup().connect([&] {
87+
// SDK INIT BELONGS HERE, NOT BEFORE app->run(). GApplication only decides
88+
// primary-vs-remote inside run(), so anything above it executes in EVERY
89+
// launch -- including a duplicate that is about to hand off to the running
90+
// instance and exit. signal_startup is emitted on the PRIMARY only.
91+
//
92+
// That distinction is not cosmetic. SdkHost::Initialize calls
93+
// urnet::setLogDir(), which runs the SDK's glog init: it sweeps the log
94+
// directory down to a keep-N budget and rewrites the
95+
// urnetwork-gui.{INFO,WARNING,ERROR} symlinks. A tester's bundle caught it
96+
// -- a second launch deleted three of the seven log files and left
97+
// urnetwork-gui.INFO, the file any "grab the current log" step follows,
98+
// naming its own 846-byte stub while the session that was actually running
99+
// had a 1.5 MB log the symlink no longer pointed at. Initialize also opens
100+
// the shared storage dir, which a process about to exit has no business
101+
// touching.
102+
if (!host->Initialize(storageDir, logDir)) {
103+
g_printerr("failed to initialize SDK\n");
104+
app->quit();
105+
return;
106+
}
91107
adw_init(); // libadwaita stylesheet + platform integration
92108
// the brand visual system is dark (mac app parity); the Ui.cpp stylesheet
93109
// layers the exact palette on top

0 commit comments

Comments
 (0)