From newsgroups.mail2@stefanbaur.de  Sat Oct 13 00:50:22 2012
Received: (at submit) by bugs.x2go.org; 12 Oct 2012 22:50:22 +0000
Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8])
	by ymir (Postfix) with ESMTP id 158265DB11
	for <submit@bugs.x2go.org>; Sat, 13 Oct 2012 00:50:22 +0200 (CEST)
Received: from [192.168.2.3] (dslb-188-099-192-139.pools.arcor-ip.net [188.99.192.139])
	by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis)
	id 0LwmZo-1TOwhJ2zjk-016U97; Sat, 13 Oct 2012 00:50:21 +0200
Message-ID: <50789EB5.6020003@stefanbaur.de>
Date: Sat, 13 Oct 2012 00:50:29 +0200
From: Stefan Baur <newsgroups.mail2@stefanbaur.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version: 1.0
To: submit@bugs.x2go.org
Subject: heuler x2gothinclient multihead support breaks singlehead mode
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:6M2D479jCzsiy49SFKqYMSd7NbdFidr0h8c2/QzEeTP
 cmwbwJMgjuFiLhhZ3GO0RY0rFBgv8oKPl3+JFXpzGuAgcasCte
 WmHnRGHOaokT4AWEvYh76eXTPNmJ2biFzYygd2d3HKZ2EgrteY
 VVzwYMiqjURIyRNGcuMtuIQq6lwHI5USzUhpXU5fXfTpqQwZNf
 ry19ufIVL9qPWQ8OXTPbXElxIWlRFBdgl9RxW3RVFCQbyQz4Nc
 Ka5JcF0m2D8N90RoNZ6syOKM0kNTHnp2kLXfoOvyWfLvTzTbrc
 dIRA+eQh8ykLgWGJFgZIZXwSxlpB5T3jdJGF66/bCKaU/f+ks2
 dIxwEIhV/03MiYml+TxOg+t97gI8koPSouw84rWHI

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
