Skip to content

Commit

Permalink
Not all ELF files are for Linux.
Browse files Browse the repository at this point in the history
This stops tagging all ELF files as 'runnable:linux' and instead
sets attempts to determine the most appropriate 'platform' and uses
'elf' as the extension.
  • Loading branch information
jasperla committed Jan 20, 2023
1 parent 821437d commit 1703640
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion karton/classifier/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,22 @@ def zip_has_file(path: str) -> bool:
return sample_class

# Is ELF file?
elf_assoc = {
"linux": "(GNU/Linux)",
"freebsd": "(FreeBSD)",
"netbsd": "(NetBSD)",
"solaris": "(Solaris)",
"openbsd": "(SYSV)",
}
if magic.startswith("ELF"):
sample_class.update({"kind": "runnable", "platform": "linux"})
for platform, platform_full in elf_assoc.items():
if platform_full in magic:
sample_class.update(
{"kind": "runnable", "platform": platform, "extension": "elf"}
)
return sample_class

sample_class.update({"kind": "runnable", "extension": "elf"})
return sample_class

# Is PKG file?
Expand Down

0 comments on commit 1703640

Please sign in to comment.