From decke@FreeBSD.org  Wed Jun 30 11:14:12 2010
Return-Path: <decke@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4AF3C106566B
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 30 Jun 2010 11:14:12 +0000 (UTC)
	(envelope-from decke@FreeBSD.org)
Received: from mail.itac.at (mail.itac.at [91.205.172.9])
	by mx1.freebsd.org (Postfix) with ESMTP id C214F8FC15
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 30 Jun 2010 11:14:11 +0000 (UTC)
Received: from [78.142.74.81] (helo=localhost)
	by mail.itac.at with esmtpa (Exim 4.63)
	(envelope-from <decke@FreeBSD.org>)
	id 1OTvF3-0004gp-V4; Wed, 30 Jun 2010 13:14:10 +0200
Message-Id: <20100630131326.3b423645@FreeBSD.org>
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: [PATCH] x11/slim: Fix crash on SIGTERM

>Number:         148258
>Category:       ports
>Synopsis:       [PATCH] x11/slim: Fix crash on SIGTERM
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    decke
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 30 11:20:07 UTC 2010
>Closed-Date:    Wed Jun 30 18:45:51 UTC 2010
>Last-Modified:  Wed Jun 30 18:50:09 UTC 2010
>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:
Responsible-Changed-From-To: freebsd-ports-bugs->decke 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Wed Jun 30 11:21:15 UTC 2010 
Responsible-Changed-Why:  
Submitter has GNATS access (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=148258 
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Wed Jun 30 11:21:18 UTC 2010 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=148258 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: henry.hu.sh@gmail.com
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/148258: [PATCH] x11/slim: Fix crash on SIGTERM
Date: Wed, 30 Jun 2010 11:21:16 UT

 Maintainer of x11/slim,
 
 Please note that PR ports/148258 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/148258
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Henry Hu <henry.hu.sh@gmail.com>
To: bug-followup@freebsd.org, decke@freebsd.org
Cc:  
Subject: Re: ports/148258: [PATCH] x11/slim: Fix crash on SIGTERM
Date: Wed, 30 Jun 2010 22:46:24 +0800

 Please commit it, thanks!
 
 -- 
 Cheers,
 Henry
State-Changed-From-To: feedback->closed 
State-Changed-By: decke 
State-Changed-When: Wed Jun 30 18:45:51 UTC 2010 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=148258 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/148258: commit references a PR
Date: Wed, 30 Jun 2010 18:42:42 +0000 (UTC)

 decke       2010-06-30 18:42:29 UTC
 
   FreeBSD ports repository
 
   Modified files:
     x11/slim             Makefile 
   Added files:
     x11/slim/files       patch-002-fix-shutdown 
   Log:
   - Add patch from upstream to fix crash on SIGTERM
   - Bump PORTREVISION
   
   PR:             ports/148258
   Submitted by:   myself
   Approved by:    Henry Hu <henry.hu.sh AT gmail.com> (maintainer), beat (co-mentor)
   Obtained from:  http://svn.berlios.de/wsvn/slim/?rev=169
   Feature safe:   yes
   
   Revision  Changes    Path
   1.22      +1 -1      ports/x11/slim/Makefile
   1.1       +65 -0     ports/x11/slim/files/patch-002-fix-shutdown (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
