xref: /netbsd-src/external/bsd/file/dist/TODO (revision 52d7030a87b905fea57a54cc9de426e1f7539720)
12ae0d66fSchristosMost TODOs live in the TODO section of doc/file.man (i.e. file(1)).
22ae0d66fSchristosThey are more visible there, so please add any further TODOs to that
32ae0d66fSchristosfile, not here. More speculative material can live here.
41b108b8bSchristos
55ccaa8c0Schristos(This change was made when Reuben Thomas noticed that all the bugs
65ccaa8c0Schristoslisted in the BUGS section of the man page had been fixed!)
72ae0d66fSchristos
82ae0d66fSchristos---
92ae0d66fSchristosIt would be nice to simplify file considerably. For example,
102ae0d66fSchristosreimplement the apprentice and non-pattern magic methods in Python,
118df916c0Schristosand compile the magic patterns to a giant regex (or something similar;
128df916c0Schristosmaybe using Ragel (http://www.complang.org/ragel/)) so that only a
138df916c0Schristossmall amount of C is needed (because fast execution is typically only
148df916c0Schristosrequired for soft magic, not the more detailed information given by
158df916c0Schristoshard-wired routines). In this regard, note that hplip, which is
168df916c0SchristosBSD-licensed, has a magic reimplementation in Python.
17ae9cfef6Schristos---
183c9d2f35SchristosRead the kerberos magic entry for more ideas.
19ae9cfef6Schristos---
20ae9cfef6SchristosWrite a string merger to make magic entry sizes dynamic.
21ae9cfef6SchristosStrings will be converted to offsets from the string table.
22ae9cfef6Schristos---
23ae9cfef6SchristosProgramming language support, we can introduce the concept of a group
24ae9cfef6Schristosof rules where n rules need to match before the rule is positive. This
25ae9cfef6Schristoscould require structural changes to the matching code :-(
26ae9cfef6Schristos
27ae9cfef6Schristos0	group	2	# require 2 matches
28ae9cfef6Schristos# rule 1
29ae9cfef6Schristos>0	....
30ae9cfef6Schristos...
31ae9cfef6Schristos# rule 2
32ae9cfef6Schristos>0	....
33ae9cfef6Schristos...
34*52d7030aSchristos---
35*52d7030aSchristos- Merge the stat code dance in one place and keep it in one place
36*52d7030aSchristos  (perhaps struct buffer).
37*52d7030aSchristos- Enable seeking around if offset > nbytes if possible (the fd
38*52d7030aSchristos  is seekable).
39*52d7030aSchristos- We could use file_pipe2file more (for EOF offsets, CDF documents),
40*52d7030aSchristos  but that is expensive; perhaps we should provide a way to disable it
41*52d7030aSchristos- The implementation of struct buffer needs re-thinking and more work.
42*52d7030aSchristos  For example we don't always pass the fd in the child. This is not
43*52d7030aSchristos  important yet as we don't have yet cases where use/indirect magic
44*52d7030aSchristos  needs negative offsets.
45*52d7030aSchristos- Really the whole thing just needs here's an (offset, buffer, size)
46*52d7030aSchristos  you have (filebuffer, filebuffersize &&|| fd), fill the buffer with
47*52d7030aSchristos  data from offset. The buffer API should be changed to just do that.
48ae9cfef6Schristos
49ae9cfef6Schristoschristos
50