Package: javatools Version: 0.45 Severity: important Tags: patch "jarwrapper" parses MANIFEST.MF line-by-line using `sed`. However java tools wrap manifest on 72nd character (and add space) so after parsing only 48 characters (72 - length("Debian-Java-Parameters: ")) of Debian-Java-Parameters are passed to application.
In the attached MANIFEST.MF I'm trying to pass Debian-Java-Parameters: -Dlogback.configurationFile=/etc/zabbix/logback.xml -server but jarwrapper strip it to -Dlogback.configurationFile=/etc/zabbix/logback. To fix this issue we need to merge multi-line values in MANIFEST.MF using the following filter: perl -0pE 's{\r?\n\s}{}gsm' or replace incorrect use of `sed` with the following patch: ~~~~~~~~ --- jarwrapper 2013-11-19 15:12:16.833880666 +1100 +++ /usr/bin/jarwrapper 2013-11-19 15:47:39.597893120 +1100 @@ -14,10 +14,10 @@ TEMP="`mktemp -d`" (cd "$TEMP"; fastjar xf "$JAR" META-INF/MANIFEST.MF) -NEW_JAVA_HOMES="`sed -n '/^Debian-Java-Home:/s/^[^:]*: *//p' "$TEMP/META-INF/MANIFEST.MF"`" -JAVAOPTS="`sed -n '/^Debian-Java-Parameters:/s/^[^:]*: *//p' "$TEMP/META-INF/MANIFEST.MF"`" +NEW_JAVA_HOMES="$(perl -0nE 's{\r?\n\s}{}gsm; print $1 if m{^Debian-Java-Home:\s*([^\r\n]+)}m;' "$TEMP/META-INF/MANIFEST.MF")" +JAVAOPTS="$(perl -0nE 's{\r?\n\s}{}gsm; print $1 if m{^Debian-Java-Parameters:\s*([^\r\n]+)}m;' "$TEMP/META-INF/MANIFEST.MF")" rm -rf "$TEMP" for i in $NEW_JAVA_HOMES; do if [ -x "$i/bin/java" ]; then ~~~~~~~~ I tested the above patch with dos and unix line endings in "MANIFEST.MF". -- Best wishes, Dmitry Smirnov GPG key : 4096R/53968D1B --- However beautiful the strategy, you should occasionally look at the results. -- Winston Churchill
Manifest-Version: 1.0 Created-By: 1.6.0_27 (Sun Microsystems Inc.) Debian-Java-Parameters: -Dlogback.configurationFile=/etc/zabbix/logback. xml -server Class-Path: /usr/share/java/json.jar /usr/share/java/logback-core.jar /u sr/share/java/logback-classic.jar /usr/share/java/slf4j-api.jar Main-Class: com.zabbix.gateway.JavaGateway