dk packages /

CommonsBase_FileMagic 0.1.20260723064047

The OpenBSD `file`(1) content-type identifier, built for every dk ABI as a single self-contained executable with the magic database compiled in.

Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND LicenseRef-FileMagic Source → Generated

The OpenBSD file(1) content-type identifier, built for every dk ABI as a single self-contained executable with the magic database compiled in.

CommonsBase_FileMagic repackages the OpenBSD 7.8 file(1)/libmagic sources and overlays selected upstream file/file FILE5_47 magic entries, adding Diskuv-authored compatibility shims so the tool builds and runs identically across the macOS, Linux, and Windows ABIs. Every ABI produces one self-contained bin/file with the magic database compiled directly into the executable.

Usage

OpenBSD file(1)

The file utility tests each argument and attempts to determine its type. Three sets of tests are performed:

1. Filesystem tests, for example if a file is empty, or a special file such as a socket or named pipe (FIFO).
2. “Magic” tests for data in particular fixed formats. These are loaded from the /etc/magic file (or ~/.magic instead if it exists and file is not running as root). The file format is described in magic(5).
3. Tests for text files such as plain ASCII or C programming language files.

The first test which succeeds causes the file type to be printed. The type will often contain one of the words text (contains only printing characters and is probably safe to read on an ASCII terminal), executable (the file contains a compiled executable program) or data meaning anything else.

The object is bin/file.exe compiled for the ABI.

  $ get-object CommonsBase_FileMagic.File@7.8.50407 -s Release.target_abi -d ${RUNTIME}/File-7.8.50407
  \test(pass)
  \dk.object(abi: "Release.Darwin_arm64", value-id: "orw5ufcbtpfhoolmn3edctuks5slcu6mpsekz4ju5iv2zviwpspjq")
  \dk.object(abi: "Release.Darwin_x86_64", value-id: "ojnr3jm3fxbo5xj3nkita2kbymekuj2zjmmsdncpupwvvk6wdizsa")
  \dk.object(abi: "Release.Linux_arm64", value-id: "o5avhm2mcs3q527pe3vv5yownl2orfxu7ak3bpy7kvjve5iwpr6gq")
  \dk.object(abi: "Release.Linux_x86", value-id: "oszw7iqompkbdpr46nmd2mtefnnej4bdwqezpzpalqvgr232jyizq")
  \dk.object(abi: "Release.Linux_x86_64", value-id: "oye5vhgtd74nhaml2opt5nxz67oypdq3g34rjtpe4tmhnhncqbjwa")
  \dk.object(abi: "Release.Windows_arm64", value-id: "ov4aynftw2g2st7xt3qvoxtmjgc7gndpytgdixr4srctzx75izkmq")
  \dk.object(abi: "Release.Windows_x86", value-id: "ogfs7l4ljjrzdomjs6dgmgfal4mrzeo4tbeyrdjaitb6bxd2v5vza")
  \dk.object(abi: "Release.Windows_x86_64", value-id: "oteegaquqsej3mxqqnnanbgg7mocda64itjjdcq4tswv4jrr5oaiq")\;

Running bin/file.exe on itself (the bin/file.exe) will tell us what CPU architecture and operating system
the executable was compiled for.

  $ run-object CommonsBase_FileMagic.File@7.8.50407 -s Release.execution_abi -m ./bin/file.exe -e bin/file.exe --
  >   -b $(get-object CommonsBase_FileMagic.File@7.8.50407 -s Release.target_abi -d : -e file.exe)/bin/file.exe
  \test(pass)
  \dk.target(abi: "Darwin_arm64")[Mach-O 64-bit executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>
  ]
  \dk.target(abi: "Darwin_x86_64")[Mach-O 64-bit executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>
  ]
  \dk.target(abi: "Linux_arm64")[ELF 64-bit LSB executable, aarch64, version 1
  ]
  \dk.target(abi: "Linux_x86")[ELF 32-bit LSB executable, Intel i386, version 1 (SYSV)
  ]
  \dk.target(abi: "Linux_x86_64")[ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux)
  ]
  \dk.target(abi: "Windows_arm64")[PE32+ executable for MS Windows 6.00 (console),, 13 sections
  ]
  \dk.target(abi: "Windows_x86")[PE32 executable for MS Windows 6.00 (console),, 15 sections
  ]
  \dk.target(abi: "Windows_x86_64")[PE32+ executable for MS Windows 6.00 (console),, 14 sections
  ]\;

