Christos Zoulas [Thu, 5 Jun 2008 12:59:15 +0000 (12:59 +0000)]
Comment #3 From Jakub Jelinek on 2006-10-06 07:42 EST [reply]
The file is the stripped-into-separate-file debuginfo, in which sections that
are present in the stripped file are made SHT_NOBITS and not present at all.
So, file needs to check for SHT_NOBITS .note sections and don't look at them
at all. Currently it just reads some completely unrelated data (probably
part of one of the .debug_* sections).
Comment #6 From Jakub Jelinek on 2006-10-17 10:48 EST [reply]
Proposed patch. While it would be possible to do what I proposed (i.e.
for each PT_NOTE look up in section header table in which section the virtual
address falls in and test if it is not SHT_NOBITS), this is far easier and
faster
and has a nice side-effect that it doesn't duplication information in file
output. Unpatched file will e.g. say:
file /bin/bash
/bin/bash: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9,
stripped
(note the .note.ABI-tag section being parsed and printed twice, once when found
through PT_NOTE, once when found through SHT_NOTE). When the executable has
a section header table, then it is safe to assume that either there will be
a SHT_NOTE section corresponding to the PT_NOTE program header, or it will be
SHT_NOBITS in a debuginfo file (at which point it is not present).
file-4.24-efi.patch: Changes the detection of MS-DOS executables, adds
support for various PE32/PE32+ executables, reports Windows executables as
PE32 not MS-DOS
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.