Skip to content

[TIKA-4309] Mach-O Universal in tika-mimetypes.xml - #1963

Merged
tballison merged 1 commit into
apache:mainfrom
alexey-pelykh:feature/TIKA-4309-MachO-Universal
Sep 23, 2024
Merged

tballison merged 1 commit into
apache:mainfrom
alexey-pelykh:feature/TIKA-4309-MachO-Universal

Conversation

@alexey-pelykh

Copy link
Copy Markdown
Contributor

A follow-up to #1947 & #1961 & #1962: Mach-O universal + optimized Mach-O

cc @tballison

@alexey-pelykh
alexey-pelykh force-pushed the feature/TIKA-4309-MachO-Universal branch from 2f90c82 to 00db3a6 Compare September 21, 2024 21:38
@tballison

Copy link
Copy Markdown
Contributor

@Gagravarr if you have any time to review this. If there's a way to simplify the various mach-o types, that'd be great. Also, any input on the choices for mime type names.

For 3.x, we'll still have some time to modify this.

@alexey-pelykh
alexey-pelykh force-pushed the feature/TIKA-4309-MachO-Universal branch from 00db3a6 to 5845556 Compare September 23, 2024 13:33
@alexey-pelykh

alexey-pelykh commented Sep 23, 2024

Copy link
Copy Markdown
Contributor Author

Probably I'm testing in a wrong way locally as I didn't see a failing test on my side

Figured it out, mvn clean test install instead of mvn clean test :) Should've seen that coming

@alexey-pelykh
alexey-pelykh force-pushed the feature/TIKA-4309-MachO-Universal branch from 5845556 to 44d9824 Compare September 23, 2024 14:22
@alexey-pelykh

Copy link
Copy Markdown
Contributor Author

Updated to make it a non-breaking change

@alexey-pelykh
alexey-pelykh force-pushed the feature/TIKA-4309-MachO-Universal branch 3 times, most recently from 4d75dcc to b934e75 Compare September 23, 2024 14:31
@tballison

Copy link
Copy Markdown
Contributor

Aren't the magic bits at 4096 important for jnilib? Or what is the difference between what we were detecting as x-java-jnilib and mach-O and its variants?

  <mime-type type="application/x-java-jnilib">
    <_comment>Java Native Library for OSX</_comment>
    <magic priority="50">
      <match value="0xcafebabe" type="string" offset="0">
        <match value="0xfeedface" type="string" offset="4096"/>
        <match value="0xfeedfacf" type="string" offset="4096"/>
        <match value="0xcefaedfe" type="string" offset="4096"/>
        <match value="0xcffaedfe" type="string" offset="4096"/>
      </match>
    </magic>
    <glob pattern="*.jnilib"/>
  </mime-type>

@alexey-pelykh
alexey-pelykh force-pushed the feature/TIKA-4309-MachO-Universal branch from b934e75 to eebdd8a Compare September 23, 2024 14:31
@alexey-pelykh

Copy link
Copy Markdown
Contributor Author

Aren't the magic bits at 4096 important for jnilib? Or what is the difference between what we were detecting as x-java-jnilib and mach-O and its variants?

Yes and no. There's no guarantee they are at 4096 offset, that's empiric - at least based on what I know as of now. The offset should be read from the file itself - that's why I've asked about dynamic offset. An top of that, we should check that it's a library, not that it's a Mach-O, so technically those checks aren't ideal either.

So far we're mimicking the file behavior that was also used by this:

This might be useful: https://github.com/gabriel-vasile/mimetype/pull/53/files#diff-db84ad344d2bf91ea9533dbaa5974e81940b053644665471594fb2eedd34e7daR19 ?

@alexey-pelykh

alexey-pelykh commented Sep 23, 2024

Copy link
Copy Markdown
Contributor Author

With that said, there's no explicit difference (known to me) between a regular universal Mach-O shared library and a JNI one, except for that extension.

@tballison

Copy link
Copy Markdown
Contributor

K, that's what I was trying to figure out -- the diff between what we were calling a jnilib (https://issues.apache.org/jira/browse/TIKA-1169 for the original work on jnilib) and mach-o

@tballison
tballison merged commit 33934f8 into apache:main Sep 23, 2024
@alexey-pelykh
alexey-pelykh deleted the feature/TIKA-4309-MachO-Universal branch September 23, 2024 15:29
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

Successfully merging this pull request may close these issues.

2 participants