[File] json magic - output string

Vincent Mihalkovic vmihalko at redhat.com
Thu Dec 9 16:05:54 UTC 2021


Hi,

from https://bugzilla.redhat.com/show_bug.cgi?id=2020715:

"Description of problem:

The command "file" applied to a JSON file now outputs "JSON data", without
including the string "text" in the output. Earlier versions behaved
differently -
on CentOS 6 file returned just "ASCII text" for JSON file,and this is also
contrary to the documentation of file (man file), which states:

     The type printed will usually contain one of the words text (the file
     contains only printing characters and a few common control characters
and
     is probably safe to read on an ASCII terminal), executable (the file
con‐
     tains the result of compiling a program in a form understandable to
some
     UNIX kernel or another), or data meaning anything else (data is usually
     “binary” or non-printable).  Exceptions are well-known file formats
(core
     files, tar archives) that are known to contain binary data.  When
modify‐
     ing magic files or the program itself, make sure to preserve these
     keywords.  Users depend on knowing that all the readable files in a di‐
     rectory have the word “text” printed.  Don't do as Berkeley did and
     change “shell commands text” to “shell script”.

Apparently file has now done as Berkeley did..."

What do you think about changing the "JSON data" to "JSON text data" ?
https://github.com/file/file/blob/b56b58d499dbe58f2bed28e6b3c297fe7add992e/src/is_json.c#L417

vincent mihalkovic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/file/attachments/20211209/7686dec7/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.41-JSON-text.patch
Type: text/x-patch
Size: 387 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20211209/7686dec7/attachment.bin>


More information about the File mailing list