From clive@fatpipi.cirx.org  Sun Nov 24 13:05:51 2002
Return-Path: <clive@fatpipi.cirx.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id ECB1837B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 24 Nov 2002 13:05:51 -0800 (PST)
Received: from fatpipi.cirx.org (fatpipi.cirx.org [211.23.144.137])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 79E3643E4A
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 24 Nov 2002 13:05:50 -0800 (PST)
	(envelope-from clive@fatpipi.cirx.org)
Received: from fatpipi.cirx.org (clive@localhost.cirx.org [127.0.0.1])
	by fatpipi.cirx.org (8.12.6/8.12.6) with ESMTP id gAOL5npD091022
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 25 Nov 2002 05:05:49 +0800 (CST)
	(envelope-from clive@fatpipi.cirx.org)
Received: (from clive@localhost)
	by fatpipi.cirx.org (8.12.6/8.12.6/Submit) id gAOL5nUK091021;
	Mon, 25 Nov 2002 05:05:49 +0800 (CST)
Message-Id: <200211242105.gAOL5nUK091021@fatpipi.cirx.org>
Date: Mon, 25 Nov 2002 05:05:49 +0800 (CST)
From: Clive Lin <clive@freebsd.org>
Reply-To: Clive Lin <clive@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Add option to disable samba optimization.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         45691
>Category:       ports
>Synopsis:       Add option to disable samba optimization.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dwcjr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 24 13:10:03 PST 2002
>Closed-Date:    Wed Jan 01 13:09:36 PST 2003
>Last-Modified:  Wed Jan 01 13:09:36 PST 2003
>Originator:     Clive Lin
>Release:        FreeBSD 4.7-RELEASE-p1 i386
>Organization:
tongi.org
>Environment:
System: FreeBSD fatpipi.cirx.org 4.7-RELEASE-p1 FreeBSD 4.7-RELEASE-p1 #1: Mon Oct 28 03:38:43 CST 2002 root@fatpipi.cirx.org:/usr/obj/usr/src/sys/ROSE45 i386
# cc -v
Using builtin specs.
gcc version 2.95.4 20020320 [FreeBSD]

>Description:
	Disable compiling samba with -O flag to get samba functions correctly.
Otherwise samba is easy to get signal (SIGSEGV internally) and exit or core
dump (depends on sysctl kern.sugid_coredump setting) in certain condition.
 
>How-To-Repeat:
	Usually seen on RELENG_4 boxes. On -CURRENT, I haven't seen it. If
a divx/xvid/vosub/etc.. plugins equipped Windows Media Player is used, it's
more easily to trigger this.

>Fix:

diff -ruN samba.orig/Makefile samba/Makefile
--- samba.orig/Makefile	Mon Nov 25 04:20:17 2002
+++ samba/Makefile	Mon Nov 25 03:39:50 2002
@@ -21,6 +19,7 @@
 USE_GMAKE=	YES
 USE_LIBTOOL=	YES
 USE_AUTOCONF=	YES
+USE_REINPLACE=	YES
 
 # directories
 .if !defined(BATCH) && !defined(PACKAGE_BUILDING)
@@ -172,6 +171,9 @@
 .endif
 
 pre-build:
+.if defined(WITHOUT_OPTIMIZATION)
+	${REINPLACE_CMD} -e 's!-O!!g' ${WRKSRC}/Makefile
+.endif
 	${RM} -fr ${WRKSRC}/include/proto.h
 	(cd ${WRKSRC} && make proto)
 
diff -ruN samba.orig/files/patch-configure.in samba/files/patch-configure.in
--- samba.orig/files/patch-configure.in	Thu Jan  1 08:00:00 1970
+++ samba/files/patch-configure.in	Thu Nov  7 17:53:30 2002
@@ -0,0 +1,11 @@
+--- source/configure.in.orig	Thu Nov  7 17:52:42 2002
++++ source/configure.in	Thu Nov  7 17:53:09 2002
+@@ -168,7 +168,7 @@
+ AC_SUBST(LIBSMBCLIENT)
+ 
+ # compile with optimization and without debugging by default
+-CFLAGS="-O ${CFLAGS}"
++CFLAGS="${CFLAGS}"
+ 
+ AC_ARG_ENABLE(debug, 
+ [  --enable-debug          Turn on compiler debugging information (default=no)],
diff -ruN samba.orig/scripts/configure.samba samba/scripts/configure.samba
--- samba.orig/scripts/configure.samba	Thu Jul 11 21:32:55 2002
+++ samba/scripts/configure.samba	Mon Nov 25 03:23:12 2002
@@ -13,7 +13,7 @@
 else
 	/usr/bin/dialog --title "configuration options" --clear \
 		--checklist "\n\
-Please select desired options:" -1 -1 12 \
+Please select desired options:" -1 -1 13 \
 syslog		"With syslog support" OFF \
 ssl		"With ssl support" OFF \
 ldap		"With LDAP2 support" OFF \
@@ -26,6 +26,7 @@
 audit		"With Audit" OFF \
 winbind		"With Winbind" OFF \
 wbauth		"With Winbind Auth Challenge" OFF \
+nooptimize	"Without optimization" OFF \
 2> $tempfile
 
 	retval=$?
@@ -86,6 +87,9 @@
 			;;
 		\"wbauth\")
 			echo "WITH_WINBIND_AUTH_CHALLENGE=YES" >>${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
+			;;
+		\"nooptimize\")
+			echo "WITHOUT_OPTIMIZATION=YES" >>${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
 			;;
 		*)
 			echo "Invalid option: $1"


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->dwcjr 
Responsible-Changed-By: clive 
Responsible-Changed-When: Sun Nov 24 13:19:14 PST 2002 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45691 
State-Changed-From-To: open->closed 
State-Changed-By: clive 
State-Changed-When: Wed Jan 1 13:08:42 PST 2003 
State-Changed-Why:  
Issue solved. 

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