Subject: Wrong order of redirections in x2gomountdirs
From: Andrzej Ostruszka <[email-masked]>
To: [email-masked]
Date: Tue, 24 Jun 2014 15:18:12 +0200

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
From 0b1083995c19f3d486293eec5977710b2c57d82f Mon Sep 17 00:00:00 2001
From: Andrzej Ostruszka <[email-masked]>
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