From jonc@wapsolutions.co.nz  Thu Feb 21 13:46:30 2002
Return-Path: <jonc@wapsolutions.co.nz>
Received: from wapsolutions.co.nz (port-91-96.fastadsl.net.nz [203.96.91.96])
	by hub.freebsd.org (Postfix) with ESMTP
	id 0D5E537B41E; Thu, 21 Feb 2002 13:46:27 -0800 (PST)
Received: (from jonc@localhost)
	by wapsolutions.co.nz (8.11.6/8.11.6) id g1LLkQv01993;
	Fri, 22 Feb 2002 10:46:26 +1300 (NZDT)
	(envelope-from jonc)
Message-Id: <200202212146.g1LLkQv01993@wapsolutions.co.nz>
Date: Fri, 22 Feb 2002 10:46:26 +1300 (NZDT)
From: Jonathan Chen <jonc@wapsolutions.co.nz>
Reply-To: Jonathan Chen <jonc@wapsolutions.co.nz>
To: FreeBSD-gnats-submit@freebsd.org
Cc: freebsd-java@freebsd.org
Subject: jakarta-tomcat-3.2.4 tomcatctl hangs, and startup fails
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         35189
>Category:       ports
>Synopsis:       jakarta-tomcat-3.2.4 tomcatctl hangs, and startup fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    znerd
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 21 13:50:01 PST 2002
>Closed-Date:    Mon Feb 25 00:04:28 PST 2002
>Last-Modified:  Mon Feb 25 00:10:01 PST 2002
>Originator:     Jonathan Chen
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
>Environment:
System: FreeBSD loki.wapsolutions.co.nz 4.5-STABLE FreeBSD 4.5-STABLE #0: Tue Feb 19 12:10:51 NZDT 2002 root@loki.wapsolutions.co.nz:/usr/src/sys/compile/LOKI i386
>Description:
1. /usr/local/bin/tomcatctl hangs when invoked.
2. /usr/local/etc/rc.d/020.jakarta-tomcat.sh fails on startup

>How-To-Repeat:
1. Invoke /usr/local/bin/tomcatctl
2. Invoke "/usr/local/etc/rc.d/020.jakarta-tomcat.sh start"
>Fix:

1. There's a missing & in tomcatctl start()
2. The supplied files/jakarta.sh shouldn't invoke su $USER when running
   tomcatctl. The tomcatctl script already does this. Also the nested
   invocation prevents the " tomcat" prompt from being generated on
   startup. In my opinion jakarta.sh is superflous, and all that needs
   to be done is to link 020.jakarta.sh to tomcatctl. Supplied patches
   reflect this.


diff -ru /usr/ports/www/jakarta-tomcat/Makefile ./Makefile
--- /usr/ports/www/jakarta-tomcat/Makefile	Fri Feb 22 09:33:15 2002
+++ ./Makefile	Fri Feb 22 10:20:56 2002
@@ -83,7 +83,7 @@
 	| ${SED} "/%%APP_SHORTNAME%%/s//${APP_SHORTNAME}/" \
 	| ${SED} "/%%APP_HOME%%/s//${APP_HOME:S/\//\\\//g}/" \
 	| ${SED} "/%%LOG_DIR%%/s//${LOG_DIR:S/\//\\\//g}/" \
-	| ${SED} "/%%STARTUP_SCRIPT_NAME%%/s//${PORTNAME}.sh/" \
+	| ${SED} "/%%RC_SCRIPT_NAME%%/s//${STARTUP_ORDER}.${PORTNAME}.sh/" \
 	| ${SED} "/%%JAVA_HOME%%/s//${JAVA_HOME:S/\//\\\//g}/" \
 	| ${SED} "/%%USER_NAME%%/s//${USER_NAME}/" \
 	| ${SED} "/%%STDOUT_LOG%%/s//${STDOUT_LOG:S/\//\\\//g}/" \
@@ -93,8 +93,7 @@
 	${CHMOD} 6554 ${CTL_SCRIPT}
 
 	@# Install the startup script
-	${CP} ${FILESDIR}/${PORTNAME}.sh ${STARTUP_SCRIPT}
-	${CHMOD} 0554 ${STARTUP_SCRIPT}
+	${LN} -sf ${CTL_SCRIPT} ${STARTUP_SCRIPT}
 
 	@# Create the directories that the application will create at the
 	@# first run
diff -ru /usr/ports/www/jakarta-tomcat/files/jakarta-tomcat.sh ./files/jakarta-tomcat.sh
--- /usr/ports/www/jakarta-tomcat/files/jakarta-tomcat.sh	Thu Feb 21 21:59:45 2002
+++ ./files/jakarta-tomcat.sh	Fri Feb 22 10:12:30 2002
@@ -1,24 +1,21 @@
 #!/bin/sh
 
 # Set some variables
