Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 2010 13:13:26 +0200
From:      Bernhard Froehlich <decke@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        henry.hu.sh@gmail.com
Subject:   ports/148258: [PATCH] x11/slim: Fix crash on SIGTERM
Message-ID:  <20100630131326.3b423645@FreeBSD.org>
Resent-Message-ID: <201006301120.o5UBK7UC032260@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         148258
>Category:       ports
>Synopsis:       [PATCH] x11/slim: Fix crash on SIGTERM
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 30 11:20:07 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Bernhard Froehlich
>Release:        FreeBSD 8.1-PRERELEASE amd64
>Organization:
>Environment:
System: FreeBSD chii.bluelife.at 8.1-PRERELEASE FreeBSD 8.1-PRERELEASE #2: Fri May 28 19:07:40 CEST 2010
>Description:
This patch is taken from upstream repository as r169. It fixes
the issue that slim coredumps on shutdown when receiving SIGTERM.

Added file(s):
- files/patch-002-fix-shutdown

Port maintainer (henry.hu.sh@gmail.com) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- slim-1.3.1_8.patch begins here ---
diff -ruN --exclude=CVS --exclude=.svn /usr/ports/x11/slim.orig/files/patch-002-fix-shutdown /usr/ports/x11/slim/files/patch-002-fix-shutdown
--- /usr/ports/x11/slim.orig/files/patch-002-fix-shutdown	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/x11/slim/files/patch-002-fix-shutdown	2010-06-30 13:00:58.000000000 +0200
@@ -0,0 +1,65 @@
+------------------------------------------------------------------------
+r169 | iwamatsu | 2009-11-14 09:13:57 +0100 (Sat, 14 Nov 2009) | 11 lines
+
+Add flag of server check
+
+Slim gets this SIGTERM, and its signal handler calls
+CloseServer() to teardown X. But X is not yet started (as StartServer()
+is still running in another thread, waiting in pause()), and hence this
+calls XcloseDisplay which frees some resources which are not yet allocated.
+
+This parch fix this problem.
+Thanks, Landry Breuil, goebbels, jasper and OpenBSD Developer.
+
+Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+------------------------------------------------------------------------
+--- app.h	(revision 168)
++++ app.h	(revision 169)
+@@ -36,6 +36,7 @@
+     int GetServerPID();
+     void StopServer();
+ 
++	bool serverStarted;
+     // Lock functions
+     void GetLock();
+     void RemoveLock();
+--- app.cpp	(revision 168)
++++ app.cpp	(revision 169)
+@@ -105,7 +105,10 @@
+ 
+ void CatchSignal(int sig) {
+     cerr << APPNAME << ": unexpected signal " << sig << endl;
+-    LoginApp->StopServer();
++
++    if (LoginApp->serverStarted)
++        LoginApp->StopServer();
++
+     LoginApp->RemoveLock();
+     exit(ERR_EXIT);
+ }
+@@ -140,6 +143,7 @@
+     int tmp;
+     ServerPID = -1;
+     testing = false;
++    serverStarted = false;
+     mcookie = string(App::mcookiesize, 'a');
+     daemonmode = false;
+     force_nodaemon = false;
+@@ -860,6 +864,8 @@
+     char* args = new char[argOption.length()+2]; // NULL plus vt
+     strcpy(args, argOption.c_str());
+ 
++    serverStarted = false;
++
+     int argc = 1;
+     int pos = 0;
+     bool hasVtSet = false;
+@@ -940,6 +946,8 @@
+     
+     delete args;
+ 
++    serverStarted = true;
++
+     return ServerPID;
+ }
+ 
--- slim-1.3.1_8.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100630131326.3b423645>