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

Full log


🔗 View this message in rfc822 format

X-Loop: owner@bugs.x2go.org
Subject: Bug#1061: failure to complete connection when profile files on server contain bashisms
Reply-To: lucisandor@gmail.com, 1061@bugs.x2go.org
Resent-From: lucisandor@gmail.com
Resent-To: x2go-dev@lists.x2go.org
Resent-CC: X2Go Developers <x2go-dev@lists.x2go.org>
X-Loop: owner@bugs.x2go.org
Resent-Date: Sat, 23 Jul 2016 02:15:02 +0000
Resent-Message-ID: <handler.1061.B.1469239915402@bugs.x2go.org>
Resent-Sender: owner@bugs.x2go.org
X-X2Go-PR-Message: report 1061
X-X2Go-PR-Package: x2goserver
X-X2Go-PR-Keywords: 
Received: via spool by submit@bugs.x2go.org id=B.1469239915402
          (code B); Sat, 23 Jul 2016 02:15:02 +0000
Received: (at submit) by bugs.x2go.org; 23 Jul 2016 02:11:55 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=0.7 required=3.0 tests=BAYES_50,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,URIBL_BLOCKED autolearn=ham
	version=3.3.2
Received: from localhost (localhost [127.0.0.1])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTP id 260DF5DDF5
	for <submit@bugs.x2go.org>; Sat, 23 Jul 2016 04:11:51 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at ymir.das-netzwerkteam.de
Received: from ymir.das-netzwerkteam.de ([127.0.0.1])
	by localhost (ymir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id kl8xcbisscUO for <submit@bugs.x2go.org>;
	Sat, 23 Jul 2016 04:11:44 +0200 (CEST)
Received: from mail-qk0-f193.google.com (mail-qk0-f193.google.com [209.85.220.193])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTPS id 31DBA5DA95
	for <submit@bugs.x2go.org>; Sat, 23 Jul 2016 04:11:44 +0200 (CEST)
Received: by mail-qk0-f193.google.com with SMTP id q62so9813700qkf.2
        for <submit@bugs.x2go.org>; Fri, 22 Jul 2016 19:11:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=to:from:subject:message-id:date:user-agent:mime-version
         :content-transfer-encoding;
        bh=dpSBpdc+z3OoNqnJm7OQrmOARVrFJPt3fzidu1Fc8ow=;
        b=rm4UMjCRAKyIcy1sxfUeToOGFhD1a+QCcsLQOdUbmVpE5jg3CqcZe5ecwO5EfIa+6H
         weaCZ9lBFptvypDUmqCbO7eo7HjUc772inunvkJOb/Sgmd+4OrBtcpzhI1ErGH7onpQr
         xoOEDCI/iZTWM33174tTdxiNmJatm/TJOJ0w9Aa19TejuRForZGQ4zu0Q7AgoXqZxdy2
         cJ526ZKtRRriURXm7JfFym2DxuTLT25HidzAo5FZnaXaAvZytJVNmNMPn0yFCq8Orjsy
         1qYq1spl9lwZmruGaqGzvWvEJjGCY3G1PdqQqPiSHEX79RzW3htmCzAI/O56VZACyO7e
         gAtA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:message-id:date:user-agent
         :mime-version:content-transfer-encoding;
        bh=dpSBpdc+z3OoNqnJm7OQrmOARVrFJPt3fzidu1Fc8ow=;
        b=ZgzGfxjMpRAycJ4Fc0igmeiIRcPhLmNdIaBcpeFYcslL3WrgWA1WY0IJQC+3fb5oSL
         AZ924QoeNSXYJoYooLQCxLe2aKe0VetMgS9a6/sgS5uLhV0S9SyI6dgTzAKOf2du6337
         Cs6PVabmBdog6rfohSrQZBckflVxAEbpRDIz9gKtZwW4ksjcxWQwjuW9roQvTnHqj23a
         iNHfW7LKFC/WmfQVXvWqpLUE8SIGEDsPNtsIqr5iI6Be23wa20wBuck+sh4gkgytXQDi
         BgmJmFcN95i4q/mEHLOfHDrc1+XIB2S7nTikCm0cFnfa9ft4ivtfGqC1tXN+GxN+bM8T
         xFAA==
X-Gm-Message-State: AEkoous/zsM/zD3bAs4R1POcBFE+c5vJeYZyxzA7vjePeTwFv7dIF0w0qyTuNlxqHNZcmA==
X-Received: by 10.55.8.2 with SMTP id 2mr8710086qki.122.1469239902562;
        Fri, 22 Jul 2016 19:11:42 -0700 (PDT)
Received: from [192.168.1.3] (c-174-63-108-216.hsd1.ma.comcast.net. [174.63.108.216])
        by smtp.googlemail.com with ESMTPSA id m10sm8963698qta.31.2016.07.22.19.11.40
        for <submit@bugs.x2go.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 22 Jul 2016 19:11:40 -0700 (PDT)
To: submit@bugs.x2go.org
From: lucisandor@gmail.com
Message-ID: <15422f97-2f21-2822-e405-54d8ba62aa9c@gmail.com>
Date: Fri, 22 Jul 2016 22:11:39 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Icedove/45.1.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
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 11:22:48 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.