Provides

ModuleVersionPlatformvalue-id
CommonsBase_FileMagic.File 7.8.50407 Darwin_arm64 orw5ufcbtpfh…
CommonsBase_FileMagic.File 7.8.50407 Darwin_x86_64 ojnr3jm3fxbo…
CommonsBase_FileMagic.File 7.8.50407 Linux_arm64 o5avhm2mcs3q…
CommonsBase_FileMagic.File 7.8.50407 Linux_x86 oszw7iqompkb…
CommonsBase_FileMagic.File 7.8.50407 Linux_x86_64 oye5vhgtd74n…
CommonsBase_FileMagic.File 7.8.50407 Windows_arm64 ov4aynftw2g2…
CommonsBase_FileMagic.File 7.8.50407 Windows_x86 ogfs7l4ljjrz…
CommonsBase_FileMagic.File 7.8.50407 Windows_x86_64 oteegaquqsej…

Workspace assets

Files and directories in the package repo, bundled into the build.

AssetProject pathType
CompatHeader assets/compat/include/filemagic_compat.h file
CompatErr assets/compat/include/err.h file
CompatRegex assets/compat/include/regex.h file
CompatCdefs assets/compat/include/sys/cdefs.h file
CompatQueue assets/compat/include/sys/queue.h file
CompatTree assets/compat/include/sys/tree.h file
CompatNull assets/compat/include/sys/_null.h file
CompatVisHeader assets/compat/include/vis.h file
CompatSource assets/compat/src/filemagic_compat.c file
CompatRegexSource assets/compat/src/regex_compat.cpp file
CompatVisSource assets/compat/src/vis.c file
PortableMain assets/src/filemagic_portable_main.c file
PortableXmalloc assets/src/filemagic_portable_xmalloc.c file
MagicHeader assets/src/filemagic_magic.h file
MagicTestSource assets/src/filemagic_magic_test.c file
EmbeddedMagicHeader assets/src/filemagic_embedded_magic.h file
EmbeddedMagicSource assets/src/filemagic_embedded_magic.c file

Downloaded assets

Third-party sources fetched and checksum-verified during the build.

AssetSizesha256Source
src.tar.gz 212.5 MB 1f20cc61f3b5bc9b… https://ftp.OpenBSD.org/pub/OpenBSD/7.8/src.tar.gzhttps://mirror.aarnet.edu.au/pub/OpenBSD/7.8/src.tar.gzhttps://ftp.fr.openbsd.org/pub/OpenBSD/7.8/src.tar.gzhttps://ftp.fau.de/pub/OpenBSD/7.8/src.tar.gzhttps://ftp.jaist.ac.jp/pub/OpenBSD/7.8/src.tar.gzhttps://mirror.freedif.org/pub/OpenBSD/7.8/src.tar.gzhttps://ftp.nluug.nl/pub/OpenBSD/7.8/src.tar.gzhttps://mirror.ox.ac.uk/pub/OpenBSD/7.8/src.tar.gzhttps://mirrors.ocf.berkeley.edu/pub/OpenBSD/7.8/src.tar.gzhttps://openbsd.c3sl.ufpr.br/pub/OpenBSD/7.8/src.tar.gz

Dependencies

PackageVersionsha256
CommonsBase_LLVM 0.1.20260723061853 bc04736f7a5897fa…
CommonsBase_Std 2.6.20260723055125 972d2bf05f2a3697…

Producer signing key

Releases of this package are signed with this OpenBSD signify key. After you import the package, dk1 trust list prints the same public key and fingerprint; compare them here to confirm you are trusting the intended publisher over a channel independent of the download.

Fingerprint 1fa672bdf123a65c
Public key RWQfpnK98SOmXMjE8HjH44kw6lqC0aZ6D0nJp27C82PH/l+YxgrQGIaA

Named licenses

Plaintext for each LicenseRef-* in the SPDX expression above.

LicenseRef-FileMagic
Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.
Software written by Ian F. Darwin and others;
maintained 1994- Christos Zoulas.

This software is not subject to any export provision of the United States
Department of Commerce, and may be exported to any country or planet.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice immediately at the beginning of the file, without modification,
   this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.