Bug#856602: postinst sed delimiter causes failure
Joshua Powers
josh.powers at canonical.com
Thu Mar 2 20:03:09 UTC 2017
Package: tomcat7
Version: 7.0.75-1
Similiar to Debian bug #597814, the sed statement in the postinst
assumes there is no '%' in a user's JAVA_OPTS. However, this is a valid
possiblity, for example:
-XX:ErrorFile=/var/log/tomcat7/java_error%p.log
This will cause the sed command to fail as it finds a % too early. The
delimiter was previous a '/' however, that can obviously be found in a
path. I would propose that this be changed to use the '|' symbol as it
should be even less common then the % symbol.
Another alternative to remove this situation entirely would be to escape
the strings matching the delimeter.
debian/tomcat7.postinst debian/tomcat7.postinst
index a8919dd..083c6a3 100644
--- debian/tomcat7.postinst
+++ debian/tomcat7.postinst
@@ -20,9 +20,9 @@ case "$1" in
tmpfile=`mktemp /tmp/tomcat7.XXXXXXXXXX`
chmod 644 $tmpfile
cat $TEMPLATE \
- | sed "s%^TOMCAT7_USER=.*$%TOMCAT7_USER=$TOMCAT7_USER%" \
- | sed "s%^TOMCAT7_GROUP=.*$%TOMCAT7_GROUP=$TOMCAT7_GROUP%" \
- | sed "s%^JAVA_OPTS=.*$%JAVA_OPTS=\"$JAVA_OPTS\"%" \
+ | sed "s|^TOMCAT7_USER=.*$|TOMCAT7_USER=$TOMCAT7_USER|" \
+ | sed "s|^TOMCAT7_GROUP=.*$|TOMCAT7_GROUP=$TOMCAT7_GROUP|" \
+ | sed "s|^JAVA_OPTS=.*$|JAVA_OPTS=\"$JAVA_OPTS\"|" \
>> $tmpfile
ucf --debconf-ok --sum-file /usr/share/tomcat7/defaults.md5sum $tmpfile $CONFFILE
rm -f $tmpfile
--
Joshua Powers
Ubuntu Server
Canonical Ltd
More information about the pkg-java-maintainers
mailing list