Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove JAR magic entry #540

Open
wasabii opened this issue Jun 20, 2024 · 0 comments
Open

Remove JAR magic entry #540

wasabii opened this issue Jun 20, 2024 · 0 comments

Comments

@wasabii
Copy link
Contributor

wasabii commented Jun 20, 2024

IKVM currently handles a magic entry in JAR files named --ikvm-classes--/. Upon seeing this in a ZIP, the classes mentioned in the files are are inserted into the ZIP file as stubs. This is used, as far as I can tell, in one place: resources.jar.

Resources.jar is embedded into the IKVM assembly to hold the original resources. The --ikvm-classes-- entry causes this embedded JAR to appear to hold the .class entries as well. Side by side with the actual resources. So classes can be loaded as resources. This check happens before the VFS link is returned during FindResources.

I think this might predate the VFS, though I'm not completely sure. The VFS itself holds .class stub entries generated on the fly, and FindResources already returns references to those if they are missing from the original resources file.

This seems like two paths to the same thing. But, the magic ZIP entry is harder: it requires a pretty sever local fork of the ZipFile class to insert these magic entries. I think if we remove them, we'd be fine. Lookup would fall back to the VFS and work fine.

Alternatively, we can circumvent the VFS for this completely by returning ikvmres URLs. That's probably the better long term plan. I can't imagine this not working, since embedded resources in a JAR already requires that all user code does not touch these files by hand.

wasabii added a commit that referenced this issue Jun 20, 2024
…ce these magic entries.

Do not emit such entry.
fixes #540
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant