Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 91309

Summary: Eclipse doesn't honor Manifest.mf line length specification
Product: [Eclipse Project] PDE Reporter: Dirk Baeumer <dirk_baeumer>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.1   
Target Milestone: 3.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
The manifest that caused problems none

Description Dirk Baeumer CLA 2005-04-13 13:13:03 EDT
The line length of a manifest file is defined to 72.

http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html

However the manifest files PDE generated don't honor this. If you now create a
jar file using the jar tool or an ant task the manifest.mf gets mangled to fit
line length of 72. As a result the plug-in will not start anymore since the
package names get brocken up.
Comment 1 Wassim Melhem CLA 2005-04-13 13:32:01 EDT
the runtime parser tolerates lines longer than 72 chars and so does the JRE 
manifest parser.

That is why we tolerate lines up to 512 chars.  

If we impose the 72 char-restriction then the manifest would be difficult to 
read, especially with long package names and when you factor in the directives 
(x-internal, x-friends, etc.)

I suggest you use the plug-in export when you want to export your plug-ins.  
We can't be responsible for the JAR tool mangling your manifest.
Comment 2 Dani Megert CLA 2005-04-13 13:49:12 EDT
The question is whether it's OK to have a MANIFEST.MF which is in a JAR and
which does not follow the spec.
Comment 3 Wassim Melhem CLA 2005-04-13 13:49:53 EDT
It's perfectly fine.  
Comment 4 Dirk Baeumer CLA 2005-04-14 05:31:18 EDT
I ran into a problem when I used an ant task to generared a jar'd version of the
plug-in. The jarfile ant task massages the manifest.mf file and wraps lines at
72. These leads to jar'd plug-ins that can't be started anymore.
Comment 5 Wassim Melhem CLA 2005-04-14 09:11:01 EDT
I understand, but please use the plug-in export when jarring your plugin.  
Enforcing the 72-byte restriction would severely impede the legibility of the 
file and is unnecessary since both the runtime and the JRE manifest parser 
handle longer lines just fine.
Comment 6 Dani Megert CLA 2005-04-14 09:51:58 EDT
I think this is rather a runtime than a pde discussion: I'm not a gainst super
tooling but it should still be possible to use the standard tools to generate a
standard JAR manifest as defined by the spec.
Comment 7 Konrad Kolosowski CLA 2005-04-14 12:14:21 EDT
Can you attach the standard manifest that causes runtime a problem?
Comment 8 Jeff McAffer CLA 2005-04-14 14:18:36 EDT
We will have simiilar problems with the jarsigner.  It munges the manifests as 
ewll.  It is possible that we have a bug in our manifest parser that does not 
handle wrapped lines properly.  Dirk, can you supply the manifest that was 
causing trouble?  
Comment 9 Dirk Baeumer CLA 2005-04-15 06:21:39 EDT
Created attachment 19931 [details]
The manifest that caused problems
Comment 10 Jeff McAffer CLA 2005-04-15 09:18:13 EDT
there do not appear to be any strangely wrapped lines in that manifest.  Can 
you supply the actual faulty manifest
Comment 11 Dirk Baeumer CLA 2005-04-15 10:06:38 EDT
I don't have the file anymore and I already changed our ant scripts to use zip
instead of jar. To create it simply create a jar using the following ant task

<jar jarfile="${destjar}" manifest="META-INF/MANIFEST.MF">
	<fileset dir=".">
	  <include name="plugin.xml" />
	  <include name="plugin.properties" />
	  <include name="icons/**"/>
	</fileset>
	<fileset dir="bin" />
	<fileset file="${tempdir}/src.zip" />
</jar>
Comment 12 Konrad Kolosowski CLA 2005-04-18 10:02:26 EDT
That generated a manifest with wrapped lines, which was still correct and run 
without problems for me.
Dirk, are you sure the plug-in did not run due to the wrapped lines?
Comment 13 Dani Megert CLA 2005-04-19 03:12:05 EDT
Yes. I saw this too. For some manifest files it actually worked when wrapped but
for some it did not. Dirk, can you remember which project contained that manifest?
Comment 14 Dirk Baeumer CLA 2005-04-19 04:34:13 EDT
I thought it was ltk.ui, but I am not 100% sure. When I encountered this I jar'd
ltk.core and jdt.ui as well. So it might have been one of these plug-ins.
Comment 15 Wassim Melhem CLA 2005-05-17 17:32:07 EDT
closing...
Comment 16 Dirk Baeumer CLA 2005-05-17 18:10:06 EDT
Wassim, I still think that this is a real issue since others might get tricked
as well. I don't think it is critical for 3.1 but simply closing it as works for
me is strange. Then close it as won't fix ;-).
Comment 17 Wassim Melhem CLA 2005-05-17 18:14:28 EDT
it's not that there was a problem that we didn't fix or we are denying that it 
exists.  No proof (attachment) was ever presented that the plugins did not 
work because the manifest.mf was mangled due to line lengths. 

When we tried to reproduce it, the lines were wrapped but the manifest.mf was 
still valid and hence the resolution is appropriate.
Comment 18 Wassim Melhem CLA 2005-05-17 18:16:45 EDT
oh, but if you are referring to the "Eclipse doesn't honor Manifest.mf line 
length specification".  Then absolutely, this is a WONTFIX.