[X2Go-Dev] Bug#105: Logic errors in x2goruncommand
Matthew L. Dailey
matthew.l.dailey at dartmouth.edu
Fri Jan 18 18:15:56 CET 2013
Package: x2goserver
Version: 4.1.0.0
Greetings.
In working on a deployment of X2Go on some Ubuntu machines, I found some logic errors in the x2goruncommand script that cased it not to determine the proper session to run for Gnome or Unity on Ubuntu 12.04 (and probably others). In essence, the script was testing the return code of bc, rather than the actual answer (1 or 0) to the boolean question being passed to it.
Here is a patch (also attached) that fixes this problem and I can verify that this works on at least Ubuntu 12.04 systems. I don't have any others I can easily test on. I'm not crazy about the quotes both outside and inside $(), but I think it should be okay. Perhaps a more adept bash programmer might have a better suggestion. :-)
Thanks for your attention and please let me know if you have any questions or need any other information. And, thanks for your hard work on this terrific project!
--
Matthew L. Dailey
Systems Administrator
Thayer School of Engineering
Dartmouth College
--- x2goruncommand.orig 2012-12-30 16:49:03.000000000 -0500
+++ x2goruncommand 2013-01-15 16:45:33.623393451 -0500
@@ -91,13 +91,13 @@
if [ "$cmd" == "GNOME" ] || [ "$cmd" == "gnome-session" ]; then
cmd="/usr/bin/gnome-session"
- if [ "$DISTRIB_ID" == "Ubuntu" ] && $(echo "$DISTRIB_RELEASE >= 11.10" | bc); then
+ if [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE >= 11.10" | bc)" == "1" ]; then
export DESKTOP_SESSION="gnome-fallback"
args=" --session=$DESKTOP_SESSION"
- elif [ "$DISTRIB_ID" == "Ubuntu" ] && $(echo "$DISTRIB_RELEASE == 11.04" | bc); then
+ elif [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE == 11.04" | bc)" == "1" ]; then
export DESKTOP_SESSION="2d-gnome"
args=" --session=$DESKTOP_SESSION"
- elif [ "$DISTRIB_ID" == "Ubuntu" ] && $(echo "$DISTRIB_RELEASE <= 10.10" | bc); then
+ elif [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE <= 10.10" | bc)" == "1" ]; then
export DESKTOP_SESSION="gnome"
elif cat /etc/debian_version | egrep "^(squeeze|6\.).*" >/dev/null; then
export DESKTOP_SESSION="gnome"
@@ -108,13 +108,13 @@
elif ([ "$cmd" == "UNITY" ] || [ "$cmd" == "unity" ]); then
cmd="/usr/bin/gnome-session"
- if [ "$DISTRIB_ID" == "Ubuntu" ] && $(echo "$DISTRIB_RELEASE" >= 12.10 | bc); then
+ if [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE >= 12.10" | bc)" == "1" ]; then
export DESKTOP_SESSION="ubuntu"
args=" --session=$DESKTOP_SESSION"
- elif [ "$DISTRIB_ID" == "Ubuntu" ] && [ $(echo "$DISTRIB_RELEASE" == 11.10 | bc) || $(echo $DISTRIB_RELEASE == 12.04 | bc) ]; then
+ elif [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE == 11.10" | bc)" == "1" -o "$(echo "$DISTRIB_RELEASE == 12.04" | bc)" == "1" ]; then
export DESKTOP_SESSION="ubuntu-2d"
args=" --session=$DESKTOP_SESSION"
- elif [ "$DISTRIB_ID" == "Ubuntu" ] && $(echo "$DISTRIB_RELEASE" == 11.04 | bc); then
+ elif [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE == 11.04" | bc)" == "1" ]; then
export DESKTOP_SESSION="2d-ubuntu"
args=" --session=$DESKTOP_SESSION"
fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x2goruncommand.patch
Type: application/octet-stream
Size: 2091 bytes
Desc: not available
URL: <http://lists.x2go.org/pipermail/x2go-dev/attachments/20130118/3fe1c458/attachment.obj>
-------------- next part --------------
More information about the x2go-dev
mailing list