Stefan Baur | 13 Oct 00:50 2012
Picon

Bug#48: heuler x2gothinclient multihead support breaks singlehead mode

Package: x2gothinclient
Version: 1.0.99.1
Severity: important

/usr/sbin/x2gothinclientd hangs and does not start x2goclient.
The hang is caused by

DISPLAY=:0 LANG=C xrandr | grep ' connected ' | cut -d ' ' -f1

which, when run manually from the command line, gives

"xrandr: Failed to get size of gamma for output default
default" [sic!]

Disabling the entire routine with

-foreach (`DISPLAY=:0 LANG=C xrandr | grep ' connected ' | cut -d ' ' -f1`)
+foreach('')

fixes the issue for singlehead mode, but breaks multihead mode.

So, two suggestions:
1) STDERR from xrandr  should go to /dev/null or to a log file/syslog, so
-foreach (`DISPLAY=:0 LANG=C xrandr | grep ' connected ' | cut -d ' ' -f1`)
+foreach (`DISPLAY=:0 LANG=C xrandr 2>/dev/null | grep ' connected ' | 
cut -d ' ' -f1`)

2) A simple fix could be
if (1 < `DISPLAY=:0 LANG=C xrandr | grep ' connected ' | wc -l`)
{
     foreach (`DISPLAY=:0 LANG=C xrandr | grep ' connected ' | cut -d ' 
' -f1`)
     {
     ...
     }
}
I'm sure there might be a more elegant solution that works within the 
foreach loop, but "Hanc marginis exiguitas non caperet."

-Stefan

Gmane