Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Sep 2007 02:49:05 -0300
From:      "Alejandro Pulver" <alepulver@FreeBSD.org>
To:        "FreeBSD gnats submit" <FreeBSD-gnats-submit@FreeBSD.org>
Subject:   ports/116729: [PATCH] www/tomcat{41, 55, 6}: fix 2 wrapper script problems
Message-ID:  <1191044945.29192@deimos.mars.bsd>
Resent-Message-ID: <200709290550.l8T5o92M058290@freefall.freebsd.org>

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

>Number:         116729
>Category:       ports
>Synopsis:       [PATCH] www/tomcat{41,55,6}: fix 2 wrapper script problems
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 29 05:50:08 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Alejandro Pulver
>Release:        FreeBSD 6.2-RELEASE i386
>Organization:
>Environment:


System: FreeBSD 6.2-RELEASE #0: Fri Jan 12 11:05:30 UTC 2007
    root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP



>Description:


When I was taking code from the wrapper script for a new port (databases/exist), I saw 2 problems in it:

1) When the daemon is not running, 'procname' is empty and the call to check_pidfile fails.
2) The use of *$procname* causes shell expansion, and together with the previous one, generates an error because ** matches every file in the directory.

Note: these errors do not stop the script from working, but might produce strange results (for example the output) in some situations.


>How-To-Repeat:


Run when the daemon is not started:

${PREFIX}/etc/rc.d/tomcat66.sh forcestop

Apply the patch, and run again.


>Fix:


--- tomcat6.diff begins here ---
Index: tomcat6/files/tomcat6.sh.in
===================================================================
RCS file: /home/pcvs/ports/www/tomcat6/files/tomcat6.sh.in,v
retrieving revision 1.1
diff -u -r1.1 tomcat6.sh.in
--- tomcat6/files/tomcat6.sh.in	18 Feb 2007 12:56:16 -0000	1.1
+++ tomcat6/files/tomcat6.sh.in	29 Sep 2007 05:39:25 -0000
@@ -112,6 +112,9 @@
     procname=`ps -o ucomm= $rc_pid`
   fi
 fi
+if [ -z "$procname" ]; then
+  procname=nonexistent
+fi
 
 required_files="${tomcat%%TOMCAT_VERSION%%_catalina_home}/conf/server.xml"
 
@@ -128,7 +131,7 @@
 }
 
 tomcat%%TOMCAT_VERSION%%_stop() {
-	rc_pid=$(check_pidfile $pidfile *$procname*)
+	rc_pid=$(check_pidfile $pidfile $procname)
 
 	if [ -z "$rc_pid" ]; then
 		[ -n "$rc_fast" ] && return 0
--- tomcat6.diff ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:



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