-USER_NAME=%%USER_NAME%%
 MYSELF=`basename $0`
 CONTROL_SCRIPT=%%CONTROL_SCRIPT%%
 
 case "$1" in
 	start)
-		su - ${USER_NAME} -c "%%CONTROL_SCRIPT%% start" > /dev/null ; echo -n
+		%%CONTROL_SCRIPT%% start
 		;;
 	stop)
-		su - ${USER_NAME} -c "%%CONTROL_SCRIPT%% stop"
+		%%CONTROL_SCRIPT%% stop
 		;;
 	restart)
-		su - ${USER_NAME} -c "%%CONTROL_SCRIPT%% restart"
+		%%CONTROL_SCRIPT%% restart
 		;;
 	*)
-		echo ""
 		echo "Usage: ${MYSELF} { start | stop | restart }"
-		echo ""
 		exit 64
 		;;
 esac
diff -ru /usr/ports/www/jakarta-tomcat/files/tomcatctl ./files/tomcatctl
--- /usr/ports/www/jakarta-tomcat/files/tomcatctl	Fri Feb 22 09:33:15 2002
+++ ./files/tomcatctl	Fri Feb 22 10:04:59 2002
@@ -68,7 +68,7 @@
 	if [ "${AS_RC_SCRIPT}" = "yes" ]; then
 		echo -n " %%APP_SHORTNAME%%"
 	fi
-	su - ${USER_NAME} -c "(cd ${APP_HOME} && ${JAVA_CMD} -cp ${CLASSPATH} -Dtomcat.home=${APP_HOME} org.apache.tomcat.startup.Tomcat) >> ${STDOUT_LOG} 2>> ${STDERR_LOG}"
+	su - ${USER_NAME} -c "(cd ${APP_HOME} && ${JAVA_CMD} -cp ${CLASSPATH} -Dtomcat.home=${APP_HOME} org.apache.tomcat.startup.Tomcat) >> ${STDOUT_LOG} 2>> ${STDERR_LOG}" &
 }
 
 # Function that stops the application
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->znerd 
Responsible-Changed-By: petef 
Responsible-Changed-When: Thu Feb 21 15:45:12 PST 2002 
Responsible-Changed-Why:  
Over to maintainer 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=35189 

From: Ernst de Haan <znerd@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, jonc@wapsolutions.co.nz
Cc:  
Subject: Re: ports/35189: jakarta-tomcat-3.2.4 tomcatctl hangs, and startup fails
Date: Fri, 22 Feb 2002 09:03:38 +0100

 I fixed this. Please cvsup and confirm that it's fixed.
 
 Ernst

From: Jonathan Chen <jonc@wapsolutions.co.nz>
To: Ernst de Haan <znerd@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org, jonc@wapsolutions.co.nz
Subject: Re: ports/35189: jakarta-tomcat-3.2.4 tomcatctl hangs, and startup fails
Date: Mon, 25 Feb 2002 09:29:09 +1300

 On Fri, Feb 22, 2002 at 09:03:38AM +0100, Ernst de Haan wrote:
 > I fixed this. Please cvsup and confirm that it's fixed.
 
 Yup, looks good! The pr can be closed.
 
 Just a minor note, you do realise that installing the tomcatctl script
 with suid and guid www doesn't have any effect since FreeBSD ignores
 them for shell scripts?
 
 Cheers.
 -- 
 Jonathan Chen <jonc@wapsolutions.co.nz>
State-Changed-From-To: open->closed 
State-Changed-By: znerd 
State-Changed-When: Mon Feb 25 00:04:28 PST 2002 
State-Changed-Why:  
Fixed the problem. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=35189 

From: Ernst de Haan <znerd@FreeBSD.org>
To: Jonathan Chen <jonc@wapsolutions.co.nz>
Cc: freebsd-gnats-submit@FreeBSD.org, jonc@wapsolutions.co.nz
Subject: Re: ports/35189: jakarta-tomcat-3.2.4 tomcatctl hangs, and startup fails
Date: Mon, 25 Feb 2002 09:06:15 +0100

 Jonathan,
 
 > Yup, looks good! The pr can be closed.
 
 Closed.
 
 > Just a minor note, you do realise that installing the tomcatctl script
 > with suid and guid www doesn't have any effect since FreeBSD ignores
 > them for shell scripts?
 
 No I did not realize that. Are you sure? I thought it actually worked on my 
 system, I tested that. Could you confirm this? Have any pointers to 
 documentation on it?
 
 
 Ernst
 
 -- 
 Ernst de Haan
 EuroNet Internet B.V.
 
     "Come to me all who are weary and burdened
         and I will give you rest" -- Jesus Christ
>Unformatted:
