Bug 230325 - www/tomcat{85,9}: daemon.sh incorrectly refers to jsvc executable
Summary: www/tomcat{85,9}: daemon.sh incorrectly refers to jsvc executable
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs mailing list
Keywords: needs-qa
Depends on:
Reported: 2018-08-03 12:53 UTC by Michael Osipov
Modified: 2018-12-04 03:08 UTC (History)
1 user (show)

See Also:
vvd: maintainer-feedback+
koobs: merge-quarterly?

1st draft (1.37 KB, patch)
2018-11-28 17:38 UTC, VVD
no flags Details | Diff
Patch for tomcat9 (1.85 KB, patch)
2018-12-03 11:48 UTC, VVD
vvd: maintainer-approval+
Details | Diff
Patch for tomcat85 (1.89 KB, patch)
2018-12-03 12:33 UTC, VVD
vvd: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Osipov 2018-08-03 12:53:15 UTC
While the daemon.sh is not directly used by the port, uses might still use it for development, thus the scripts needs to be fixed.

Commons Daemon is a runtime dependency so the spot in daemon.sh:

> # If not explicitly set, look for jsvc in CATALINA_BASE first then CATALINA_HOME
> if [ -z "$JSVC" ]; then
>     JSVC="$CATALINA_BASE/bin/jsvc"
>     if [ ! -x "$JSVC" ]; then
>         JSVC="$CATALINA_HOME/bin/jsvc"
>     fi
> fi

Shall be replaced with

> JSVC=%%PREFIX%%/bin/jsvc

or similar.
Comment 1 Michael Osipov 2018-08-03 12:54:42 UTC
This likely applies to 7.0 and 9.0 too.
Comment 2 VVD 2018-11-28 03:28:55 UTC
I don't know how to do this without hard-coded /usr/local.
Comment 3 Michael Osipov 2018-11-28 08:48:48 UTC
(In reply to VVD from comment #2)

There is no need to, you can simple patch the file with JSVC=%%PREFIX%%/bin/jsvc and then perform substition. Look what I do with Nexus OSS: https://github.com/michael-o/freebsd-ports/blob/master/devel/nexus2-oss/Makefile#L45 and https://github.com/michael-o/freebsd-ports/blob/master/devel/nexus2-oss/files/patch-conf_wrapper.conf#L20. I think this is perfectly fine.

Also make sure to replace line 138:
CLASSPATH="$CLASSPATH$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar" too with ${JAVAJARDIR}/commons-daemon.jar. See https://svnweb.freebsd.org/ports/head/devel/jakarta-commons-daemon/Makefile?view=markup#l33

If you need further assistance, let me know.
Comment 4 VVD 2018-11-28 17:03:15 UTC
So, I can use %%PREFIX%% in patches. Ok, I'll try.
Comment 5 VVD 2018-11-28 17:38:20 UTC
Created attachment 199644 [details]
1st draft

Check, plz, this one - is it what you ask?
Comment 6 Michael Osipov 2018-12-03 09:26:32 UTC
(In reply to VVD from comment #5)

The patch looks good to me, but is incomplete. Please look at this line: https://github.com/apache/tomcat/blob/trunk/bin/daemon.sh#L140

The last path component must be replaced with %JAVAJARDIR%/commons-daemon.jar.



# ll /usr/local/share/java/classes/
antlr-3.5.2-complete.jar  jline-0.9.94.jar          ojdbc-
commons-daemon.jar        jline.jar                 swt-devel.jar
hamcrest.jar              junit.jar
hamcrest1.3.jar           junit4.jar
Comment 7 VVD 2018-12-03 11:48:24 UTC
Created attachment 199793 [details]
Patch for tomcat9

Check this, plz.
Comment 8 Michael Osipov 2018-12-03 12:01:26 UTC
(In reply to VVD from comment #7)

Looks very good to me.
Comment 9 Kubilay Kocak freebsd_committer freebsd_triage 2018-12-03 12:25:12 UTC
Summary contains www/tomcat85, patch is for www/tomcat9.

Please clarify which (all?) tomcat ports require the update, and update the summary and patches accordingly
Comment 10 Michael Osipov 2018-12-03 12:26:43 UTC
The change applies in general to Tomcat 7/8.5/9 while the patch applies to Tomcat 9 only here. It require slight modifications for 8.5 (and 7 likely).
Comment 11 VVD 2018-12-03 12:33:07 UTC
Created attachment 199796 [details]
Patch for tomcat85
Comment 12 Michael Osipov 2018-12-03 13:48:19 UTC
(In reply to VVD from comment #11)

Applies cleanly, works for me.