From edb2c89067306e686a01f91551d775fd70516593 Mon Sep 17 00:00:00 2001 From: Ayan Mulla Date: Mon, 21 Sep 2026 21:17:01 +0100 Subject: [PATCH] Fix omarchy-launch-browser crashing Chrome when man-db is absent Private-mode flag detection ran the default browser with --help and grepped for MOZ_LOG. Chrome's --help execs man to show its manual page; on an image without man-db that exec fails with ENOENT and kills Chrome with SIGTRAP before it ever launches, with the crash's stderr silently discarded. Detect the flag from the executable name instead, the same way the Edge branch already does, so no subprocess is run at all. Fixes #12564 Co-Authored-By: Claude Sonnet 5 --- bin/omarchy-launch-browser | 5 ++++- test/shell.d/launch-browser-test.sh | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/bin/omarchy-launch-browser b/bin/omarchy-launch-browser index 044b220d2268..2804448dfd98 100755 --- a/bin/omarchy-launch-browser +++ b/bin/omarchy-launch-browser @@ -9,7 +9,10 @@ if [[ -z $default_browser ]]; then fi browser_exec=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$default_browser 2>/dev/null | head -1) -if $browser_exec --help 2>/dev/null | grep -q MOZ_LOG; then +# Detected by executable name rather than probing `--help`: Chrome's `--help` +# execs `man` to show its manual page, and on an image without man-db that +# exec fails with ENOENT and kills Chrome with SIGTRAP before it ever launches. +if [[ $browser_exec =~ firefox|librewolf|zen|floorp ]]; then private_flag="--private-window" elif [[ $browser_exec =~ edge ]]; then private_flag="--inprivate" diff --git a/test/shell.d/launch-browser-test.sh b/test/shell.d/launch-browser-test.sh index 161ff9ee0702..9dc8a1c3d0d0 100644 --- a/test/shell.d/launch-browser-test.sh +++ b/test/shell.d/launch-browser-test.sh @@ -79,3 +79,24 @@ grep -Fx '^chromium.*$' "$focus_log" >/dev/null || fail "browser launcher focuses the browser resolved from the HTTPS handler" pass "browser launcher follows opened links to the browser workspace" + +# Chrome's --help execs `man` to show its manual page. On an image without +# man-db that exec fails and kills Chrome with SIGTRAP, so private-mode +# detection must never invoke the browser's --help to figure out its flag. +help_probe_log="$test_tmp/help-probe" +cat >"$mock_bin/chromium" <"$help_probe_log" + exit 1 +fi +exit 0 +SH +chmod +x "$mock_bin/chromium" + +HOME="$test_home" PATH="$mock_bin:$PATH" HYPRLAND_INSTANCE_SIGNATURE=test \ + OMARCHY_TEST_BROWSER_LAUNCH="$launch_log" OMARCHY_TEST_BROWSER_FOCUS="$focus_log" \ + bash "$ROOT/bin/omarchy-launch-browser" --private + +[[ ! -e $help_probe_log ]] || fail "browser launcher never probes the browser with --help" +pass "browser launcher decides the private-mode flag without invoking --help"