From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?G=C3=A1bor_Boskovits?= Subject: Re: broken references in jar manifests Date: Thu, 1 Mar 2018 19:32:14 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114c9d882e09fe05665e1446" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erT06-00009p-EL for guix-devel@gnu.org; Thu, 01 Mar 2018 13:32:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erT04-00060t-S2 for guix-devel@gnu.org; Thu, 01 Mar 2018 13:32:18 -0500 Received: from mail-io0-x233.google.com ([2607:f8b0:4001:c06::233]:36550) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1erT04-0005zn-Lo for guix-devel@gnu.org; Thu, 01 Mar 2018 13:32:16 -0500 Received: by mail-io0-x233.google.com with SMTP id e30so8136850ioc.3 for ; Thu, 01 Mar 2018 10:32:15 -0800 (PST) In-Reply-To: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: Guix-devel --001a114c9d882e09fe05665e1446 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2018-03-01 18:11 GMT+01:00 Ricardo Wurmus : > Hi Guix, > > we have a problem with jar manifests. When we use the Class-Path > property to ensure that an executable can find its dependencies on the > class path at run-time, we end up with a manifest like this: > > --8<---------------cut here---------------start------------->8--- > Manifest-Version: 1.0 > Class-Path: /gnu/store/i28vi94r8z9f0x02zgkrv87w16ibmqkw-java-htsjdk-2. > 10.1/share/java/htsjdk.jar > Created-By: 1.8.0_151 (Oracle Corporation) > Main-Class: picard.cmdline.PicardCommandLine > --8<---------------cut here---------------end--------------->8--- > > Note that the Class-Path property is broken into two lines. This means > that the reference scanner will miss it and grafting will fail. > > Could we modify the reference scanner to find these lines? Would there be any serious drawback to that? > Breaking up lines longer than 70 characters is according to the manifest > specification, see > https://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html > > We cannot just use a wrapper that sets CLASSPATH, because it appears to > be ignored when using a manifest with =E2=80=9CMain-Class=E2=80=9D. =E2= =80=9CMain-Class=E2=80=9D is > required for executables that can be run like this: > > java -jar whatever.jar > > A possible work-around might be to patch the class loader of our JDKs to > look at a custom Guix-specific file, which we will include in each jar. > That file would be allowed to have longer lines. > > There are two disadvantages: > > 1) we need to patch the JDK > 2) the jars would not do the right thing when executed with a different > JDK (e.g. on a foreign distro). > > What do you think? > > -- > Ricardo > > --001a114c9d882e09fe05665e1446 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
2018= -03-01 18:11 GMT+01:00 Ricardo Wurmus <ricardo.wurmus@mdc-berli= n.de>:
Hi Guix,

we have a problem with jar manifests.=C2=A0 When we use the Class-Path
property to ensure that an executable can find its dependencies on the
class path at run-time, we end up with a manifest like this:

--8<---------------cut here---------------start------------->8--= -
Manifest-Version: 1.0
Class-Path: /gnu/store/i28vi94r8z9f0x02zgkrv87w16ibmqkw-java-htsj= dk-2.
=C2=A010.1/share/java/htsjdk.jar
Created-By: 1.8.0_151 (Oracle Corporation)
Main-Class: picard.cmdline.PicardCommandLine
--8<---------------cut here---------------end--------------->8--= -

Note that the Class-Path property is broken into two lines.=C2=A0 This mean= s
that the reference scanner will miss it and grafting will fail.


Could we modify the reference scanner = to find these lines?
Would there be any serious drawback to that?=
=C2=A0
Breaking up lines longer than 70 characters is according to the manifest specification, see
https://docs.oracle.com/java= se/7/docs/technotes/guides/jar/jar.html

We cannot just use a wrapper that sets CLASSPATH, because it appears to
be ignored when using a manifest with =E2=80=9CMain-Class=E2=80=9D.=C2=A0 = =E2=80=9CMain-Class=E2=80=9D is
required for executables that can be run like this:

=C2=A0 =C2=A0 java -jar whatever.jar

A possible work-around might be to patch the class loader of our JDKs to look at a custom Guix-specific file, which we will include in each jar.
That file would be allowed to have longer lines.

There are two disadvantages:

1) we need to patch the JDK
2) the jars would not do the right thing when executed with a different
JDK (e.g. on a foreign distro).

What do you think?

--
Ricardo


--001a114c9d882e09fe05665e1446--