[Python-apps-team] Bug#864603: gufw requires the xhost utility under wayland

allada at alumni.upv.es allada at alumni.upv.es
Mon Mar 1 13:37:51 GMT 2021


On Tue, 23 Feb 2021 13:02:27 +0100 Sebastian Spaeth 
<Sebastian at SSpaeth.de> wrote:
> The "crash" of gufw can easily be explained and fixed. However, I am not
> sure we actually want this.
> 
> This is verified in bullseye: gufw 20.04.1-1
> 
> /usr/bin/gufw tests if we are under wayland and calls xhost:
> 
> if [ $(loginctl show-session $(loginctl|grep $(whoami) |awk '{print
> $1}') -p Type) = "Type=wayland" ]; then
>     xhost +si:localuser:root
> fi
> 
> 
> which is in package "x11-xserver-utils" but which is not recorded by any
> Debian package dependency.
> 
> So under wayland, "x11-xserver-utils" needs to become a dependency of
> package gufw, or we crash as root cannot display stuff on the screen.
> 
> The question is whether we actually want such a far-reaching xhost
> command sneaked in.
> 
> 

That script does not take into account the existence of several sessions.

$ loginctl
SESSION  UID USER  SEAT  TTY
      11 1000 user1 seat0 tty7
       2 1000 user1 seat0 tty2

2 sessions listed.


$ bash -xv /usr/bin/gufw
#!/bin/bash
if [ $(loginctl show-session $(loginctl|grep $(whoami) |awk '{print 
$1}') -p Type) = "Type=wayland" ]; then
     xhost +si:localuser:root
fi
+++ loginctl
+++ awk '{print $1}'
++++ whoami
+++ grep user1
++ loginctl show-session 11 2 -p Type
+ '[' Type=wayland Type=wayland = Type=wayland ']'
/usr/bin/gufw: line 2: [: too many arguments


The condition could be replaced with something like:
if [ $(loginctl show-session $(loginctl|grep $(whoami) |awk '{print 
$1}'|tail -1) -p Type) = "Type=wayland" ]; then



More information about the Python-apps-team mailing list