/usr/bin/gufw: line 2: [: too many arguments

Bug #1890026 reported by Jean-Philippe Guérard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gufw
Fix Released
Undecided
Unassigned

Bug Description

LANGUAGE=C gufw
/usr/bin/gufw: line 2: [: too many arguments

shellcheck report missing quotes (SC2046) on line 2 and 6 (SC2086).

In line 2, the script assumes that loginctl will return only one session per user.
In my test, loginctl sometimes reported several sessions for the current user.

loginctl|grep $(whoami)
    c11 1001 johnsmith
    c12 1000 smith seat0
     c2 1000 smith seat0
     c5 1000 smith seat0

This can be fixed by checking that the session is active.

Also, the script does not correctly filter on the current user, for example, with user smith and johnsmith both having a session and smith trying to log in.

The attached file fixes theses issues. It has been checked with shellcheck.

Revision history for this message
Jean-Philippe Guérard (fevrier) wrote :
Revision history for this message
Jean-Philippe Guérard (fevrier) wrote :

See the attached ShellCheck report for the original script.

Revision history for this message
Jean-Philippe Guérard (fevrier) wrote :

Slightly improved version:
 * Get rid of the useless shopt.
 * Really read the session type.

Revision history for this message
costales (costales) wrote :

Hi,

I'll remove the wayland hack in next releases, it's a mess and this should be fixed by Wayland.

Thanks for the feedback and fix Jean!!

costales (costales)
Changed in gui-ufw:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.