Skip to content

gui: initialize the SDK on the primary instance only, and fix the resolv.conf log line - #6

Merged
Ryanmello07 merged 1 commit into
urnetwork:mainfrom
Ryanmello07:upstream/gui-fixes
Aug 21, 2026
Merged

gui: initialize the SDK on the primary instance only, and fix the resolv.conf log line#6
Ryanmello07 merged 1 commit into
urnetwork:mainfrom
Ryanmello07:upstream/gui-fixes

Conversation

@Ryanmello07

@Ryanmello07 Ryanmello07 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Two independent fixes, both found by reading a tester's log bundle rather than by
reading the code.

1. SDK init ran on every launch, including duplicates

SdkHost::Initialize() was called before app->run(). GApplication only decides
primary-vs-remote inside run(), so that code executes in every process that
starts — including a second launch that is about to hand its arguments to the
running instance and exit.

That is not a harmless double-init. Initialize() calls urnet::setLogDir(),
which runs the SDK's glog init: it sweeps the log directory down to a keep-N
budget and rewrites the urnetwork-gui.{INFO,WARNING,ERROR} symlinks. In the
bundle, a second launch deleted three of the seven log files and left
urnetwork-gui.INFO — the file every "grab the current log" instruction follows
— naming its own 846-byte stub, while the session that was actually running had a
1.5 MB log the symlink no longer pointed at. Anyone diagnosing from that log was
reading the wrong file. Initialize() also opens the shared storage directory,
which a process about to exit has no business touching.

Moved into signal_startup, which is emitted on the primary instance only. A
failure there calls app->quit() instead of return 1, because by that point
main() has already handed control to run().

2. The resolv.conf probe printed a self-referential symlink

The log line rendered <path> -> <realpath> unconditionally. On Arch and CachyOS
/etc/resolv.conf is commonly a regular file that systemd-resolved writes in
place rather than a symlink into its runtime directory, so realpath() returns
the path itself and the line came out as

/etc/resolv.conf -> /etc/resolv.conf (resolved's)

which reads as a symlink loop and sent a tester's triage chasing a misdetection
that did not exist. The arrow is now rendered only when the path actually
resolves somewhere else; a regular file and a missing file each say so
explicitly.

DNS tier selection was always correct — only this line was wrong. No behaviour
change, only the diagnostic.

Why this is split this way

Neither fix has anything to do with the app id, the icon, packaging or Flathub.
They are grouped only because they are both small runtime-correctness fixes found
in the same testing pass, and both are worth landing without waiting for the
larger PRs.

app/src/main.cpp is also touched by PR 2 (the app-id string, ~8 lines above the
hunk here). They merged cleanly in testing; if git ever disagrees, keep both.

…olv.conf log line

Two independent fixes, both found by reading a tester's log bundle rather than
by reading the code.

1. SDK INIT RAN ON EVERY LAUNCH, INCLUDING DUPLICATES.

   SdkHost::Initialize() was called before app->run(). GApplication only
   decides primary-vs-remote inside run(), so that code executes in every
   process that starts -- including a second launch that is about to hand its
   arguments to the running instance and exit.

   That is not a harmless double-init. Initialize() calls urnet::setLogDir(),
   which runs the SDK's glog init: it sweeps the log directory down to a
   keep-N budget and rewrites the urnetwork-gui.{INFO,WARNING,ERROR}
   symlinks. In the bundle, a second launch deleted three of the seven log
   files and left urnetwork-gui.INFO -- the file every "grab the current log"
   instruction follows -- pointing at its own 846-byte stub, while the session
   that was actually running had a 1.5 MB log the symlink no longer named.
   Anyone diagnosing from that log was reading the wrong file. Initialize()
   also opens the shared storage directory, which a process about to exit has
   no business touching.

   Moved into signal_startup, which is emitted on the PRIMARY instance only.
   A failure there calls app->quit() instead of returning 1, because by that
   point main() has already handed control to run().

2. THE resolv.conf PROBE PRINTED A SELF-REFERENTIAL SYMLINK.

   The log line rendered "<path> -> <realpath>" unconditionally. On Arch and
   CachyOS /etc/resolv.conf is commonly a REGULAR FILE that systemd-resolved
   writes in place rather than a symlink into its runtime directory, so
   realpath() returns the path itself and the line came out as

       /etc/resolv.conf -> /etc/resolv.conf (resolved's)

   which reads as a symlink loop and sent a tester's triage chasing a
   misdetection that did not exist. The arrow is now rendered only when the
   path actually resolves somewhere else; a regular file and a missing file
   each say so. DNS tier selection was always correct -- only this line was
   wrong.
@Ryanmello07 Ryanmello07 changed the title PR 7 — upstream/gui-fixes gui: initialize the SDK on the primary instance only, and fix the resolv.conf log line Aug 21, 2026
@Ryanmello07
Ryanmello07 marked this pull request as ready for review August 21, 2026 15:39
@Ryanmello07
Ryanmello07 merged commit 6bad125 into urnetwork:main Aug 21, 2026
3 checks passed
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.

1 participant