Package: javahelper
Version: 0.19
Severity: normal
Tags: patch

If a MANIFEST.MF file had a field with multi-line value, jh_manifest 
damages the MANIFEST.MF file that it writes.

Attached is a patch (jh_manifest.diff) that fixes this issue.
Also I have attached a MANIFEST.MF file as an example of an input 
manifest file that jh_manifest used to damage.

Note: in the patch I also made a change to make jh_manifest not to 
rewrite the manifest file if the user neither adds extra fields nor 
overrides existing fields.

-- System Information:
Debian Release: 5.0
  APT prefers jaunty-updates
  APT policy: (500, 'jaunty-updates'), (500, 'jaunty-security'), (500, 
'jaunty-proposed'), (500, 'jaunty-backports'), (500, 'jaunty')
Architecture: i386 (i686)

Kernel: Linux 2.6.28-14-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages javahelper depends on:
ii  bsdmainutils      6.1.10ubuntu3          collection of more utilities from 
ii  debhelper         7.2.8ubuntu1           helper programs for debian/rules
ii  devscripts        2.10.48ubuntu1~jaunty1 scripts to make the life of a Debi
ii  fastjar           2:0.97-3               Jar creation utility
pn  gcj               <none>                 (no description available)
ii  python            2.6.2-0ubuntu1         An interactive high-level object-o
ii  python-debian     0.1.12ubuntu2          Python modules to work with Debian
pn  python-scriptutil <none>                 (no description available)
ii  realpath          1.12                   Return the canonicalized absolute 
ii  zip               2.32-1                 Archiver for .zip files

javahelper recommends no packages.

javahelper suggests no packages.
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 14.0-b08 (Sun Microsystems Inc.)
Main-Class: net.sf.zekr.ZekrMain
Class-Path: /usr/share/java/log4j-1.2.jar /usr/share/java/swt.jar /usr
 /share/java/lucene-core.jar /usr/share/java/lucene-highlighter.jar /u
 sr/share/java/lucene-snowball.jar /usr/share/java/commons-logging.jar
  /usr/share/java/commons-lang.jar /usr/share/java/commons-io.jar /usr
 /share/java/commons-collections3.jar /usr/share/java/commons-codec.ja
 r /usr/share/java/commons-configuration.jar /usr/share/java/velocity.
 jar

* Fixed parsing of a manifest file that got a multi-line field
* No need to rewrite manifest file if user provided no overrides or extra 
  fields.
--- jh_manifest.orig    2008-12-24 01:26:20.000000000 +0200
+++ jh_manifest 2009-07-16 16:39:32.000000000 +0300
@@ -76,12 +76,15 @@
    if not "Class-Path" in manifest["top"] and "CLASSPATH" in os.environ:
       manifest["top"]["Class-Path"] = os.environ["CLASSPATH"].replace(":", " ")
 
-   writeManifest(tempdir + "/MANIFEST.MF", manifest)
+   # No need to rewrite manifest if there are no overrides !
+   if {"top":{}} != manifest:
+     writeManifest(tempdir + "/MANIFEST.MF", manifest)
 
    if "--no-act" in args or "-n" in args:
       print jar+":"
       print str(manifest)
-   else:
+   elif {"top":{}} != manifest:
+   # No need to rewrite manifest if there are no overrides !
       os.system("rm -f '"+jar+"' ")
       os.system("cd '"+tempdir+"' ; ls -1 | egrep -v '^(META-INF|MANIFEST.MF)' 
| fastjar -c -f '"+jar+"' -m MANIFEST.MF -@")
 
@@ -153,7 +156,7 @@
             manifest[section] = {}
          for i in sec:
             if not i.strip() in manifest[section]:
-               manifest[section][i.strip()] = sec[i].strip()
+               manifest[section][i.strip()] = sec[i].strip().replace('\n ','')
          section = ""
    else:
       lines = f.readlines()

Reply via email to