Bug 48793

Summary: catalina.sh: "stop" errors on HP-UX
Product: Tomcat 6 Reporter: Thomas GL <tom.gl>
Component: Native:PackagingAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.0.24   
Target Milestone: default   
Hardware: HP   
OS: HP-UX   
Attachments: Fix for some "[ $? -eq 1 ]" tests

Description Thomas GL 2010-02-22 13:58:40 UTC
Created attachment 25035 [details]
Fix for some "[ $? -eq 1 ]" tests

Hi,

In SVN commit 810611, the following shell pattern have used a few times in "catalina.sh":

    kill -0 $pid
    if [ $? -eq 1 ]; then
       ... OK, the process is dead ...
    fi

On HP-UX (11.11 here), this does not work as expected, because kill ("/usr/bin/kill" actually, it's not shell a built-in) returns 2 when the PID doesn't exist, and not 1 as assumed above.
It would be better to rewrite these tests like this :

   ...
   if [ $? -gt 0 ]; then 
      ...

A patch follows (made against 6.0.24).
Comment 1 Mark Thomas 2010-03-10 16:48:54 UTC
Thanks for the patch. It has been applied to trunk and proposed for 6.0.x
Comment 2 Mark Thomas 2010-05-14 15:48:44 UTC
Thanks again for the patch. The patch has been applied to 6.0.x and will be included in 6.0.27 onwards.