Christos Zoulas [Sun, 30 Mar 2014 21:41:45 +0000 (21:41 +0000)]
raise the strength of the targa magic, instead of dropping the cursor magic
so that they does not get recognized as lotus 123 files. From Christoph Biedl
Christos Zoulas [Fri, 14 Mar 2014 19:02:37 +0000 (19:02 +0000)]
PR/319: Remove superfluous call to file_ascmagic_with_encoding. file_encoding
should have set looks_text correctly before, and file_ascmagic already calls
file_ascmagic_with_encoding if it needs to.
Christos Zoulas [Sat, 8 Mar 2014 17:26:48 +0000 (17:26 +0000)]
FIx windows icons and cursors (Christoph Biedl)
the detection of MS-Windows icon files was buggy and incomplete. Since
non-animated cursors have a very similar format, they are added here,
too.
Some details: Using only the very first four octets for determination
has always some risk of false detection. So additionally look at
offset 9 which should always be zero, but according to Wikipedia might
also be 0xff.
In "number of colors" at offset 8, the zero value previously was used
to describe "256 colors", according to Wikipedia this isn't true, so
it was dropped.
On a side node: This introduces another usage of name/use. I'm afraid
we might sooner or later end up in name clashes on these identifiers.
Feel free to extend them like prefixing with the file name "msdos-".
Also, I was a bit surprised no "message" in "use" is printed, I wanted
to do
>>4 use ico-dir MS Windows icon resource
but that message gets lost. Hence the hackery
>>0 byte x MS Windows icon resource
>>4 use ico-dir
So a feature request: Print any message in "use".
This patch by the way fixes Debian#562250. It just got a little
bigger.
Christos Zoulas [Thu, 6 Mar 2014 16:37:16 +0000 (16:37 +0000)]
Fixes from Christoph Biedl:
Inspired by Debian#588953 that rightly complained about poor
recognition of avr32 ELF files: There have been changes since the
original bug submission, file(1) now detects them as
but this was an impetus to update the list of "machines" (ELF speak),
or "architectures".
The list was taken from binutils-2.24:include/elf/common.h with some
extra research. Numbers marked "reserved" were excluded.
Additional changes:
* sorted strictly by machine number.
* some missing trailing comma added.
* slight change in Motorola names for clarity.
* fix obviously wrong endianess in 138 = LatticeMico32.
* marked all inofficial numbers as such (unless already "obsolete").
* description trimmed to keep strings short. Perhaps even any
trailing "familiy" should be dropped for the same reason.
For your information, the two attached files were used as starting
point:
elf-archs-file.magic: The relevant lines in magic/Magic/elf
elf-archs-binutils.magic: The relevant lines in include/elf/common.h,
sorted, converted into magic
As you can see, several names still differ, and it's not always easy
to judge which is better. The most prominent difference is machine
number 9, "IBM System/370" vs. "Amdahl". There's a reason for both,
and I decided to keep the name currently used by file(1).
Fun fact: file(1) knows more machine numbers than binutils.
Christos Zoulas [Sun, 2 Mar 2014 00:01:29 +0000 (00:01 +0000)]
See Debian#657545: The "Linux/i386 core file" rule in linux:42 has a
bigger strength (70) than "JPEG image data" in jpeg:12 (50). As a
result, the provided file is mis-detected as "Linux/i386 core".
kim [Tue, 18 Feb 2014 11:09:31 +0000 (11:09 +0000)]
Cache old LC_CTYPE locale for restoring it later.
Cache old LC_CTYPE locale before setting it to "C", so
we can use it to restore LC_CTYPE instead of asking
setlocale() to scan the environment variables.