1b6cee71dSXin LIMost TODOs live in the TODO section of doc/file.man (i.e. file(1)). 2b6cee71dSXin LIThey are more visible there, so please add any further TODOs to that 3b6cee71dSXin LIfile, not here. More speculative material can live here. 47dbb948bSDavid E. O'Brien 580c86c36SDavid E. O'Brien(This change was made when Reuben Thomas noticed that all the bugs 680c86c36SDavid E. O'Brienlisted in the BUGS section of the man page had been fixed!) 7b6cee71dSXin LI 8b6cee71dSXin LI--- 9b6cee71dSXin LIIt would be nice to simplify file considerably. For example, 10b6cee71dSXin LIreimplement the apprentice and non-pattern magic methods in Python, 11b6cee71dSXin LIand compile the magic patterns to a giant regex (or something similar; 12b6cee71dSXin LImaybe using Ragel (http://www.complang.org/ragel/)) so that only a 13b6cee71dSXin LIsmall amount of C is needed (because fast execution is typically only 14b6cee71dSXin LIrequired for soft magic, not the more detailed information given by 15b6cee71dSXin LIhard-wired routines). In this regard, note that hplip, which is 16b6cee71dSXin LIBSD-licensed, has a magic reimplementation in Python. 17a5d223e6SXin LI--- 18c2931133SXin LIRead the kerberos magic entry for more ideas. 19a5d223e6SXin LI--- 205f0216bdSXin LIWrite a string merger to make magic entry sizes dynamic. 215f0216bdSXin LIStrings will be converted to offsets from the string table. 22a5d223e6SXin LI--- 23a5d223e6SXin LIProgramming language support, we can introduce the concept of a group 24a5d223e6SXin LIof rules where n rules need to match before the rule is positive. This 25a5d223e6SXin LIcould require structural changes to the matching code :-( 26a5d223e6SXin LI 27a5d223e6SXin LI0 group 2 # require 2 matches 28a5d223e6SXin LI# rule 1 29a5d223e6SXin LI>0 .... 30a5d223e6SXin LI... 31a5d223e6SXin LI# rule 2 32a5d223e6SXin LI>0 .... 33a5d223e6SXin LI... 34*58a0f0d0SEitan Adler--- 35*58a0f0d0SEitan Adler- Merge the stat code dance in one place and keep it in one place 36*58a0f0d0SEitan Adler (perhaps struct buffer). 37*58a0f0d0SEitan Adler- Enable seeking around if offset > nbytes if possible (the fd 38*58a0f0d0SEitan Adler is seekable). 39*58a0f0d0SEitan Adler- We could use file_pipe2file more (for EOF offsets, CDF documents), 40*58a0f0d0SEitan Adler but that is expensive; perhaps we should provide a way to disable it 41*58a0f0d0SEitan Adler- The implementation of struct buffer needs re-thinking and more work. 42*58a0f0d0SEitan Adler For example we don't always pass the fd in the child. This is not 43*58a0f0d0SEitan Adler important yet as we don't have yet cases where use/indirect magic 44*58a0f0d0SEitan Adler needs negative offsets. 45*58a0f0d0SEitan Adler- Really the whole thing just needs here's an (offset, buffer, size) 46*58a0f0d0SEitan Adler you have (filebuffer, filebuffersize &&|| fd), fill the buffer with 47*58a0f0d0SEitan Adler data from offset. The buffer API should be changed to just do that. 48a5d223e6SXin LI 49a5d223e6SXin LIchristos 50