From unknown Sat May 16 08:32:09 2026
X-Loop: owner@bugs.x2go.org
Subject: Bug#520: Wrong order of redirections in x2gomountdirs
Reply-To: Andrzej Ostruszka <andrzej.ostruszka@gmail.com>, 520@bugs.x2go.org
Resent-From: Andrzej Ostruszka <andrzej.ostruszka@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: Tue, 24 Jun 2014 13:20:01 +0000
Resent-Message-ID: <handler.520.B.140361590510714@bugs.x2go.org>
Resent-Sender: owner@bugs.x2go.org
X-X2Go-PR-Message: report 520
X-X2Go-PR-Package: x2goserver
X-X2Go-PR-Keywords: 
Received: via spool by submit@bugs.x2go.org id=B.140361590510714
          (code B); Tue, 24 Jun 2014 13:20:01 +0000
Received: (at submit) by bugs.x2go.org; 24 Jun 2014 13:18:25 +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.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham version=3.3.2
Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTPS id 985975DB51
	for <submit@bugs.x2go.org>; Tue, 24 Jun 2014 15:18:21 +0200 (CEST)
Received: by mail-we0-f170.google.com with SMTP id w61so339772wes.1
        for <submit@bugs.x2go.org>; Tue, 24 Jun 2014 06:18:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=message-id:date:from:user-agent:mime-version:to:subject
         :content-type;
        bh=qnCU0ckMLXhcOmVLnTbpuRdZUydgge/lr2ZVbWVhnyY=;
        b=rQTcivJhGgMDJaLsFIJC4vg+6a7wqw3rSa+P/mOktcDR0XPXJceZsLHsFOyD+HtkSE
         cUsEnpPuPqhdZ/v+ozoAy1F23s2ANOwSR2igcdN7jYKH/29pVR+bLYZ8/mi92nhGiTNi
         AUrlrt2PUuNvbqa0SKv3TfJzIHKl8cj2OEMhx4vvvLhI5EvfRlBq+RmDT63Uy26BTL82
         jMb4RuVW2/RsSy04LWm5mSbCexlWMcw1aeS8WS2IBC11Kzmcp3IMMQJw5pnPHixmSgTo
         VFD4fMNZ9DSNF3u70EDjgHS1ANVisK6K1ykqMYQ72PkVrgbmXgOrtVFLWOLSOggrQDsh
         f9TA==
X-Received: by 10.194.2.244 with SMTP id 20mr1422254wjx.26.1403615897226;
        Tue, 24 Jun 2014 06:18:17 -0700 (PDT)
Received: from [192.168.2.11] (net-93-159-137-200.connected.pl. [93.159.137.200])
        by mx.google.com with ESMTPSA id bp2sm1791307wib.9.2014.06.24.06.18.15
        for <submit@bugs.x2go.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 24 Jun 2014 06:18:16 -0700 (PDT)
Message-ID: <53A97A94.8040801@gmail.com>
Date: Tue, 24 Jun 2014 15:18:12 +0200
From: Andrzej Ostruszka <andrzej.ostruszka@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version: 1.0
To: submit@bugs.x2go.org
Content-Type: multipart/mixed;
 boundary="------------040005050800020307080903"

This is a multi-part message in MIME format.
--------------040005050800020307080903
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Package: x2goserver
Version: 4.0.1.15-0x2go1+git20140615.847+wheezy.main.1
Tag: patch

The order of redirections in sshfs invocation (inside 
/usr/bin/x2gomountdirs) is incorrect.  Redirection of stderr should be 
after telling shell to append stdout to sshfs-mounts.log - otherwise log 
is missing errors from sshfs.

I needed this to debug and fix problems with mounting of spool dir on 
debian wheezy.

I'm attaching git patch against current master.

Best regards
Andrzej

--------------040005050800020307080903
Content-Type: text/x-patch;
 name="0001-Fix-the-order-of-redirection-in-sshfs-invocation.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0001-Fix-the-order-of-redirection-in-sshfs-invocation.patch"

>From 0b1083995c19f3d486293eec5977710b2c57d82f Mon Sep 17 00:00:00 2001
From: Andrzej Ostruszka <andrzej.ostruszka@gmail.com>
Date: Tue, 24 Jun 2014 14:45:17 +0200
Subject: [PATCH] Fix the order of redirection in sshfs invocation

---
 x2goserver/bin/x2gomountdirs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x2goserver/bin/x2gomountdirs b/x2goserver/bin/x2gomountdirs
index d5bf97a..2a7d0e6 100755
--- a/x2goserver/bin/x2gomountdirs
+++ b/x2goserver/bin/x2gomountdirs
@@ -279,7 +279,7 @@ for (my $i=0;$i<@dirs;$i++)
 		print "inserted, $msg\n";
 
 		# FIXME: this system call should be converted to a multi-argument system call while pertaining the redirect of stderr to the mounts.log file
-		if (system("sshfs  $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port 2>&1 1>>$sessiondir/sshfs-mounts.log")==0)
+		if (system("sshfs  $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port 1>>$sessiondir/sshfs-mounts.log 2>&1")==0)
 		{
 			print "mount @dirs[$i] ok\n";
 			syslog('notice', "successfully mounted $user\@$host:$port@dirs[$i] to $mntpath");
-- 
1.9.1


--------------040005050800020307080903--
