Bug 63689

Summary: Variable DISPLAYNAME in service.bat is empty instead of containing service display name.
Product: Tomcat 9 Reporter: Thorsten Schöning <tschoening>
Component: PackagingAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 9.0.24   
Target Milestone: -----   
Hardware: PC   
OS: All   

Description Thorsten Schöning 2019-08-23 14:03:03 UTC
service.bat from Tomcat 9.0.24 contains the following line:

> --DisplayName "%DISPLAYNAME%" ^

The problem is that this variable is used only ones and never defined anywhere. The same named file in Tomcat 8.0.53 additionally uses lines like the following:

> set SERVICE_NAME=%1
> set DISPLAYNAME=Apache Tomcat 8.0 %1

While most parts of the service are registered properly in Tomcat 9, it's not visible in the GUI service manager started using services.msc in the end. The problem was introduced in Bug 63285 in the following commit:

https://github.com/apache/tomcat/commit/7ac5fc8a59c10e7de1ee6d4b85c1ee797942a1e7#diff-e7a950755e93b9d7b1d4f61f74c93fc2

DISPLAYNAME was available before and got removed during C&P some lines of code:

> if "x%1x" == "x--userx" goto runAsUser
> set SERVICE_NAME=%1
> set DISPLAYNAME=Apache Tomcat @VERSION_MAJOR_MINOR@ %1
> shift

https://github.com/apache/tomcat/commit/7ac5fc8a59c10e7de1ee6d4b85c1ee797942a1e7#diff-e7a950755e93b9d7b1d4f61f74c93fc2L111

Now:

> if "x%1x" == "x--userx" goto runAsUser
> set SERVICE_NAME=%1
> shift

https://github.com/apache/tomcat/commit/7ac5fc8a59c10e7de1ee6d4b85c1ee797942a1e7#diff-e7a950755e93b9d7b1d4f61f74c93fc2R55

Tomcat 8.5.45 has the same problem.
Comment 1 Mark Thomas 2019-09-03 19:42:12 UTC
Thanks for the report and the analysis.

Fixed in:
- master for 9.0.25 onwards
- 8.5.x for 8.5.46 onwards

It was also fixed in 7.0.x but the bg was never included in a release.