[X2Go-Commits] [x2goserver] 01/01: x2goserver/bin/x2go{resume-session, startagent}: revert error catching while inserting values into database.

git-admin at x2go.org git-admin at x2go.org
Thu Nov 2 19:55:21 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit 8af79b0efc9aec2a78ee9a18b6227081bd4e1c69
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Nov 2 19:51:35 2017 +0100

    x2goserver/bin/x2go{resume-session,startagent}: revert error catching while inserting values into database.
    
    The current code structure relies on ignoring failures and retrying
    until an operation succeeded, which may eventually happen or just as
    well may never happen.
    
    We need something smarter here.
    
    Cherry-picked from release/4.0.1.x branch.
---
 debian/changelog                  |  5 ++++
 x2goserver/bin/x2goresume-session | 18 +++++++------
 x2goserver/bin/x2gostartagent     | 54 ++++++++++++++++++++++-----------------
 3 files changed, 45 insertions(+), 32 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 753225b..af1cbd6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -312,6 +312,11 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium
     - x2goserver/etc/x2goagent.options: remove file, moved to x2goagent.
     - x2goserver/Makefile: actually unreference x2goagent.options file as
       well.
+    - x2goserver/bin/x2go{resume-session,startagent}: revert error catching
+      while inserting values into database. The current code structure relies
+      on ignoring failures and retrying until an operation succeeded, which
+      may eventually happen or just as well may never happen. We need
+      something smarter here.
   * x2goserver.spec:
     - Add mandatory perl-generators Build-Requires as per
       https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl
diff --git a/x2goserver/bin/x2goresume-session b/x2goserver/bin/x2goresume-session
index 5e350f2..3ff8bdd 100755
--- a/x2goserver/bin/x2goresume-session
+++ b/x2goserver/bin/x2goresume-session
@@ -236,14 +236,16 @@ while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ] || [ "$FS_PORT" == "" ] ||
 		if [ "$SERV" == "" ]; then
 			OUTPUT="$("${X2GO_LIB_PATH}/x2goinsertport" "${current_host_name}" "$SESSION_NAME" "$SSH_PORT")"
 
-			if [[ "${?}" -ne "0" ]]; then
-				typeset msg="Unable to insert new port into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})."
-				"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
-
-				# Make x2goclient fail.
-				echo "${msg}" >&2
-				exit 1
-			fi
+			# Catching errors here would be nice, but the current layout doesn't allow this.
+			# Keep this in mind as a FIXME.
+			#if [[ "${?}" -ne "0" ]]; then
+			#	typeset msg="Unable to insert new port into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})."
+			#	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
+			#
+			#	# Make x2goclient fail.
+			#	echo "${msg}" >&2
+			#	exit 1
+			#fi
 		fi
 	done
 	if [ "$GR_PORT" == "" ]; then
diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent
index deb3a41..b3f07cb 100755
--- a/x2goserver/bin/x2gostartagent
+++ b/x2goserver/bin/x2gostartagent
@@ -344,26 +344,30 @@ while [ "$OUTPUT"  != "inserted" ]; do
 			$X2GO_LIB_PATH/x2gosyslog "$0" "debug" "initializing new shadow session with ID $SESSION_NAME"
 			OUTPUT=`$X2GO_LIB_PATH/x2goinsertshadowsession "$X2GO_PORT" "${current_host_name}" "$SESSION_NAME" "$SHADREQ_USER"`
 
-			if [[ "${?}" -ne "0" ]]; then
-				typeset msg="Unable to insert new session into database; parameters: port (${X2GO_PORT}), hostname (${current_host_name}), session name (${SESSION_NAME}) and user requesting desktop sharing permissions (${SHADREQ_USER})."
-				"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
-
-				# Make x2goclient fail.
-				echo "${msg}" >&2
-				exit 1
-			fi
+			# Catching errors here would be nice, but the current layout doesn't allow this.
+			# Keep this in mind as a FIXME.
+			#if [[ "${?}" -ne "0" ]]; then
+			#	typeset msg="Unable to insert new session into database; parameters: port (${X2GO_PORT}), hostname (${current_host_name}), session name (${SESSION_NAME}) and user requesting desktop sharing permissions (${SHADREQ_USER})."
+			#	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
+			#
+			#	# Make x2goclient fail.
+			#	echo "${msg}" >&2
+			#	exit 1
+			#fi
 		else
 			$X2GO_LIB_PATH/x2gosyslog "$0" "debug" "initializing new session with ID $SESSION_NAME"
 			OUTPUT=`$X2GO_LIB_PATH/x2goinsertsession "$X2GO_PORT" "${current_host_name}" "$SESSION_NAME"`
 
-			if [[ "${?}" -ne "0" ]]; then
-				typeset msg="Unable to insert new session into database; parameters: port (${X2GO_PORT}), hostname (${current_host_name}) and session name (${SESSION_NAME})."
-				"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
-
-				# Make x2goclient fail.
-				echo "${msg}" >&2
-				exit 1
-			fi
+			# Catching errors here would be nice, but the current layout doesn't allow this.
+			# Keep this in mind as a FIXME.
+			#if [[ "${?}" -ne "0" ]]; then
+			#	typeset msg="Unable to insert new session into database; parameters: port (${X2GO_PORT}), hostname (${current_host_name}) and session name (${SESSION_NAME})."
+			#	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
+			#
+			#	# Make x2goclient fail.
+			#	echo "${msg}" >&2
+			#	exit 1
+			#fi
 		fi
 	fi
 done
@@ -394,14 +398,16 @@ while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ] || [ "$FS_PORT" == "" ] ||
 		if [ "$SERV" == "" ]; then
 			OUTPUT=`$X2GO_LIB_PATH/x2goinsertport "${current_host_name}" "$SESSION_NAME" "$SSH_PORT"`
 
-			if [[ "${?}" -ne "0" ]]; then
-				typeset msg="Unable to insert new port into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})."
-				"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
-
-				# Make x2goclient fail.
-				echo "${msg}" >&2
-				exit 1
-			fi
+			# Catching errors here would be nice, but the current layout doesn't allow this.
+			# Keep this in mind as a FIXME.
+			#if [[ "${?}" -ne "0" ]]; then
+			#	typeset msg="Unable to insert new port into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})."
+			#	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
+			#
+			#	# Make x2goclient fail.
+			#	echo "${msg}" >&2
+			#	exit 1
+			#fi
 		fi
 	done
 

--
Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list