<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 2017-10-02 19:24, Philipp Kunz
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:9a4edee0-4edd-caaa-9970-61df083d39df@paratix.ch">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
Hi,<br>
<br>
While fixing JDK-6695402 I came across other related bugs to
manifests such as JDK-6372077, JDK-6202130, JDK-8176843,
JDK-4842483, and JDK-6443578 which all relate to manifest reading
and writing. Somewhere bug 7071055 is mentioned but I cannot find
anywhere. </blockquote>
<br>
You cannot find JDK-7071055 since it's classified Confidential. I'm
not sure why, but it has been closed as a duplicate of JDK-6695402,
so it does not really matter.<br>
<br>
I'm happy to see we've gotten such a thorough contributor! :-) Keep
up the good work.<br>
<br>
/Magnus<br>
<br>
<br>
<blockquote type="cite"
cite="mid:9a4edee0-4edd-caaa-9970-61df083d39df@paratix.ch">Another
group of bugs, JDK-6910466, JDK-4935610, and JDK-4271239 concern
the mandatory manifest main attributes Manifest-Version or
Signature-Version and at first glance are duplicates. If you know
of more known bugs, not necessarily present in jira, I'd be glad
to get notified.<br>
<br>
There are also some comments about utf handling and line breaking
in the code of Manifest:<br>
<a class="moz-txt-link-freetext"
href="http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l299"
moz-do-not-send="true">http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l299</a><br>
<a class="moz-txt-link-freetext"
href="http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l327"
moz-do-not-send="true">http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l327</a><br>
<a class="moz-txt-link-freetext"
href="http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l370"
moz-do-not-send="true">http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l370</a><br>
<br>
Furthermore, Attributes.map should declare appropriate type
parameters:<br>
<a class="moz-txt-link-freetext"
href="http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l61"
moz-do-not-send="true">http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l61</a><br>
The specification would also require that `header names must not
start with _, - or "From"`
(<a class="moz-txt-link-freetext"
href="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#Section-Specification"
moz-do-not-send="true">http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#Section-Specification</a>)
but I would opt not to add this as a hard restriction because I
guess it can be assumed that such names are in use now after
having been working for years. A warning to a logger might be
conceivable such as in<br>
<a class="moz-txt-link-freetext"
href="http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l424"
moz-do-not-send="true">http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Attributes.java#l424</a><br>
Attribute values are never checked at all and invalid characters
such as line breaks are never detected except that when reading
the manifest again the values are cut off.<br>
The tab character (U+0008) does not work in manifest values.<br>
I suspect that there are also issues regarding the iteration order
but I haven't got a prove yet unlike for the other points above:<br>
<a class="moz-txt-link-freetext"
href="http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Manifest.java#l54"
moz-do-not-send="true">http://hg.openjdk.java.net/jdk10/master/file/a0116bcc65b7/src/java.base/share/classes/java/util/jar/Manifest.java#l54</a><br>
There is duplicated or very similar code in Attributes and
Manifest: Attributes.write-Manifest.write-Attributes.writeMain and
Attributes.read-Manifest.read.<br>
Resolving JDK-6202130 would have the additional benefit to be able
to view manifests with any utf-8 capable editor even if multi-byte
characters break across lines.<br>
<br>
Fixing these issues individually looks like more complicated work
than fixing them all at once, I guess, also because of a very low
current test coverage. So I'd suggest to add some thorough tests
along with fixing these issues. But before I start I would like to
get some guidance, assistance or at least confirmation on how to
proceed. I'm new to open jdk and have submitted only one patch so
far.<br>
<br>
Is it ok to add tests for things that have worked before?<br>
Is it ok to refactor duplicated code just for the added value to
reduce effort for testing?<br>
I assume compatibility to and from existing manifests is the
highest priority, correct? This would also be the hard part in
adding as complete test coverage as possible. What would be
acceptable criteria to meet?<br>
Why does Attributes not extend LinkedHashMap and why does Manifest
not extend HashMap? Any objection?<br>
While I would not want to write code that looks slow or change
more than necessary one can never know before having performance
actually measured. Is there some way this is dealt with or should
I wait for such feedback until after patch submission?<br>
<br>
Would someone sponsor?<br>
<br>
Regards,<br>
Philipp<br>
<br>
<br>
<div class="moz-signature"> <br>
<br>
<hr size="2" width="100%"><br>
<img shrinktofit="true"
src="cid:part8.FB01B6FF.0EAAFEB5@oracle.com" class=""
align="bottom" border="0"><br>
<br>
Paratix GmbH<br>
St Peterhofstatt 11<br>
8001 Zürich<br>
<br>
+41 (0)76 397 79 35<br>
<a href="mailto:philipp.kunz@paratix.ch" moz-do-not-send="true">philipp.kunz@paratix.ch</a>
</div>
</blockquote>
<br>
</body>
</html>