christian-schlichtherle/truevfs

Posix file permissions with ZIP driver?

Opened this issue · 4 comments

The ZIP driver does not appear to capture any POSIX file permissions. The documentation says "best effort" and I'm aware there is an open ticket for this (https://bugs.openjdk.java.net/browse/JDK-6194856) when using standard Zip capabilities in JDK. However, I'm not sure if TrueVFS is using the JDK ZIP tools or not.

If I assume you're using Apache Commons Compress (a dependency) there does appear to be support for the "Extra Fields". I'm not sure if this is where external attributes are stored or not, but this is how Linux and Mac store permissions data inside a ZIP:

https://apple.stackexchange.com/questions/329474/how-does-macos-store-unix-file-permissions-in-zip-files

Apache Commons Compress does support external links, though it could be that you're using ZipArchiveInputStream instead of ZipFile. The documentation for ZipArchiveInputStream indicates that external attributes are not preserved.

I just noticed in truevfs-comp-zip documentation that you specifically indicate that External File Attributes are supported. However, this does not appear to work when using TFile#cp_rp.

I'm sorry for the very late response, notifications were accidentally shut off.

TrueVFS generally doesn't support handling file permissions.
This is simply because of the complexity and thus, the effort required to implement this properly.
Even the semantics are not quite clear:
Consider the following case:
TrueVFS is a virtual file system.
So then, if permissions were supported, they should also have to be respected when accessing archive entries, right?
But then, if the "Read" bit is cleared on an archive entry, a regular (non-super) user should not even be allowed to read that entry in the archive file, which would make the archive file itself unusable (assuming the same permissions for all entries).
This is just a simple example, but my point is that the combination of permissions and use cases is too much to bear for me in this free-time project.
After all, TrueVFS is still a one-man project.
I hope you understand.
That being sad, contributions are welcome.