[File] json magic - output string

Christos Zoulas christos at zoulas.com
Thu Dec 9 18:38:59 UTC 2021


You got it!

christos

> On Dec 9, 2021, at 11:05 AM, Vincent Mihalkovic <vmihalko at redhat.com> wrote:
> 
> Hi,
> 
> 
> 
> from https://bugzilla.redhat.com/show_bug.cgi?id=2020715 <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 <https://github.com/file/file/blob/b56b58d499dbe58f2bed28e6b3c297fe7add992e/src/is_json.c#L417>
> 
> vincent mihalkovic
> 
> 
> 
> 
> <file-5.41-JSON-text.patch>--
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/file/attachments/20211209/16afc361/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20211209/16afc361/attachment.asc>


More information about the File mailing list