Bug 1104704 - /usr/sbin/tomcat overrides settings specified in /etc/sysconfig/${NAME}
Summary: /usr/sbin/tomcat overrides settings specified in /etc/sysconfig/${NAME}
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: tomcat
Version: el6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Coty Sutherland
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-04 14:13 UTC by C. Morgan Hamill
Modified: 2016-09-02 22:19 UTC (History)
4 users (show)

Fixed In Version: tomcat-7.0.70-2.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-02 09:22:31 UTC
Type: Bug


Attachments (Terms of Use)

Description C. Morgan Hamill 2014-06-04 14:13:50 UTC
Description of problem:

If one sets up an instance of tomcat by linking /etc/init.d/${NAME} to /etc/sysconfig/tomcat and setting instance-specific environment variables in /etc/sysconfig/%{NAME}, the script /usr/sbin/tomcat overwrites these by reading /etc/tomcat/tomcat.conf directly.

Version-Release number of selected component (if applicable):
7.0.33-4

How reproducible:
Setting up a second instance of tomcat and specifying evironment variables in /etc/sysconfig/${NAME}

Steps to Reproduce:
1. ln -s /etc/init.d/tomcat /etc/init.d/foo
2. cp /etc/sysconfig/tomcat /etc/sysconfig/foo
3. echo 'CATALINA_PID=/var/run/foo.pid' >> /etc/sysconfig/foo
4. /etc/init.d/foo start

Actual results:
CATALINA_PID will be /var/run/tomcat.pid

Expected results:
CATALINA_PID will be /var/run/foo.pid

Additional info:
Can be fixed by removing these lines from /usr/sbin/tomcat:

# Get the tomcat config (use this for environment specific settings)
if [ -z "${TOMCAT_CFG}" ]; then
  TOMCAT_CFG="/etc/tomcat/tomcat.conf"
fi

if [ -r "$TOMCAT_CFG" ]; then
  . $TOMCAT_CFG
fi

Comment 1 Jason Woods 2014-12-05 20:34:10 UTC
The workaround provided in additional information does not persist if the tomcat package is updated.

My workaround was to add this to the top of /etc/tomcat/tomcat.conf:
# Fix the problem by refusing to override stuff from /usr/sbin/tomcat
HACK="BUG1104704"; if [ "$0" == "/usr/sbin/tomcat" ]; then return; fi

This persists even if tomcat is updated. But hopefully this can be fixed in the next package update! If any help is required I don't mind assisting.

Thanks.

Comment 2 Ken Geis 2015-02-22 05:41:40 UTC
Can two followups be considered verification of this bug? I'd love to see this fixed.

My workaround was to put TOMCAT_CFG=/etc/syscongig/<NAME> in my /etc/sysconfig/<NAME> file.

Comment 3 Coty Sutherland 2016-02-10 20:00:43 UTC
https://github.com/csutherl/fedora-tomcat/commit/868fe0c

I updated the wrapper to check to see if a configuration has been loaded yet similar to what fc22+ does with the systemd unit. If $TOMCAT_CFG_LOADED is empty, then it loads $TOMCAT_CFG otherwise it doesn't. The default behavior will only change if you set $TOMCAT_CFG_LOADED in the tomcat.conf (I've added it there by default also).

Feedback welcome :)

Comment 4 Coty Sutherland 2016-02-10 20:01:28 UTC
Also note that I didn't updated the jsvc-wrapper because that block is already commented out and I didn't update the tool wrapper because it isn't used in a service (it should always be called as a binary).

Comment 5 Mike McCune 2016-03-28 22:44:25 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune@redhat.com with any questions

Comment 7 Fedora Update System 2016-08-05 20:10:43 UTC
tomcat-7.0.70-2.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-3ff1f4485b

Comment 8 Fedora Update System 2016-08-09 02:17:51 UTC
tomcat-7.0.70-2.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-3ff1f4485b

Comment 9 Fedora Update System 2016-09-01 16:20:07 UTC
tomcat-7.0.70-2.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2016-09-02 09:21:55 UTC
tomcat-7.0.70-2.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Ken Geis 2016-09-02 16:40:20 UTC
With this update, my workaround stopped working, and the core issue was not resolved.

Comment 12 Ken Geis 2016-09-02 22:19:49 UTC
It seems that tomcat.conf should not be setting CATALINA_PID. Because it is set here, the init script never gets a chance to set it to /var/run/${NAME}.pid.


Note You need to log in before you can comment on or make changes to this bug.