ZipEntry

Lance Andersen lance.andersen at oracle.com
Tue Dec 12 21:52:54 UTC 2023


Please refer to JDK-8250968<https://bugs.openjdk.org/browse/JDK-8250968> which why the field in question was added.  If you are interested in additional support,  you can open an enhancement request for consideration.

Best
Lance

On Dec 12, 2023, at 4:15 PM, Alan Snyder <javalists at cbfiddle.com<mailto:javalists at cbfiddle.com>> wrote:



On Dec 12, 2023, at 12:57 PM, Eirik Bjørsnøs <eirbjo at gmail.com<mailto:eirbjo at gmail.com>> wrote:

Alan,

ZipOutputStream is a relatively high-level API for producing ZIP files. There are many shapes and corner cases allowed by APPNOTE.TXT which ZipOutputStream has no means to produce. So while exposing the "external file attributes" field (which was incorrectly named "extraAttributes" in ZipEntry) is perhaps not harmful in itself, the question is: Where do we stop?


Right now, I’m more interested in reading zip files, but to answer your question: we can stop at any point.


It's worth noting that the ZipFileSystem API has the "enablePosixFileAttributes" env option which lets you set POSIX permissions on ZIP file entries using Files.setPosixFilePermissions()


I’m more interested in the symlink bit, and do not currently have any need to use ZipFileSystem.

I’m wondering, though, why it is OK to access information via ZipFileSystem and not directly via ZipEntry?



The following OpenJDK test can serve as an example:

https://github.com/openjdk/jdk/blob/master/test/jdk/sun/security/tools/jarsigner/PosixPermissionsTest.java#L151

Cheers,
Eirik,

On Tue, Dec 12, 2023 at 9:17 PM Alan Snyder <javalists at cbfiddle.com<mailto:javalists at cbfiddle.com>> wrote:
ZipEntry is a public class and I am aware that it is used outside the JDK. Presumably that is not a problem.

I’m wondering why the class stores the external file attributes field but does not provide public accessors for it.

I would find it useful to have access to this field. I would rather not have to switch to using a third party library just for this reason.

I understand that the interpretation of the external file attributes is not standardized, but the field itself is defined in the standard
cited by the package info page, so I don’t see the harm in making it accessible without interpretation.

  Alan

[cid:E1C4E2F0-ECD0-4C9D-ADB4-B16CA7BCB7FC at home]






Lance Andersen | Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com<mailto:Lance.Andersen at oracle.com>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20231212/6cb849a0/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oracle_sig_logo.gif
Type: image/gif
Size: 658 bytes
Desc: oracle_sig_logo.gif
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20231212/6cb849a0/oracle_sig_logo-0001.gif>


More information about the core-libs-dev mailing list