View Issue Details

IDProjectCategoryView StatusLast Update
0000655fileGeneralpublic2025-05-28 16:41
Reporterjsummers Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
OSUbuntu Linux 
Product Version5.46 
Fixed in VersionHEAD 
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.)

christos

2025-05-28 16:41

manager   ~0004238

Fixed, thanks!

Issue History

Date Modified Username Field Change
2025-05-09 12:16 jsummers New Issue
2025-05-09 15:17 jsummers Note Added: 0004223
2025-05-28 16:41 christos Assigned To => christos
2025-05-28 16:41 christos Status new => assigned
2025-05-28 16:41 christos Status assigned => resolved
2025-05-28 16:41 christos Resolution open => fixed
2025-05-28 16:41 christos Fixed in Version => HEAD
2025-05-28 16:41 christos Note Added: 0004238