Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#64376 - [capnet-assist] Assistant window does not show up automatically

Attached to Project: Community Packages
Opened by Ingo Heimbach (IngoHeimbach) - Sunday, 03 November 2019, 22:10 GMT
Last edited by David Runge (dvzrv) - Tuesday, 19 November 2019, 20:20 GMT
Task Type Bug Report
Category Packages
Status Assigned
Assigned To Maxime Gauduin (Alucryd)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Description:


Additional info:
* package version: 2.2.3-1

Steps to reproduce:

The package version 2.2.3-1 does not show up an assistant window on public Wifis due to a bug in `/etc/NetworkManager/dispatcher.d/90captive_portal_test`. This patch fixes that behavior:
```
--- /etc/NetworkManager/dispatcher.d/90captive_portal_test 2019-02-01 17:41:19.000000000 +0100
+++ /etc/NetworkManager/dispatcher.d/90captive_portal_test.patched 2019-11-03 22:34:32.067793254 +0100
@@ -22,13 +22,11 @@
#launch the browser, but on boot we need to wait that nm-applet starts
start_browser() {
local user="$1"
- local display="$2"

- export DISPLAY="$display"
wait_for_process nm-applet

- $logger "Running browser as '$user' with display '$display' to login in captive portal"
- su "$user" -s /bin/sh -c "io.elementary.capnet-assist 2>/dev/null"
+ $logger "Running browser as '$user' with display '$DISPLAY' and dbus session bus address '$DBUS_SESSION_BUS_ADDRESS' to login in captive portal"
+ su -w DISPLAY,DBUS_SESSION_BUS_ADDRESS -c "io.elementary.capnet-assist 2>/dev/null" - "$user"
}

# Run the right scripts
@@ -36,10 +34,10 @@
up|vpn-up)
$logger -p user.debug "DetectCaptivePortal script triggered"

- # Match 2nd column of who's output with ' :[at least one digit] '
- who | awk '$2 ~ /:[0-9]+/ { print $1 " " $2; };' | \
- while read user display; do
- start_browser $user $display || $logger -p user.err "failed for user: '$user' display: '$display')"
+ who | awk '{ print $1 }' | uniq | \
+ while read user; do
+ eval "$(ps -u $user e -e -o cmd | awk '$0 ~ /^[^[:space:]]*dbus-daemon.*[[:space:]]--session/ { for(i=2; i<=NF; i++) print $i }' | awk '{ sub(/=/," ") }1' | awk '$1 == "DISPLAY" || $1 == "DBUS_SESSION_BUS_ADDRESS" { printf "export %s=\"%s\";", $1, $2 }')"
+ start_browser $user || $logger -p user.err "failed for user: '$user' display: '$DISPLAY' dbus session bus address: $DBUS_SESSION_BUS_ADDRESS)"
done
;;
*)
```
You can apply the patch file with `patch -d/ -p1 <patch_file>`.
This task depends upon

Comment by Maxime Gauduin (Alucryd) - Wednesday, 20 November 2019, 18:32 GMT
There are 2 issues upstream regarding this, one of them is to remove the file in the first place and replace the mechanism altogether. I'd wait for this to land, but if the latest release (2.2.4 released 2 hours ago) still doesn't work without patching, could you at least validate your patch with upstream please?
Comment by Maxime Gauduin (Alucryd) - Wednesday, 20 November 2019, 19:24 GMT
Just pushed 2.2.4, but that file hasn't been touched in 2 years, if the capnet logic hasn't changed I don't expect 2.2.4 will change anything.
Comment by Ingo Heimbach (IngoHeimbach) - Monday, 09 December 2019, 11:07 GMT
Sorry, I am on Manjaro and version 2.2.4 has not been migrated to Manjaro stable yet.
Comment by Maciej Dems (MacDems) - Friday, 31 January 2020, 09:32 GMT
The 90captive_portal_test is totally broken. It does not consider current who output and is triggered on connection, not on state change to 'portal' (for poor-connection wifi, the network can connect, stay for quite some time in 'limited' and only after a while change to 'portal').

I suggest you replace a 90captive_portal_test script. Here is the one I have tested to work.
Comment by Ingo Heimbach (IngoHeimbach) - Thursday, 20 February 2020, 08:20 GMT
@MacDems: Strange, I have to pass `DISPLAY` and `DBUS_SESSION_BUS_ADDRESS` to `su` explicitly, otherwise `io.elementary.capnet-assist` won't work.

Loading...