You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2026/10/09 12:46:36 UTC

[Bug 70262] New: --rename option for service.bat fails to rename exe files

https://bz.apache.org/bugzilla/show_bug.cgi?id=70262

            Bug ID: 70262
           Summary: --rename option for service.bat fails to rename exe
                    files
           Product: Tomcat 11
           Version: 11.0.25
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Packaging
          Assignee: dev@tomcat.apache.org
          Reporter: gary.grove@level8.solutions
  Target Milestone: -------

I am calling

service.bat install NewName --rename

It gives these errors:

The system cannot find the file specified.
The system cannot find the file specified.
'"C:\Level8\Tomcat\tomcat-11\bin\NewName.exe"' is not recognized as an internal
or external command, operable program or batch file.

Looking at service.bat, I found the following:

if exist "%CATALINA_HOME%\bin\%DEFAULT_SERVICE_NAME%.exe" (
    if "x%RENAME%x" == "x--renamex" (
        rename "%DEFAULT_SERVICE_NAME%.exe" "%SERVICE_NAME%.exe"
        rename "%DEFAULT_SERVICE_NAME%w.exe" "%SERVICE_NAME%w.exe"
        set "EXECUTABLE=%CATALINA_HOME%\bin\%SERVICE_NAME%.exe"
    )
)

Either these rename commands need to include the path to the files, as used in
the exist test, or there needs to be a cd to move to the correct folder.

Similarly, on remove, the code is:

if exist "%CATALINA_HOME%\bin\%SERVICE_NAME%.exe" (
    rename "%SERVICE_NAME%.exe" "%DEFAULT_SERVICE_NAME%.exe"
    rename "%SERVICE_NAME%w.exe" "%DEFAULT_SERVICE_NAME%w.exe"
)

It fails for the same reasons as the install rename commands, but doesn't this
need a check to see if SERVICE_NAME and DEFAULT_SERVICE_NAME are the same?

It currently always tries to rename the files and always fails.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 70262] --rename option for service.bat fails to rename exe files

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70262

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Thanks for the PR.

Fixed in:
- 11.0.x for 11.0.28 onwards
- 10.1.x for 10.1.62 onwards
-  9.0.x for  9.0.124 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 70262] --rename option for service.bat fails to rename exe files

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70262

--- Comment #2 from StrongOx <ea...@gmail.com> ---
(In reply to Christopher Schultz from comment #1)
> Would you like to prepare a patch/PR for merging?

I have initiated a pr for this issue:
https://github.com/apache/tomcat/pull/1095
May you review it for me ?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 70262] --rename option for service.bat fails to rename exe files

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70262

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Christopher Schultz <ch...@christopherschultz.net> ---
Would you like to prepare a patch/PR for merging?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 70262] --rename option for service.bat fails to rename exe files

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70262

--- Comment #3 from Gary Grove <ga...@level8.solutions> ---
(In reply to StrongOx from comment #2)
> (In reply to Christopher Schultz from comment #1)
> > Would you like to prepare a patch/PR for merging?
> 
> I have initiated a pr for this issue:
> https://github.com/apache/tomcat/pull/1095
> May you review it for me ?

I have reviewed the changes and added a comment in github.

The changes all look good and I have tested that the script now handles the
renaming of the exe files correctly when both installing and removing the
service.
These changes have also added further checking and error reporting.

Will these changes be included in the other versions of Tomcat?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org