ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 22967] New: - <jar> permits duplicated manifest attributes in violation of the manifest specification
Date Sun, 07 Sep 2003 14:44:06 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22967>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22967

<jar> permits duplicated manifest attributes in violation of the manifest specification

           Summary: <jar> permits duplicated manifest attributes in
                    violation of the manifest specification
           Product: Ant
           Version: 1.5.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jglick@netbeans.org


The situation here is a little confused because bug #10063 reports the
*opposite* as a bug (which IMHO it is not).

In Ant 1.4.1 the following script:

<project default="x">
<target name="x">
<jar jarfile="foo.jar" manifest="foo.mf" includes="somefile..." basedir="."/>
</target>
</project>

with the manifest:

---%<---
Manifest-Version: 1.0
Class-Path: a.jar
Class-Path: b.jar

---%<---

fails:

Manifest is invalid: The attribute "Class-Path" may not occur more than once in
the same section

This behavior is IMHO correct, according to the published manifest specification:

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

which states in the section "Notes on Manifest and Signature Files" quite
explicitly:

"Attribute names cannot be repeated within a section."

And in fact in JDK 1.4.2 the jar tool does accept the above manifest, but with a
printed warning to console, and only the second attr (b.jar) is used:

Sep 7, 2003 10:16:30 AM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path

However in Ant 1.5.x, the manifest is not only accepted, the resulting manifest
placed in foo.jar is syntactically invalid (e.g. running java -jar foo.jar will
print the same warning as above).

Bug #10063 says that

http://java.sun.com/docs/books/tutorial/ext/basics/download.html

claims that you can use multiple Class-Path attributes. This is so, but the
tutorial is simply wrong. It is only a tutorial; it is contradicted by the
normative specification.

Bug #22816 also requests related changes, with the cryptic note

"even though the use of multiple Class-Path: attributes is somewhat obscure
because I need them"

Why? It is specified that you only need one Class-Path attribute and that the
values should be separated by spaces.

IMHO the <jar> and <manifest> tasks should obey the manifest specification
exactly as written. If anyone has some strange need for nonstandard behavior,
they are free to create a manifest as a text file some other way and include it
in a <zip> as an undistinguished META-INF/MANIFEST.MF entry.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message