You are indeed correct, the culprit is a `%` in the java options of our 
affected servers, one example being:
JAVA_OPTS="-Djava.awt.headless=true 
-XX:ErrorFile=/var/log/tomcat7/java_error%p.log -Xms15025m -Xmx15025m 
-XX:+DisableExplicitGC -XX:+UseG1GC -XX:+UseStringDeduplication"

And for completeness:
$ debconf-show tomcat7
  tomcat7/groupname: tomcat7
  tomcat7/javaopts: -Djava.awt.headless=true 
-XX:ErrorFile=/var/log/tomcat7/java_error%p.log -Xms15025m -Xmx15025m 
-XX:+DisableExplicitGC -XX:+UseG1GC -XX:+UseStringDeduplication
  tomcat7/username: tomcat7

At first blush our solution worked, but this was a side affect of our
configuration management system rewriting the file and camouflaging the
fact that it isn't actually a solution at all!

Anyway, your explanation of what the regular expression is actually trying to 
accomplish leads to what I believe is a relatively trivial use of parameter 
expansion to escape the '%' in the JAVA_OPT environment variable:
| sed "s%^JAVA_OPTS=.*$%JAVA_OPTS=\"${JAVA_OPTS/\%/\\\%}\"%"

I was rather suspicious that this wasn't a known bug already, so I guess
I should have dug deeper originally.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1666570

Title:
  Post install script has error in RegEx

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tomcat7/+bug/1666570/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to