View Issue Details

IDProjectCategoryView StatusLast Update
0000655fileGeneralpublic2025-05-09 15:17
Reporterjsummers Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
OSUbuntu Linux 
Product Version5.46 
Summary0000655: Type "string/bt" doesn't work as expected
DescriptionSuppose a pattern's first line has type "string/bt" (or "string/b/t"). I would expect the pattern to be able to match both binary and text files, as is the case for "search/bt", "regex/bt", and for just plain "string". But that doesn't happen. Only text files can match, as if it were "string/t".

There are only two affected patterns in the current database, both near the beginning of magic/Magdir/sgml.
Steps To Reproduce$ echo '<svgABCDEFG' > text_svg.dat
$ echo -ne '<svg\0\0\xff\xff\x01\x02' > binary_svg.dat
$ file text_svg.dat binary_svg.dat

My results:

text_svg.dat: SVG Scalable Vector Graphics image, ASCII text
binary_svg.dat: data

Expected results:

text_svg.dat: SVG Scalable Vector Graphics image
binary_svg.dat: SVG Scalable Vector Graphics image
TagsNo tags attached.

Activities

jsummers

2025-05-09 15:17

reporter   ~0004223

I'll add that type "pstring" has the same issue as "string" -- "/bt" seems to behave as if it were "/t".

(It's curious that pstring supports /t at all, since none of the documented pstring formats are usable in text files. But, whatever.)

Issue History

Date Modified Username Field Change
2025-05-09 12:16 jsummers New Issue
2025-05-09 15:17 jsummers Note Added: 0004223