The start_precmd with the setenv.sh has no effect and shall be dropped for these reasons: 1. It has been designed to be sourced by catalina.sh, we aren't using it. We use jsvc (which could probably have been done with daemon(8)) 2. None of the variables are available to the jsvc process when started with service(8) verified with: > @Override > protected void doGet(HttpServletRequest req, HttpServletResponse resp) > throws ServletException, IOException { > > PrintWriter w = resp.getWriter(); > > for (Map.Entry<String, String> prop : System.getenv().entrySet()) { > w.print(prop.getKey()); > w.print(" = "); > w.println(prop.getValue()); > } > > for (Map.Entry<Object, Object> prop : System.getProperties().entrySet()) { > w.print(prop.getKey()); > w.print(" = "); > w.println(prop.getValue()); > } > > } For service(8) it must be exported first, this isn't required by catalina.sh and not documented by pkg-message. At best, the start_precmd is dropped altogether. Users can always use ${name}_env to pass vars. This works for me. This issue likely applies to all other Tomcat ports.
The only thing available to the jvsc process is: PATH = /sbin:/bin:/usr/sbin:/usr/bin RC_PID = 99363 PWD = / HOME = /
I'm ill now and will look later… Thanks for report.
(In reply to VVD from comment #2) Thanks for getting back to me. Sure, take your time and get well again.
(In reply to Michael Osipov from comment #0) > Users can always use ${name}_env to pass vars. This works for me. What do you mean? There isn't ${name}_env in www/tomcat85/files/tomcat85.in.
(In reply to VVD from comment #4) And it does not has to be because this is done by the init system itself for very init script by default. Please see rc.subr(8) manpage. Please try to set an env var in setenv.sh and check it wether is available in the daemon process, it don't. Therefore, the start_precmd is pointless.
Ok. I'll make patch after https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229102 commited. Still waiting somebody with commit bit…
Michael Osipov, check this - is it what you ask: > --- www/tomcat85.orig/files/tomcat85.in > +++ www/tomcat85/files/tomcat85.in > @@ -131,15 +131,4 @@ > org.apache.catalina.startup.Bootstrap \ > ${_tomcat_pipe_cmd}" > > -start_precmd="tomcat_prestart" > - > -tomcat_prestart() > -{ > - if [ -r "${_tomcat_catalina_base}/bin/setenv.sh" ]; then > - . "${_tomcat_catalina_base}/bin/setenv.sh" > - elif [ -r "${_tomcat_catalina_home}/bin/setenv.sh" ]; then > - . "${_tomcat_catalina_home}/bin/setenv.sh" > - fi > -} > - > run_rc_command "$1"
(In reply to VVD from comment #7) Exactly! The proper equivalent is $tomcat85_env.
Created attachment 195504 [details] drop start_precmd from tomcat85.in
This should be applied to tomcat7 and tomcat8 as well?
A commit references this bug: Author: dbaio Date: Sun Jul 29 12:45:19 UTC 2018 New revision: 475658 URL: https://svnweb.freebsd.org/changeset/ports/475658 Log: www/tomcat85: Remove start_precmd from rcfile This is not being used, users can use $tomcat85_env to pass variables. PR: 228418 Submitted by: VVD <vvd@unislabs.com> (maintainer) Reported by: Michael Osipov <1983-01-06@gmx.net> Changes: head/www/tomcat85/Makefile head/www/tomcat85/files/tomcat85.in
(In reply to Danilo G. Baio from comment #10) > This should be applied to tomcat7 and tomcat8 as well? Yes. But not for tomcat6.
(In reply to VVD from comment #12) Ok, I'll open a review for ale@. Thanks.
Has this already been committed? If so, can we close this?
(In reply to Michael Osipov from comment #14) It was committed on www/tomcat85 only. Waiting approval for the maintainer of tomcat7 and tomcat8. Keep this PR open, please.
A commit references this bug: Author: dbaio Date: Sat Aug 25 19:27:58 UTC 2018 New revision: 478084 URL: https://svnweb.freebsd.org/changeset/ports/478084 Log: www/tomcat[6|7|8]: Bring improvements from Tomcat[85|9] - Add options [1] Based on Apache Tomcat documentation guidance, the default web applications have varying degrees of risk, these options will permit users to select which of the web applications should be installed. - Remove start_precmd from rcfile in Tomcat7 and Tomcat8 [2] This is not being used, users can use ${name}_env to pass variables - Mark additional config files as @sample [3] PR: 218865 [1] PR: 228418 [2] PR: 229102 [3] Submitted by: Matt <fsbruva@yahoo.com> [1] Submitted by: VVD <vvd@unislabs.com> [2] [3] Reported by: Michael Osipov <1983-01-06@gmx.net> [2] [3] Approved by: maintainer timeout (ale, > 3 weeks) Differential Revision: https://reviews.freebsd.org/D16499 Changes: head/www/tomcat6/Makefile head/www/tomcat6/pkg-plist head/www/tomcat7/Makefile head/www/tomcat7/files/tomcat7.in head/www/tomcat7/pkg-plist head/www/tomcat8/Makefile head/www/tomcat8/files/tomcat8.in head/www/tomcat8/pkg-plist