tomcat6 doesn't configure cleanly with JAVA_OPTS having values with slashes

Bug #707348 reported by Stephan Rügamer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tomcat6 (Ubuntu)
New
Undecided
Unassigned
Nominated for Karmic by Stephan Rügamer
Nominated for Lucid by Stephan Rügamer
Nominated for Maverick by Stephan Rügamer
Nominated for Natty by Stephan Rügamer

Bug Description

Binary package hint: tomcat6

Dear Colleagues,

during security update of tomcat6 on maverick (and the same will happen everywhere), when you have a JAVA_OPTS line with something like that
JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Dpath.foo=/etc/foo/monitoring.properties"

the sed call of :

tmpfile=`mktemp /tmp/tomcat6.XXXXXXXXXX`
        chmod 644 $tmpfile
        cat $TEMPLATE \
                | sed "s/^TOMCAT6_USER=.*$/TOMCAT6_USER=$TOMCAT6_USER/" \
                | sed "s/^TOMCAT6_GROUP=.*$/TOMCAT6_GROUP=$TOMCAT6_GROUP/" \
                | sed "s/^JAVA_OPTS=.*$/JAVA_OPTS=\"$JAVA_OPTS\"/" \
                >> $tmpfile

will fail because of the slashes.

Those slashes are not escaped properly.

Adding a line with:

db_get tomcat6/javaopts && JAVA_OPTS="$RET" || JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"

        JAVA_OPTS=`echo $JAVA_OPTS|sed -e 's#\/#\\\/#g'`

helps here.

Please find attached the patched maverick tomcat6 src package with postinst fixed.
It needs to be done for lucid and natty and other releases too.

Regards,
\sh

Revision history for this message
Stephan Rügamer (sruegamer) wrote :
Revision history for this message
Thierry Carrez (ttx) wrote :

Fixed in Natty in as bug 654549, you should nominate against Maverick/Lucid there.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.