X2Go Bug report logs - #1061
failure to complete connection when profile files on server contain bashisms

version graph

Package: x2goserver; Maintainer for x2goserver is X2Go Developers <x2go-dev@lists.x2go.org>; Source for x2goserver is src:x2goserver.

Reported by: lucisandor@gmail.com

Date: Sat, 23 Jul 2016 02:15:02 UTC

Severity: normal

Found in version 4.0.1.19

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to x2go-dev@lists.x2go.org, X2Go Developers <x2go-dev@lists.x2go.org>:
Bug#1061; Package x2goserver. (Sat, 23 Jul 2016 02:15:02 GMT) (full text, mbox, link).


Acknowledgement sent to lucisandor@gmail.com:
New Bug report received and forwarded. Copy sent to X2Go Developers <x2go-dev@lists.x2go.org>. (Sat, 23 Jul 2016 02:15:02 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.x2go.org (full text, mbox, reply):

From: lucisandor@gmail.com
To: submit@bugs.x2go.org
Subject: failure to complete connection when profile files on server contain bashisms
Date: Fri, 22 Jul 2016 22:11:39 -0400
Package: x2goserver
Version: 4.0.1.19

failure to complete connection when profile files on server contain bashisms

On a group of servers using Debian Stretch, X2Go server (version
4.0.1.19-0x2go2+git20160621.1064+stretch.main.1) was not accepting
incoming connections. Namely, SSH logging in succeeded, X2go client
would open a black window, but the window would close by itself in 1-2
seconds.

I found that, during the login process, the server was sourcing Bash
profile files assuming they were POSIX-compliant. At the first encounter
of a bashism, such as an array, the script would crash, and the whole
session would be killed.

I tracked the issue down by inserting in /etc/x2go/Xsession (a /bin/sh
file) a logging line:
# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile"
"$HOME/.xprofile"; do
    echo "$file" | /usr/bin/logger -t x2goloading
    ..blabla..
done
In the log I found:
Jul 22 21:32:43 mycomputer /usr/bin/x2goruncommand: launching session
with Xsession-x2go mechanism, using STARTUP="xfce4-session"
Jul 22 21:32:43 mycomputer x2goloading: /etc/profile
Jul 22 21:32:43 mycomputer x2goloading: /home/user/.profile
Jul 22 21:32:43 mycomputer /usr/bin/x2goruncommand: command
/usr/bin/xfce4-session has finished

What happened was that I had my /home/user/.profile source another
script that I wrote
$ tail /home/user/.profile

...blabla...
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
. /etc/mybashsettings.sh

$ cat /etc/mybashsettings.sh
#!/bin/bash
somefunc()
{
  local INPUTLINES
  INPUTLINES=()
}
return 0

$ . /etc/mybashsettings.sh

$ sh /etc/mybashsettings.sh
/etc/mybashsettings.sh: 5: /etc/mybashsettings.sh: Syntax error: "("
unexpected (expecting "}")

This is a minimally crashing example.

Now, I believe that having bash scripts in one's profile should not be
unexpected. In fact, on the aforementioned distro, it seems it is part
of bash. I ave:
$ head /home/user/.profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.



Send a report that this bug log contains spam.


X2Go Developers <owner@bugs.x2go.org>. Last modified: Fri Apr 19 12:47:28 2024; Machine Name: ymir.das-netzwerkteam.de

X2Go Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.