[CAUTION] [jdk11u] RFR: 8229888: (zipfs) Updating an existing zip file does not preserve original permissions

Langer, Christoph christoph.langer at sap.com
Tue Mar 3 12:47:27 UTC 2020


Hi Matthias,

I think I was too quick... it should be:

FileSystems.newFileSystem(new URI("jar", zipFile.toUri().toString(), null), env)

You'll also have to change throws IOException to throws Exception for the zip method, since new URI throws URISyntaxException.

Best regards
Christoph


> -----Original Message-----
> From: Baesken, Matthias <matthias.baesken at sap.com>
> Sent: Dienstag, 3. März 2020 11:06
> To: Langer, Christoph <christoph.langer at sap.com>; jdk-updates-
> dev at openjdk.java.net
> Subject: RE: [CAUTION] [jdk11u] RFR: 8229888: (zipfs) Updating an existing
> zip file does not preserve original permissions
> 
> 
> Hi Christoph ,
> 
> > , I suggest you use zipFile.toUri() as was done in this backport
> > already: http://hg.openjdk.java.net/jdk-
> updates/jdk11u/rev/f8b2e95a1d41.
> 
> Doing this leads to :
> 
> java.lang.IllegalArgumentException: Path component should be '/'
> 	at
> java.base/sun.nio.fs.UnixFileSystemProvider.checkUri(UnixFileSystemProvid
> er.java:82)
> 	at
> java.base/sun.nio.fs.UnixFileSystemProvider.newFileSystem(UnixFileSystem
> Provider.java:91)
> 	at
> java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:337)
> 	at
> java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:286)
> 	at ZipFSPermissionsTest.zip(ZipFSPermissionsTest.java:199)
> 	at ZipFSPermissionsTest.before(ZipFSPermissionsTest.java:90)
> 
> 
> Best regards, Matthias
> 
> >
> > Hi Matthias,
> >
> > I think you need to add "permission java.lang.RuntimePermission
> > "accessUserInformation";" to
> src/java.base/share/lib/security/default.policy,
> > grant codeBase "jrt:/jdk.zipfs". That was originally introduced by JDK-
> > 8213031: http://hg.openjdk.java.net/jdk/jdk/rev/bf325b739c8a. We see 3
> > test failures with your current patch which should hopefully be resolved by
> > that.
> >
> > As for refactoring regarding the missing
> > java.nio.file.FileSystems.newFileSystem(Path path, Map<String,?> env)
> API
> > in JDK11, I suggest you use zipFile.toUri() as was done in this backport
> > already: http://hg.openjdk.java.net/jdk-
> updates/jdk11u/rev/f8b2e95a1d41.
> > That way you'll avoid the need for the helper method " public static
> > FileSystem newFileSystem(Path path, Map<String,?> env)" that you
> > introduced in ZipFSPermissionsTest.
> >
> > Best regards
> > Christoph
> >
> >
> > > -----Original Message-----
> > > From: jdk-updates-dev <jdk-updates-dev-bounces at openjdk.java.net>
> On
> > > Behalf Of Baesken, Matthias
> > > Sent: Freitag, 28. Februar 2020 09:53
> > > To: jdk-updates-dev at openjdk.java.net
> > > Subject: [CAUTION] [jdk11u] RFR: 8229888: (zipfs) Updating an existing
> zip
> > > file does not preserve original permissions
> > >
> > > Hello, please  review the downport of
> > > 8229888: (zipfs) Updating an existing zip file does not preserve original
> > > permissions
> > >
> > > to jdk11u. The change is in 11.0.7-oracle so it would be good to have it in
> > > OpenJDK 11 as well.
> > >
> > > The change touches
> > > src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java  and test
> > related
> > > files.
> > > I had to add imports to ZipFileSystem.java, and had to adjust the test file
> > > test/jdk/jdk/nio/zipfs/ZipFSPermissionsTest.java
> > > because jdk11   misses  java.nio.file.FileSystems.newFileSystem(Path
> path,
> > > Map<String,?> env) .
> > >
> > >
> > > bug :
> > > https://bugs.openjdk.java.net/browse/JDK-8229888
> > >
> > >
> > > original jdk/jdk change :
> > > https://hg.openjdk.java.net/jdk/jdk/rev/798c0903fcd0
> > >
> > >
> > > adjusted jdk11u change :
> > > http://cr.openjdk.java.net/~mbaesken/webrevs/8229888_0_jdk11/
> > >
> > >
> > > Thanks, Matthias


More information about the jdk-updates-dev mailing list