|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| doc/ | H | - | - | 2,815 | 2,726 |
| m4/ | H | - | - | 9,167 | 8,288 |
| magic/ | H | - | - | 52,457 | 48,818 |
| python/ | H | - | - | 991 | 792 |
| src/ | H | - | - | 24,574 | 19,401 |
| tests/ | H | - | - | 1,795 | 1,526 |
| AUTHORS | H A D | 10-Nov-2019 | 13 | 2 | 1 |
| COPYING | H A D | 10-Nov-2019 | 1.6 KiB | 30 | 26 |
| ChangeLog | H A D | 03-Sep-2026 | 63.6 KiB | 2,221 | 1,318 |
| INSTALL | H A D | 15-May-2012 | 15.2 KiB | 366 | 284 |
| MAINT | H A D | 17-Sep-2009 | 1.5 KiB | 45 | 35 |
| Makefile.am | H A D | 04-Jul-2022 | 354 | 12 | 6 |
| Makefile.in | H A D | 03-Sep-2026 | 28.6 KiB | 913 | 804 |
| NEWS | H A D | 10-Nov-2019 | 15 | 2 | 1 |
| README.DEVELOPER | H A D | 04-Jan-2022 | 918 | 50 | 34 |
| README.md | H A D | 03-Sep-2026 | 7.3 KiB | 162 | 138 |
| RELEASE-PROCEDURE | H A D | 04-Jan-2022 | 1.2 KiB | 30 | 27 |
| TODO | H A D | 20-May-2018 | 2 KiB | 50 | 45 |
| acinclude.m4 | H A D | 10-Sep-2023 | 2.1 KiB | 62 | 55 |
| aclocal.m4 | H A D | 03-Sep-2026 | 48.2 KiB | 1,325 | 1,211 |
| compile | H A D | 03-Sep-2026 | 7.9 KiB | 365 | 269 |
| config.guess | H A D | 10-Sep-2023 | 48.3 KiB | 1,753 | 1,526 |
| config.h.in | H A D | 03-Sep-2026 | 15 KiB | 544 | 401 |
| config.sub | H A D | 03-Jun-2026 | 34.5 KiB | 1,886 | 1,699 |
| configure | H A D | 03-Sep-2026 | 538.4 KiB | 18,934 | 15,869 |
| configure.ac | H A D | 03-Sep-2026 | 9.3 KiB | 300 | 271 |
| depcomp | H A D | 03-Sep-2026 | 23.1 KiB | 793 | 503 |
| install-sh | H A D | 11-Aug-2018 | 6.6 KiB | 302 | 199 |
| libmagic.pc.in | H A D | 10-Sep-2023 | 234 | 12 | 10 |
| ltmain.sh | H A D | 08-Dec-2024 | 325.4 KiB | 11,444 | 8,221 |
| missing | H A D | 03-Sep-2026 | 7.6 KiB | 237 | 162 |
README.DEVELOPER
1# How to get started developing
2
3@(#) $File: README.DEVELOPER,v 1.9 2021/09/20 14:04:39 christos Exp $
4
5## Auto files
6
7After checking out the source, run the following:
8
9 autoreconf -f -i
10 make distclean # this can fail if you have not built before
11 ./configure --disable-silent-rules
12 make -j4
13 make -C tests check
14
15If you see errors, make sure you have the latest libtool and autoconf
16This has been tested with autoconf-2.69 and libtool-2.4.2
17
18## Installing dependencies
19
20If your platform doesn't have the above tools, install the following
21packages first.
22
23### Debian
24
25 apt-get install \
26 automake \
27 gcc \
28 libtool \
29 make \
30 python \
31 zlib1g-dev \
32
33See also `.travis.yml`.
34
35### Mac OS X (MacPorts)
36
37 port install \
38 autoconf \
39 automake \
40 libtool \
41
42### Mac OS X (HomeBrew)
43
44 brew install autoconf automake libtool
45
46Tested with:
47 autoconf 2.69
48 automake 1.16.1
49 libtool 2.4.6
50
README.md
1## README for file(1) Command and the libmagic(3) library ##
2
3 @(#) $File: README.md,v 1.7 2026/06/07 23:44:12 christos Exp $
4
5- Bug Tracker: <https://bugs.astron.com/>
6- Build Status: <https://travis-ci.org/file/file>
7- Download link: <ftp://ftp.astron.com/pub/file/>
8- E-mail: <christos@astron.com>
9- Fuzzing link: <https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:file>
10- Home page: https://www.darwinsys.com/file/
11- Mailing List archives: <https://mailman.astron.com/pipermail/file/>
12- Mailing List: <file@astron.com>
13- Public repo: <https://github.com/file/file>
14- Test framework: <https://github.com/file/file-tests>
15
16Phone: Do not even think of telephoning me about this program. Send
17cash first!
18
19This is Release 5.x of Ian Darwin's (copyright but distributable)
20file(1) command, an implementation of the Unix File(1) command.
21It knows the 'magic number' of several thousands of file types.
22This version is the standard "file" command for Linux, *BSD, and
23other systems. (See "patchlevel.h" for the exact release number).
24
25The major changes for 5.x are CDF file parsing, indirect magic,
26name/use (recursion) and overhaul in mime and ascii encoding
27handling.
28
29The major feature of 4.x is the refactoring of the code into a
30library, and the re-write of the file command in terms of that
31library. The library itself, libmagic can be used by 3rd party
32programs that wish to identify file types without having to fork()
33and exec() file. The prime contributor for 4.0 was Mans Rullgard.
34
35UNIX is a trademark of UNIX System Laboratories.
36
37The prime contributor to Release 3.8 was Guy Harris, who put in
38megachanges including byte-order independence.
39
40The prime contributor to Release 3.0 was Christos Zoulas, who put
41in hundreds of lines of source code changes, including his own
42ANSIfication of the code (I liked my own ANSIfication better, but
43his (__P()) is the "Berkeley standard" way of doing it, and I wanted
44UCB to include the code...), his HP-like "indirection" (a feature
45of the HP file command, I think), and his mods that finally got
46the uncompress (-z) mode finished and working.
47
48This release has compiled in numerous environments; see PORTING
49for a list and problems.
50
51This fine freeware file(1) follows the USG (System V) model of the
52file command, rather than the Research (V7) version or the V7-derived
534.[23] Berkeley one. That is, the file /etc/magic contains much of
54the ritual information that is the source of this program's power.
55My version knows a little more magic (including tar archives) than
56System V; the /etc/magic parsing seems to be compatible with the
57(poorly documented) System V /etc/magic format (with one exception;
58see the man page).
59
60In addition, the /etc/magic file is built from a subdirectory
61for easier(?) maintenance. I will act as a clearinghouse for
62magic numbers assigned to all sorts of data files that
63are in reasonable circulation. Send your magic numbers,
64in magic(5) format please, to the maintainer, Christos Zoulas.
65
66COPYING - read this first.
67* `ChangeLog` - log of important changes
68* `README.md` - read this second (you are currently reading this file).
69* `INSTALL` - read on how to install
70* `src/apprentice.c` - parses /etc/magic to learn magic
71* `src/apptype.c` - used for OS/2 specific application type magic
72* `src/ascmagic.c` - third & last set of tests, based on hardwired assumptions.
73* `src/asctime_r.c` - replacement for OS's that don't have it.
74* `src/asprintf.c` - replacement for OS's that don't have it.
75* `src/buffer.c` - buffer handling functions.
76* `src/cdf.[ch]` - parser for Microsoft Compound Document Files
77* `src/cdf_time.c` - time converter for CDF.
78* `src/compress.c` - handles decompressing files to look inside.
79* `src/ctime_r.c` - replacement for OS's that don't have it.
80* `src/der.[ch]` - parser for Distinguished Encoding Rules
81* `src/dprintf.c` - replacement for OS's that don't have it.
82* `src/elfclass.h` - common code for elf 32/64.
83* `src/encoding.c` - handles unicode encodings
84* `src/file.c` - the main program
85* `src/file.h` - header file
86* `src/file_opts.h` - list of options
87* `src/fmtcheck.c` - replacement for OS's that don't have it.
88* `src/fsmagic.c` - first set of tests the program runs, based on filesystem info
89* `src/funcs.c` - utilility functions
90* `src/getline.c` - replacement for OS's that don't have it.
91* `src/getopt_long.c` - replacement for OS's that don't have it.
92* `src/gmtime_r.c` - replacement for OS's that don't have it.
93* `src/is_csv.c` - knows about Comma Separated Value file format (RFC 4180).
94* `src/is_json.c` - knows about JavaScript Object Notation format (RFC 8259).
95* `src/is_simh.c` - knows about SIMH tape file format.
96* `src/is_tar.c, tar.h` - knows about Tape ARchive format (courtesy John Gilmore).
97* `src/landlock.c` - linux landlock protection
98* `src/localtime_r.c` - replacement for OS's that don't have it.
99* `src/magic.h.in` - source file for magic.h
100* `src/mygetopt.h` - replacement for OS's that don't have it.
101* `src/magic.c` - the libmagic api
102* `src/names.h` - header file for ascmagic.c
103* `src/pread.c` - replacement for OS's that don't have it.
104* `src/print.c` - print results, errors, warnings.
105* `src/readcdf.c` - CDF wrapper.
106* `src/readelf.[ch]` - Stand-alone elf parsing code.
107* `src/softmagic.c` - 2nd set of tests, based on /etc/magic
108* `src/swap.h` - byte swapping
109* `src/swap.c` - byte swapping
110* `src/mygetopt.h` - replacement for OS's that don't have it.
111* `src/seccomp.c` - linux seccomp protection
112* `src/strcasestr.c` - replacement for OS's that don't have it.
113* `src/strlcat.c` - replacement for OS's that don't have it.
114* `src/strlcpy.c` - replacement for OS's that don't have it.
115* `src/strndup.c` - replacement for OS's that don't have it.
116* `src/tar.h` - tar file definitions
117* `src/vasprintf.c` - for systems that don't have it.
118* `doc/file.man` - man page for the command
119* `doc/magic.man` - man page for the magic file, courtesy Guy Harris.
120 Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
121
122Magdir - directory of /etc/magic pieces
123------------------------------------------------------------------------------
124
125If you submit a new magic entry please make sure you read the following
126guidelines:
127
128- Initial match is preferably at least 32 bits long, and is a _unique_ match
129- If this is not feasible, use additional check
130- Match of <= 16 bits are not accepted
131- Delay printing string as much as possible, don't print output too early
132- Avoid printf arbitrary byte as string, which can be a source of
133 crash and buffer overflow
134
135- Provide complete information with entry:
136 * One line short summary
137 * Optional long description
138 * File extension, if applicable
139 * Full name and contact method (for discussion when entry has problem)
140 * Further reference, such as documentation of format
141
142gpg for dummies:
143------------------------------------------------------------------------------
144
145```
146$ gpg --verify file-X.YY.tar.gz.asc file-X.YY.tar.gz
147gpg: assuming signed data in `file-X.YY.tar.gz'
148gpg: Signature made WWW MMM DD HH:MM:SS YYYY ZZZ using DSA key ID KKKKKKKK
149```
150
151To download the key:
152
153```
154$ gpg --keyserver hkp://keys.gnupg.net --recv-keys KKKKKKKK
155```
156------------------------------------------------------------------------------
157
158
159Parts of this software were developed at SoftQuad Inc., developers
160of SGML/HTML/XML publishing software, in Toronto, Canada.
161SoftQuad was swallowed up by Corel in 2002 and does not exist any longer.
162