Christos Zoulas [Sat, 22 Mar 2008 20:56:20 +0000 (20:56 +0000)]
the fragment generation does not work:
$ make
cd .. && /bin/bash /u/christos/src/file/missing --run automake-1.10 --gnu magic/Makefile
automake-1.10: cannot open < magic/magic_fragments.mak: No such file or directory
Reuben Thomas [Thu, 28 Feb 2008 20:10:10 +0000 (20:10 +0000)]
Make some small improvements to the magic man page, including nesting
the list of magic line elements correctly, modernising some of the
early discussion of magic patterns, and making the warning against
regexs clearer.
Reuben Thomas [Mon, 25 Feb 2008 02:54:08 +0000 (02:54 +0000)]
Fix relative offsets after search again, this time I think properly.
Since this fix was complex (for me!), I'll explain it; the fix also is
slightly more than minimal in order to make the code clearer.
The bug was in lines 1644 and 1652: ms->search.offset = m->offset
overwrites the earlier addition, in lines 192-3, of the relevant offset
to ms->offset. So m->offset should become ms->offset in both lines.
This is a correct fix, but it is not ideal. For starters (and
indepdently of this fix), line 1652 can be changed simply to
ms->search.offset += idx, as this does not mention ms->offset
unnecessarily. Secondly, the code for FILE_REGEX initialises
ms->search.offset in mcopy at about line 820, not in magiccheck at
all, so it makes sense to move FILE_SEARCH's initialisation there too
for consistency. It then becomes
ms->search.offset = offset. We can check that "offset" is earlier set
to "ms->offset" in mcopy's caller, mget, so it's the same value.
Reuben Thomas [Mon, 25 Feb 2008 01:05:30 +0000 (01:05 +0000)]
Revert change made in 1.108 and 1.109, as I still haven't got this
right, and the bugs my changes introduced are much worse than those it
fixed. I'll fix this properly as soon as I can work out how.
Christos Zoulas [Tue, 19 Feb 2008 15:53:09 +0000 (15:53 +0000)]
- Fix dynamic object stripped/notstripped printing that was broken with the
dynamic executable switch fixes.
- Propagate the dynamic executable fixes to the 64 bit code, and merge the
code snippets so that they don't diverge again.
Reuben Thomas [Tue, 19 Feb 2008 00:58:59 +0000 (00:58 +0000)]
Replace use of (v)snprintf with (v)asprintf. This has several advantages:
1. (Mostly) easier to program with as the allocation is done for you.
(Sometimes it's a little more complicated to get the deallocation
right). The amount of code removed as a result by this commit is
greater than the amount introduced (excluding the (v)asprintf
implementation).
2. Safer: no buffer overflows.
3. Works on all platforms: BSD-licensed mature xnprintf code used
(I've been using this for some years in Zile with no problems). No
more overflows due to the previous bogus snprintf/vsnprintf
fallbacks.
Also add and use a MAX() macro in the same vein as MIN().
Reuben Thomas [Mon, 18 Feb 2008 17:15:47 +0000 (17:15 +0000)]
Comment out overly weak Lisp/Windows .inf magic. Can't tell the
difference between .inf format such as for wine.conf (where there are
no \r's) and Scheme/Lisp. Possibly one could use keywords to find Lisp
and .inf section headings to guess .inf files, but for now just give up.
Reuben Thomas [Mon, 18 Feb 2008 14:17:20 +0000 (14:17 +0000)]
Comment out LZMA detection, as according to discussion on Debian bug
#364260 it's not possible to make it reliable. Apparently there's a
newer version of the archive format that can be detected, but it
doesn't seem to be deployed yet; I have asked for more details.
Reuben Thomas [Mon, 18 Feb 2008 13:27:36 +0000 (13:27 +0000)]
Attempt to make LZMA work better, by observation: simply cut off the
bytes that don't match an arbitrary file I made. 5 bytes is still
enough for binary magic.
Reuben Thomas [Tue, 12 Feb 2008 17:27:28 +0000 (17:27 +0000)]
Make MPEG sequence magic more precise so it's less strong than Windows
icon magic and won't unnecessarily match Windows icons. Fixes Debian
bug #299091.