From nobody@FreeBSD.org  Fri Mar  7 19:05:15 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 53C961065673
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  7 Mar 2008 19:05:15 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 422178FC25
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  7 Mar 2008 19:05:15 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m27J29Sw099264
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 7 Mar 2008 19:02:09 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m27J297r099263;
	Fri, 7 Mar 2008 19:02:09 GMT
	(envelope-from nobody)
Message-Id: <200803071902.m27J297r099263@www.freebsd.org>
Date: Fri, 7 Mar 2008 19:02:09 GMT
From: Gerard Seibert <gerard@seibercom.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: gsnapshot crashes upon startup on FreeBSD-6.3
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         121473
>Category:       ports
>Synopsis:       graphics/gsnapshot crashes upon startup on FreeBSD-6.3
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    itetcu
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 07 19:10:07 UTC 2008
>Closed-Date:    Tue May 06 07:49:49 UTC 2008
>Last-Modified:  Tue May 06 07:49:49 UTC 2008
>Originator:     Gerard Seibert
>Release:        FreeBSD-6.3
>Organization:
>Environment:
FreeBSD scorpio.seibercom.net 6.3-STABLE FreeBSD 6.3-STABLE #0: Sat Jan 19 22:26:50 EST 2008     gerard@scorpio.seibercom.net:/usr/obj/usr/src/sys/SCORPIO  i386

>Description:
'graphics/gsnapshot' build OK; however, it crashes when started. This is the output from a 'gdb' session:

Script started on Fri Mar  7 12:46:47 2008
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions. Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details. This GDB was configured as "i386-marcel-freebsd"...
(gdb) rruunn
Starting program: /usr/local/bin/gsnapshot 
[New LWP 100124]
[New Thread 0x8080000 (LWP 100124)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x8080000 (LWP 100124)]
0x08050dee in _L (label=LABEL_APPLY) at language.c:338
338	    if (strcmp(lang, "de") == 0 || strcmp(lang, "de_DE") ==
0) (gdb) bbtt  ffuullll
#0  0x08050dee in _L (label=LABEL_APPLY) at language.c:338
	lang = 0x0
#1  0x0804c22e in construct_viewer (layout=0x80a2080, window=0x80bb000)
at gsnapshot.c:243 button = (GtkWidget *) 0x80a20d0
	hbox = (GtkWidget *) 0x80a20d0
	vbox = (GtkWidget *) 0x80a2120
	box = (GtkWidget *) 0x80a4050
#2  0x0804caaf in interface (window=0x80bb000) at gsnapshot.c:414
	layout = (GtkWidget *) 0x80a2080
#3  0x0804cb68 in main (argc=1, argv=0xbfbfe9b0) at gsnapshot.c:452
	window = (GtkWidget *) 0x80bb000
	memory = {window = 0x80bb000, layout = 0xbfbfea6c, browser =
0xbfbfea74, viewer = 0x80a4050, image = 0x0, decorations = 0, hide = 1,
delay = 0, mode = 0, print = 0x2807ab88, save = 0xbfbfe978} (gdb)
qquuiitt The program is running.  Exit anyway? (y or n) y

Script done on Fri Mar  7 12:47:37 2008
>How-To-Repeat:
Build and run the program.
>Fix:
Mel <fbsd.questions@rachie.is-a-geek.net> suggested the following:

Well, that's kinda bogus coding on gsnapshot's part.
Do a send-pr(1) and report that this port requires LANG to be set in the 
environment in order to run and/or apply the patch inlined below my sig.

This is the suggested patch. (Also included as an attachment)

--- language.c.orig     2007-07-15 14:05:23.000000000 -0800
+++ language.c  2008-03-07 09:19:50.000000000 -0900
@@ -335,6 +335,9 @@
 {
   if (spoken == NULL) {
     char *lang = getenv("LANG");
+    if(!lang)
+           return TranslationEnglish[label].locale;
+
     if (strcmp(lang, "de") == 0 || strcmp(lang, "de_DE") == 0)
       spoken = TranslationGerman;
     else if (strcmp(lang, "es") == 0 || strcmp(lang, "es_ES") == 0)

Patch attached with submission follows:

--- language.c.orig     2007-07-15 14:05:23.000000000 -0800
+++ language.c  2008-03-07 09:19:50.000000000 -0900
@@ -335,6 +335,9 @@
 {
   if (spoken == NULL) {
     char *lang = getenv("LANG");
+    if(!lang)
+           return TranslationEnglish[label].locale;
+
     if (strcmp(lang, "de") == 0 || strcmp(lang, "de_DE") == 0)
       spoken = TranslationGerman;
     else if (strcmp(lang, "es") == 0 || strcmp(lang, "es_ES") == 0)

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->itetcu 
Responsible-Changed-By: itetcu 
Responsible-Changed-When: Mon May 5 09:12:43 UTC 2008 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121473 
State-Changed-From-To: open->feedback 
State-Changed-By: itetcu 
State-Changed-When: Mon May 5 09:14:01 UTC 2008 
State-Changed-Why:  
Since you are interested in this port, maybe you'd like to take 
maintanership? 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/121473: commit references a PR
Date: Tue,  6 May 2008 07:38:24 +0000 (UTC)

 itetcu      2008-05-06 07:38:19 UTC
 
   FreeBSD ports repository
 
   Modified files:
     graphics/gsnapshot   Makefile 
   Added files:
     graphics/gsnapshot/files patch-src__language.c 
   Log:
   - Fix crash if LANG is not set in env
   - Bump PORTREVISION
   
   PR:             ports/121473
   Submitted by:   Gerard Seibert <gerard@seibercom.net>,
                   patch from Mel <fbsd.questions@rachie.is-a-geek.net>
   
   Revision  Changes    Path
   1.4       +1 -1      ports/graphics/gsnapshot/Makefile
   1.1       +12 -0     ports/graphics/gsnapshot/files/patch-src__language.c (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"
 
State-Changed-From-To: feedback->closed 
State-Changed-By: itetcu 
State-Changed-When: Tue May 6 07:49:48 UTC 2008 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121473 
>Unformatted:
