[X2go-Dev] misleading stderr output when resuming, suspending, terminating a already dead session

Mike Gabriel mike.gabriel at das-netzwerkteam.de
Wed Sep 14 08:05:18 CEST 2011


Hi Reinhard, hi devs,

On Mi 14 Sep 2011 06:36:41 CEST Reinhard Tartler wrote:

> On Di, Sep 13, 2011 at 05:31:19 (PDT), Mike Gabriel wrote:
>
>> hi devs,
>>
>> I have a patch pending here that fixes misleading output to stderr...
>
> That patch doesn't fix anything, it rather silences a real error, which
> is always wrong. I'd advice against it and recommend fixing the actual
> problem instead.

Yes, you are right. The origin of this probably is the  
x2gocleansessions script... But I have no time to look at that more  
closely, currently.

>> However, I am not sure about the scope in x2goclient (apart from
>> avoiding a confusing GUI message).
>
> the patch doesn't contain anything in x2goclient?

Sorry, that was maybe awkwardly expressed. The latest x2goclient (I  
have not observed this before) pops up a GUI notification window that  
shows the result of stderr after x2goresume/terminate/suspend-session  
has been called. The output, of course is very confusing for the  
normal user...

>> Maybe we should write a proper error message to stderr here instead???
>
> yes, I agree.

So how about this one, for now...


Greets,
Mike

diff --git a/x2goserver/bin/x2goresume-session  
b/x2goserver/bin/x2goresume-session
index 4c01828..49880e0 100755
diff --git a/x2goserver/bin/x2goresume-session  
b/x2goserver/bin/x2goresume-session
index 4c01828..49880e0 100755
--- a/x2goserver/bin/x2goresume-session
+++ b/x2goserver/bin/x2goresume-session
@@ -83,6 +83,10 @@ echo "$NEWOPTIONS" >${SESSION_DIR}/options

  $X2GO_LIB_PATH/x2goresume  $X2GO_CLIENT $SESSION_NAME  > /dev/null

-kill -HUP $X2GO_AGENT_PID &&
-       $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "client $X2GO_CLIENT  
successfully resumed session with ID $SESSION_NAME" ||
-       $X2GO_LIB_PATH/x2gosyslog "$0" "err" "ERROR: client  
$X2GO_CLIENT failed to resume session with ID $SESSION_NAME"
+kill -HUP $X2GO_AGENT_PID &>/dev/null &&
+       $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "client $X2GO_CLIENT  
successfully resumed session with ID $SESSION_NAME" || {
+} || {
+       err_msg="ERROR: failed to resume session with ID $SESSION_NAME"
+       echo err_$msg 1>&2
+       $X2GO_LIB_PATH/x2gosyslog "$0" "err" "$err_msg"
+}
diff --git a/x2goserver/bin/x2gosuspend-session  
b/x2goserver/bin/x2gosuspend-session
index ca342e4..139d0df 100755
--- a/x2goserver/bin/x2gosuspend-session
+++ b/x2goserver/bin/x2gosuspend-session
@@ -39,9 +39,13 @@ killall -HUP knotify

  $X2GO_LIB_PATH/x2gochangestatus 'S' $SESSION_NAME  > /dev/null

-kill -HUP $X2GO_AGENT_PID &&
-       $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "session with ID  
$SESSION_NAME has successfully been suspended" ||
-       $X2GO_LIB_PATH/x2gosyslog "$0" "err" "ERROR: failed to suspend  
session with ID $SESSION_NAME"
+kill -HUP $X2GO_AGENT_PID &>/dev/null && {
+       $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "session with ID  
$SESSION_NAME has successfully been suspended" || {
+} || {
+       err_msg="ERROR: failed to suspend session with ID $SESSION_NAME"
+       echo err_$msg 1>&2
+       $X2GO_LIB_PATH/x2gosyslog "$0" "err" "$err_msg"B
+}

  export HOSTNAME
  x2goumount-session $SESSION_NAME
diff --git a/x2goserver/bin/x2goterminate-session  
b/x2goserver/bin/x2goterminate-session
index 3d8872e..75bf277 100755
--- a/x2goserver/bin/x2goterminate-session
+++ b/x2goserver/bin/x2goterminate-session
@@ -35,9 +35,13 @@ X2GO_AGENT_PID=`echo "$X2GO_AGENT_PID"| awk {'print $1'}`

  $X2GO_LIB_PATH/x2gochangestatus 'F' $SESSION_NAME  > /dev/null

-kill -TERM $X2GO_AGENT_PID &&
-       $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "session with ID  
$SESSION_NAME has successfully been terminated" ||
-       $X2GO_LIB_PATH/x2gosyslog "$0" "err" "ERROR: failed to  
terminate session with ID $SESSION_NAME"
+kill -TERM $X2GO_AGENT_PID &>/dev/null &&
+       $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "session with ID  
$SESSION_NAME has successfully been terminated" || {
+} || {
+       err_msg="ERROR: failed to terminate session with ID $SESSION_NAME"
+       echo "err_$msg" 1>&2
+       $X2GO_LIB_PATH/x2gosyslog "$0" "err" "$err_msg"
+}

  export HOSTNAME
  x2goumount-session $SESSION_NAME



-- 

DAS-NETZWERKTEAM
mike gabriel, dorfstr. 27, 24245 barmissen
fon: +49 (4302) 281418, fax: +49 (4302) 281419

GnuPG Key ID 0xB588399B
mail: mike.gabriel at das-netzwerkteam.de, http://das-netzwerkteam.de

freeBusy:
https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xfb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digitale PGP-Unterschrift
URL: <http://lists.x2go.org/pipermail/x2go-dev/attachments/20110914/a1de551d/attachment.pgp>


More information about the x2go-dev mailing list