Bug 290970 - www/tomcat110, www/tomcat[91]*: fix rc script with /usr/sbin/service
Summary: www/tomcat110, www/tomcat[91]*: fix rc script with /usr/sbin/service
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Vladimir Druzenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-12 11:59 UTC by geoffroy desvernay
Modified: 2025-11-16 01:51 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (vvd)


Attachments
git diff www/tomcat* (2.28 KB, patch)
2025-11-12 11:59 UTC, geoffroy desvernay
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description geoffroy desvernay 2025-11-12 11:59:31 UTC
Created attachment 265357 [details]
git diff www/tomcat*

currently, using service(8) command cannot work with tomcat rc script, because $name is not defined.

'service -e' doesn't list /usr/local/etc/rc.d/tomcat110 as enabled when tomcat110_enabled="YES", service -R will restart all local services but tomcat*…

I patched the rc script to make it work here, it only lacks support for symlink if main script's name is not enabled, and should not break any existing setup.

Another option would require to patch /usr/sbin/service to define name from $file when not properly defined in script, but this could break things elsewhere.

Here is the patch I apply to our poudriere setup (and yes, the added ';' is usefull to get /usr/sbin/service's "eval" define name correctly)

Hope this helps
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2025-11-12 12:24:14 UTC
Commands like "service tomcat110 restart" work for me - I'm using tomcat on several hosts for ages.
Comment 2 Michael Osipov freebsd_committer freebsd_triage 2025-11-12 19:10:35 UTC
It works for me as well. I am not saying that this is not valid, but I don't understand the problem yet....
Comment 3 geoffroy desvernay 2025-11-14 18:20:49 UTC
the failing ones are using 'service -e' to list enabled services, or 'service -R' to restart all services on the host (without specifying 'tomcat110')
It's able to list all pkg services but tomcat110, because it tries to get name of service with "eval `grep ^name= $file`", and $name ends empty
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2025-11-16 01:51:58 UTC
> eval `grep ^name= $file`
This is incorrect.
Must be something like: name=`basename $file`
It's bug in service(8).

> name=${name:-tomcat101}
This line is "not accepted".
The whole point is for the name to be determined dynamically at startup, depending on the name of the rc.d script. The script itself doesn't contain its name in any form.