#1008247 file: files consisting of JSON + garbage are misdetected as JSON data

Package:
file
Source:
file
Description:
Recognize the type of data in a file using "magic" numbers
Submitter:
Vincent Lefevre
Date:
2026-01-10 11:39:58 UTC
Severity:
normal
Tags:
#1008247#5
Date:
2022-03-25 09:59:08 UTC
From:
To:
After a fix,

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=922874
  file: mistakes Xorg.0.log file as JSON data

has reappeared. The fact is that the issue is actually more general
than the one reported in bug 922874 and that the fix of this bug was
not the right thing to do.

I reported the bug upstream

https://bugs.astron.com/view.php?id=332

and also posted a simple patch (fixing the real issue, i.e. that
garbage after JSON data was ignored) there.

#1008247#10
Date:
2022-03-25 10:13:37 UTC
From:
To:
Grrr... fixing a typo in the title.
#1008247#17
Date:
2022-03-25 10:52:47 UTC
From:
To:
I've attached a patch corresponding to my patch I've posted upstream,
but without the testcases and with 2 lines of context removed, so that
it can be applied on either the current Debian package (file 1:5.41-3)
or upstream code.

#1008247#26
Date:
2026-01-10 10:08:19 UTC
From:
To:
Es gibt eine Familienspende in Höhe von 1.850.000,00 USD von Cheng Charlie
Saephan. Bitte antworten Sie für weitere Informationen. Denken Sie daran,
Ihrer Familie und den Bedürftigen in Ihrer Umgebung Gutes zu tun.

Dies ist bereits der zweite Versuch, Sie zu erreichen. Bitte antworten Sie
für weitere Details.

#1008247#31
Date:
2026-01-10 10:08:19 UTC
From:
To:
Es gibt eine Familienspende in Höhe von 1.850.000,00 USD von Cheng Charlie
Saephan. Bitte antworten Sie für weitere Informationen. Denken Sie daran,
Ihrer Familie und den Bedürftigen in Ihrer Umgebung Gutes zu tun.

Dies ist bereits der zweite Versuch, Sie zu erreichen. Bitte antworten Sie
für weitere Details.