Subject: Bug#1035 closed by Mike Gabriel <[email-masked]> (Re: [X2Go-Dev] Bug#1035: capture x2goruncommand debug output for x2gofeature X2GO_XSESSION)

From: [email-masked] (X2Go Bug Tracking System)
Date: Wed, 21 Nov 2018 20:25:03 +0000

This is an automatic notification regarding your Bug report
which was filed against the x2goserver package:

#1035: capture x2goruncommand debug output for x2gofeature X2GO_XSESSION

It has been closed by Mike Gabriel <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Mike Gabriel <[email-masked]> by
replying to this email.

-- 
1035: http://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1035
X2Go Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [X2Go-Dev] Bug#1035: capture x2goruncommand debug output for x2gofeature X2GO_XSESSION
From: Mike Gabriel <[email-masked]>
To: Tor Perkins <[email-masked]>, [email-masked]
Date: Wed, 21 Nov 2018 20:23:40 +0000

Control: fixed -1 4.0.1.20
Control: close -1

Hi Tor,

On  Fr 13 Mai 2016 18:58:12 CEST, Tor Perkins wrote:

> Package: x2goserver
> Version: 4.0.1.19
> Tags: patch
>
>
> Hello,
>
> I had recently had a problem with my /etc/xprofile file that
> prevented session startup.  The details are not too important; it
> had to do with a difference of default shell (/bin/sh) being either
> /bin/dash or /bin/bash.
>
> After enabling the 'debug' loglevel on the server, I still had no
> helpful output indicating what the problem might be...
>
> I did some ferreting about and noticed that x2goruncommand was not
> capturing cmd output when using x2gofeature X2GO_XSESSION
> (/etc/x2go/Xsession).  The client side invocation of x2goruncommand
> (via sshlib) redirects remote command output to /dev/null, so it is
> also not preserved when using the client's --debug option...
>
> This small patch appends the missing output to an already existing
> debug file in x2goruncommand ($MESSAGE_FILE).  With this in place, I
> was able to see the "smoking gun":
>
>   cat ~/.x2go/C-user-50-1463156913_stD.Xclients_dp24/cmdoutput
>
>     exec /root/.Xclients
>     Loading profile from /etc/profile
>     Loading profile from /root/.profile
>     Loading profile from /etc/xprofile
>     /etc/xprofile: 14: Bad substitution        <--  whoop!
>
> The file is deleted (as before) if not at loglevel debug.
>
> Thanks for your consideration.
>
> - Tor

You may have missed it, as this bug never got closed. However, your  
patch became part of 4.0.1.20.

So closing this bug manually now. Thanks for your patch.

Mike
-- 

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
mobile: +49 (1520) 1976 148
landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: [email-masked], http://das-netzwerkteam.de

Subject: capture x2goruncommand debug output for x2gofeature X2GO_XSESSION
From: Tor Perkins <[email-masked]>
To: [email-masked]
Date: Fri, 13 May 2016 09:58:12 -0700

Package: x2goserver
Version: 4.0.1.19
Tags: patch

Hello,

I had recently had a problem with my /etc/xprofile file that
prevented session startup.  The details are not too important; it
had to do with a difference of default shell (/bin/sh) being either
/bin/dash or /bin/bash.

After enabling the 'debug' loglevel on the server, I still had no
helpful output indicating what the problem might be...

I did some ferreting about and noticed that x2goruncommand was not
capturing cmd output when using x2gofeature X2GO_XSESSION
(/etc/x2go/Xsession).  The client side invocation of x2goruncommand
(via sshlib) redirects remote command output to /dev/null, so it is
also not preserved when using the client's --debug option...

This small patch appends the missing output to an already existing
debug file in x2goruncommand ($MESSAGE_FILE).  With this in place, I
was able to see the "smoking gun":

  cat ~/.x2go/C-user-50-1463156913_stD.Xclients_dp24/cmdoutput

    exec /root/.Xclients
    Loading profile from /etc/profile
    Loading profile from /root/.profile
    Loading profile from /etc/xprofile
    /etc/xprofile: 14: Bad substitution        <--  whoop!

The file is deleted (as before) if not at loglevel debug.

Thanks for your consideration.

- Tor

diff --git a/x2goserver/bin/x2goruncommand b/x2goserver/bin/x2goruncommand
index 43b4064..0ca2e35 100755
--- a/x2goserver/bin/x2goruncommand
+++ b/x2goserver/bin/x2goruncommand
@@ -313,7 +313,7 @@ if [ "$EXEC" != "" ] && [ -x "$EXEC" ]; then
 	if x2gofeature X2GO_XSESSION &>/dev/null && [ "x$X2GO_SESS_TYPE" = "xD" ]; then
 		STARTUP="$cmd$args"
 		"$X2GO_LIB_PATH/x2gosyslog" "$0" "notice" "launching session with Xsession-x2go mechanism, using STARTUP=\"$STARTUP\""
-		XSESSION_EXEC="$cmd" STARTUP="/usr/bin/env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ${STARTUP}" /etc/x2go/Xsession
+		XSESSION_EXEC="$cmd" STARTUP="/usr/bin/env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ${STARTUP}" /etc/x2go/Xsession >>"$MESSAGE_FILE" 2>&1
 	else
 		"$X2GO_LIB_PATH/x2gosyslog" "$0" "debug" "executing command \"$cmd$args\"..."