View Issue Details

IDProjectCategoryView StatusLast Update
0000515fileGeneralpublic2024-11-10 20:45
Reportermarcoribeiro Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.45 
Fixed in VersionHEAD 
Summary0000515: Magic inserts linebreaks inside TIFF descriptions, making it not possible to correcly split lines
DescriptionWhen I use the flag 'MAGIC_CONTINUE', I expect each detection to be on a separate line, but on some cases it also adds a linebreak followed by "- " inside a detection from a TIFF buffer

Here is an example, using the flags MAGIC_CONTINUE | MAGIC_RAW (also happens with MAGIC_RAW is not set, but with "\n" replaced with "\012"):
'TIFF image data, little-endian, direntries=18, height=434, bps=14534, compression=none, PhotometricInterpretation=RGB, name=/home/marta/Desktop/www/file ex/files/grafa/tiff/file_example_TIFF_1MB.tiff, orientation=upper-left\n- , width=650\n- data'

Note that the "width=650" should be on the previous line (or at least, it should not have the "- " before it)

This (attached) TIFF image was downloaded from https://file-examples.com/index.php/sample-images-download/sample-tiff-download/ (the 1MB version)
Steps To ReproduceUsing the file-magic package for Python:

-------------------------------------------------
import magic
from pathlib import Path

magic_desc = magic.open(magic.MAGIC_CONTINUE | magic.MAGIC_RAW)
assert magic_desc.load() == 0

data = Path("file_example_TIFF_1MB").read_bytes()
print(magic_desc.buffer(data))
-------------------------------------------------

Using the python-magic package:

-------------------------------------------------
import magic
from pathlib import Path

magic_desc = magic.Magic(keep_going=True, raw=True)
data = Path("file_example_TIFF_1MB").read_bytes()
print(magic_desc.from_buffer(data))
-------------------------------------------------

Both cases should output:
TIFF image data, little-endian, direntries=18, height=434, bps=14534, compression=none, PhotometricInterpretation=RGB, name=/home/marta/Desktop/www/file ex/files/grafa/tiff/file_example_TIFF_1MB.tiff, orientation=upper-left
- , width=650
- data
TagsNo tags attached.

Activities

marcoribeiro

2024-04-08 19:13

reporter  

file_example_TIFF_1MB.tiff (1,131,930 bytes)

christos

2024-11-10 20:45

manager   ~0004108

Fixed, thanks!

Issue History

Date Modified Username Field Change
2024-04-08 19:13 marcoribeiro New Issue
2024-04-08 19:13 marcoribeiro File Added: file_example_TIFF_1MB.tiff
2024-11-10 20:44 christos Assigned To => christos
2024-11-10 20:44 christos Status new => assigned
2024-11-10 20:45 christos Status assigned => resolved
2024-11-10 20:45 christos Resolution open => fixed
2024-11-10 20:45 christos Fixed in Version => HEAD
2024-11-10 20:45 christos Note Added: 0004108