Bug 1151442 - Missing Premain-Class attribute in 0.7 (f21 and higher) in org.jacoco.agent.rt.jar
Summary: Missing Premain-Class attribute in 0.7 (f21 and higher) in org.jacoco.agent.r...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: jacoco
Version: 21
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: ---
Assignee: jiri vanek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-10 12:19 UTC by jiri vanek
Modified: 2014-12-18 06:10 UTC (History)
2 users (show)

Fixed In Version: jacoco-0.7.2-2.fc21
Clone Of:
Environment:
Last Closed: 2014-12-18 06:10:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description jiri vanek 2014-10-10 12:19:21 UTC
Description of problem:
org.jacoco.agent.rt.jar have missing Premain-Class attribute in manifest
line "Premain-Class org.jacoco.agent.rt.internal.PreMain" is misisng in 0.7.2 which is available (finally! ty!) in f21

Without this line the agent do not work at all. Adding this line to your jar, is making jacoco working again.

Version-Release number of selected component (if applicable):
0.7.2

How reproducible:
always

Steps to Reproduce:
1. run any commandline codecoverage - it do not start
or
1. check /usr/share/java/jacoco/org.jacoco.agent.rt.jar/META_INF/MANIFEST.MF  and see the line missing

On f20 and older i have custom builds of jacoco, so I can not ferify if it is regression.

Please note, fedroa guidelines acording to Main-Class do not affect Premain-CLass

Comment 1 Alexander Kurtakov 2014-10-10 13:04:55 UTC
I have a bunch of trips for the rest of the month so would not be able to look into it before November. Let me know if you want to fix it yourself, request commit rights in pkgdb and I'll approve it, otherwise you would have to wait few weeks.

Comment 2 jiri vanek 2014-10-10 14:01:40 UTC
Once I submit the bug, and see who is maintainer, I realized my error in bugging it :))

Is one line post-build jar modification ok for you? If so, I will fix it for you in asap.

Comment 3 jiri vanek 2014-10-10 14:16:55 UTC
Just to be clear
to the end of the build, 
jar -umf X  %{jacoco_dir}/org.jacoco.agent.rt.jar 

where X is file with three lines:
Manifest-Version: 1.0
Premain-Class: org.jacoco.agent.rt.internal.PreMai

EOF

Comment 4 jiri vanek 2014-10-10 14:17:46 UTC
*Premain-Class: org.jacoco.agent.rt.internal.PreMain

Comment 5 Alexander Kurtakov 2014-10-10 15:00:14 UTC
(In reply to jiri vanek from comment #3)
> Just to be clear
> to the end of the build, 
> jar -umf X  %{jacoco_dir}/org.jacoco.agent.rt.jar 
> 
> where X is file with three lines:
> Manifest-Version: 1.0
> Premain-Class: org.jacoco.agent.rt.internal.PreMai
> 
> EOF

Not ideal fix but feel free to do it that way together with TODO comment to inspect why it's not done by the build.

Comment 6 jiri vanek 2014-10-11 10:44:05 UTC
Here we go: https://jvanek.fedorapeople.org/jacoco-premain/
I have asked for push access. If you grant, I will build and push updates. Otherwise feel free to act:

diff --git a/EnchancedManifest.mf b/EnchancedManifest.mf
new file mode 100644
index 0000000..fb315f3
--- /dev/null
+++ b/EnchancedManifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Premain-Class: org.jacoco.agent.rt.internal.PreMain
+
diff --git a/jacoco.spec b/jacoco.spec
index 3d99faa..7d40ac2 100644
--- a/jacoco.spec
+++ b/jacoco.spec
@@ -2,12 +2,13 @@
 
 Name:      jacoco
 Version:   0.7.2
-Release:   1%{?dist}
+Release:   2%{?dist}
 Summary:   Java Code Coverage for Eclipse 
 Group:     System Environment/Libraries
 License:   EPL
 URL:       http://www.eclemma.org/jacoco/
 Source0:   https://github.com/jacoco/jacoco/archive/v%{version}.tar.gz
+Source1:   EnchancedManifest.mf
 
 Patch0:    removeUselessBuildParts.patch
 
@@ -70,6 +71,14 @@ A Jacoco plugin for maven.
 
 dos2unix org.jacoco.doc/docroot/doc/.resources/doc.css 
 
+# workaround missing premain in agent.rt RH1151442. Not sure where to fix this in build.
+# TODO, fix in build itself
+# all have already premain, sources don't need.
+a=`find org.jacoco.agent.rt/target/ | grep jar | grep -v -e sources -e all`
+for x in $a ; do
+jar -umf %{SOURCE1}  $x
+done;
+
 %install
 %mvn_install
 
@@ -88,6 +97,10 @@ echo %{name} %{name}/org.jacoco.ant > %{buildroot}%{_sysconfdir}/ant.d/%{name}
 %files javadoc -f .mfiles-javadoc
 
 %changelog
+* Sat Oct 11 2014 Jiri Vanek <jvanek> 0.7.2-2
+- added premain-class to agen.rt.jar
+- RH1151442
+
 * Mon Sep 15 2014 Alexander Kurtakov <akurtako> 0.7.2-1
 - Update to upstream 0.7.2.

Comment 7 Fedora Update System 2014-10-13 13:00:47 UTC
jacoco-0.7.2-2.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/jacoco-0.7.2-2.fc21

Comment 8 Fedora Update System 2014-10-14 04:36:14 UTC
Package jacoco-0.7.2-2.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing jacoco-0.7.2-2.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-12776/jacoco-0.7.2-2.fc21
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2014-12-18 06:10:09 UTC
jacoco-0.7.2-2.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.