Comment 1 for bug 1876973

Revision history for this message
Domker_ (domker2) wrote :

I probably found the cause of the problem.

This is the PREVIOUS bash script to run Gufw v19.10.0-2 (/usr/bin/gufw-pkexec):

#!/bin/bash
LOCATIONS=(
"/usr/lib/python3.8/site-packages/gufw/gufw.py"
"/usr/lib/python3.8/dist-packages/gufw/gufw.py"
"/usr/share/gufw/gufw/gufw.py"
)

for ((i = 0; i < ${#LOCATIONS[@]}; i++))
do
if [[ -e "${LOCATIONS[${i}]}" ]]; then
python3 ${LOCATIONS[${i}]} $1
fi
done

This is the CURRENT Gufw v20.04.1-1 launch script:

#!/bin/bash
LOCATIONS=`ls -ld /usr/lib/python*/site-packages/gufw/gufw.py | awk '{print $9}'` # from source
LOCATIONS=( "${LOCATIONS[@]}" "/usr/share/gufw/gufw/gufw.py" ) # deb package

for ((i = 0; i < ${#LOCATIONS[@]}; i++))
do
if [[ -e "${LOCATIONS[${i}]}" ]]; then
python3 ${LOCATIONS[${i}]} $1
fi
done

When I run manually:
ls -ld /usr/lib/python*/site-packages/gufw/gufw.py | awk '{print $9}'

Returns an EMPTY line!

If I modify {print $ 9} to {print $ 8} it returns:
/usr/lib/python3.8/site-packages/gufw/gufw.py

After modifying the script in this way, Gufw runs without problems.

Without "awk", it returns:
-rw-r--r-- 1 root root 1079 04-29 10:12 /usr/lib/python3.8/site-packages/gufw/gufw.py

Python3 doesn't get the correct path to the script, so there is no error information when trying to run Gufw.

Using "awk" like this is bad practice:
ls -ld /usr/lib/python*/site-packages/gufw/gufw.py | awk '{print $9}'

Output without "awk" if You have English system language:
-rw-r--r-- 1 root root 1079 April 29 10:12 /usr/lib/python3.8/site-packages/gufw/gufw.py

9nt argument is the path.

Output without "awk" if You have e.g. Polish system language:
-rw-r--r-- 1 root root 1079 04-29 10:12 /usr/lib/python3.8/site-packages/gufw/gufw.py

9nt argument - nothing, because the date is in a different format: "April 29" vs "04-29" (there are no spaces and "awk" counts incorrectly)