Created PPA with fix for Trusty here:
https://launchpad.net/~powersj/+archive/ubuntu/tomcat7-1666570

Attaching debdiff for trusty.

** Description changed:

- Ubuntu 14.04.5 LTS
- Tomcat7 7.0.52-1ubuntu0.10
+ == Begin SRU Template ==
+ [Impact] 
  
- Expected Result
- ===============
+  * On upgrade of tomcat7 package, if a user has updated their JAVA_OPTS 
variable to include a '%' an upgrade will fail. The sed command in the postinst 
uses the '%' character to act as a delimiter, previous versions used '/' 
however it was updated to '%' in hopes it was far less common.
+  * This SRU updates it to a character that should not be found in the 
JAVA_ARGS value, namely '\001'. 
+  * This is the same solution Debian and tomcat maintainers are now using for 
Tomcat8.
  
- When upgrading to a new version of tomcat7, I expect the upgrade to
- complete succesfully.
+ [Test Case]
  
- Actual Result
- =============
- When upgrading to a new version of tomcat7, the upgrade fails when running 
the post install script due to an unescaped "$" in a regular expression.
+ Install the version from the trusty pocket. Modify JAVA_OPTS and then
+ install the version from security/updates to reproduce the issue.
+ 
+  * lxc launch ubuntu-daily:trusty terusty
+  * lxc exec trusty bash
+  * apt install tomcat7=7.0.52-1
+  * Edit /etc/defaults/tomcat7, set JAVA_OPTS="-Djava.awt.headless=true 
-XX:ErrorFile=/var/log/tomcat7/java_error%p.log -XX:+DisableExplicitGC 
-XX:+UseG1GC"
+  * Enable proposed or use version from ppa (ppa:powersj/tomcat7-1666570)
+  * apt update
+  * apt install tomcat7
+  * Keep the local version currently installed
+  * With the fix, install will complete
+  * Without the fix, post-installation script will return a sed -e expression 
#1 error.
+ 
+ [Regression Potential]
+ 
+  * Using a new delimiter that is far less likely to be in someone's path. 
This is not the first time the delimiter has changed, as it originally as '/' 
which is obviously going to show up as soon as someone adds a path.
+  * Upstream change to tomcat8: 
https://anonscm.debian.org/cgit/pkg-java/tomcat8.git/patch/?id=7664221d66701e2c31a31fe3b4f22e8bea4158dc
+ 
+ [Other Info]
+ 
+  * Error message on failure:
  
  Setting up tomcat7 (7.0.52-1ubuntu0.10) ...
  sed: -e expression #1, char 97: unknown option to `s'
  dpkg: error processing package tomcat7 (--configure):
   subprocess installed post-installation script returned error exit status 1
  Errors were encountered while processing:
   tomcat7
  E: Sub-process /usr/bin/dpkg returned an error code (1)
- 
- The relevant line of regex is here:
- 
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/tomcat7/trusty-security/view/head:/debian/tomcat7.postinst#L25
- 
- It appears to also exist in the latest vivid package
- 
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/vivid/tomcat7/vivid/view/head:/debian/tomcat7.postinst#L25
- 
- Resolution
- ==========
- 
- vi /var/lib/dpkg/info/tomcat7.postinst
- # change line 25 from:
- | sed "s%^JAVA_OPTS=.*$%JAVA_OPTS=\"$JAVA_OPTS\"%" \
- # to
- | sed "s%^JAVA_OPTS=.*$%JAVA_OPTS=\"\$JAVA_OPTS\"%" \
- 
- And then run:
- dpkg --configure tomcat7
- 
- This I believe may be causing a number of other bug reports such as:
- https://bugs.launchpad.net/ubuntu/+source/tomcat7/+bug/1595880
- https://bugs.launchpad.net/ubuntu/+source/tomcat7/+bug/1604805
+  
+ == End SRU Template ==

** Patch added: "debdiff for trusty"
   
https://bugs.launchpad.net/ubuntu/+source/tomcat7/+bug/1666570/+attachment/4834136/+files/tomcat7_7.0.52-1ubuntu11.debdiff

-- 
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
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to