'file' Command Giving False Positives

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Fri Jul 2 18:23:28 UTC 2010


Polytropon <freebsd at edvax.de> writes:

> On Fri, 02 Jul 2010 11:25:20 -0400, Lowell Gilbert <freebsd-questions-local at be-well.ilk.org> wrote:
>> Why is it incorrect?  "LZ" as the first two bytes in a file is (unless
>> my memory is badly mistaken) exactly what the old command.com looked for
>> as the flag of an executable.
>
> If I ask *my* memory, it tells me that what you mean is "MZ". As
> far as I remember, those are the initials of a programmer involved
> with the creation of the DOS binary executable format. :-)

Apparently, your memory is better than mine, because that was indeed
what I was thinking of.  Which leads to the question of why magic(5)
lists LZ as representing "MS-DOS executable (built-in)".  I'd be
hesitant to change that unless we knew for sure it was wrong.

Even if it _is_ wrong, the "problem" still remains for "MZ" at least:
Any file starting with those letters is going to be identified as an
MS-DOS executable, and there's no clear way to distinguish it from a
text file that happens to start with those letters.


More information about the freebsd-questions mailing list