Jar manifest and EOF

Philipp Kunz philipp.kunz at paratix.ch
Fri Oct 11 06:11:24 UTC 2019


Hi,

The Jar File Specification [1] states that,

> If the last character of the file is an EOF character (code 26), the
EOF is treated as whitespace. Two newlines are appended (one for
editors that don't put a newline at the end of the last line, and one
so that the grammar doesn't have to special-case the last entry, which
may not have a blank line after it).

But I can't see that this is actually the case. See the attached simple
test that indicates that this statement is not implemented.

See also potentially remotely related bugs [2] and [3] which both refer
in my opinion to EOF as the end of the byte stream as opposed to the
EOF character 26.

After nobody has fixed this point inside of many years I tend to assume
that it is not at all necessary or useful. However, I cannot understand
the intention behind it or how that statement got there in the first
place and hence might not be aware of the full context.

Considering the activity about the last line of a manifest not
terminated by a line break resulting in that line ignored unexpectedly 
(see [3] through [14]) I doubt that it is promising to attempt to
implement the EOF according to the specs.

Instead I'd rather like to propose to update the specification by
removing the quoted statement.

I'm not sure if the specification [1] has changed since 13 or where the
most up to date one is.

Regards,
Philipp



[1] 
https://docs.oracle.com/en/java/javase/13/docs/specs/jar/jar.html#notes-on-manifest-and-signature-files

EOF-related:
[2] https://bugs.openjdk.java.net/browse/JDK-7148584
[3] https://bugs.openjdk.java.net/browse/JDK-4639129

Last line break required or missing related:
[4] https://bugs.openjdk.java.net/browse/JDK-4274235
[5] https://bugs.openjdk.java.net/browse/JDK-4894998
[6] https://bugs.openjdk.java.net/browse/JDK-4333854
[7] https://bugs.openjdk.java.net/browse/JDK-6594305
[8] 
http://mail.openjdk.java.net/pipermail/core-libs-dev/2019-February/058774.html
[9] https://bugs.openjdk.java.net/browse/JDK-4489716
[10] https://bugs.openjdk.java.net/browse/JDK-4639129
[11] https://bugs.openjdk.java.net/browse/JDK-4625822
[12] 
https://stackoverflow.com/questions/21859417/header-must-be-terminated-by-a-line-break-eclipse-manifest-mf
[13] https://bugs.eclipse.org/bugs/show_bug.cgi?id=377249
[14] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4274235

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20191011-manifest-eof.patch
Type: text/x-patch
Size: 1994 bytes
Desc: not available
URL: <https://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20191011/fad01cb0/20191011-manifest-eof.patch>


More information about the core-libs-dev mailing list