From 411766c4848c80eb8d94b0e12f48013e7ceb9de1 Mon Sep 17 00:00:00 2001 From: Vincent Mihalkovic Date: Tue, 14 Dec 2021 13:18:15 +0100 Subject: [PATCH] change the identification for JSON files (#2020715) --- file-5.41-json-magic.patch | 31 ++++++++++++++++++++++++++++++ file-5.41-json-tests-fix.patch | 35 ++++++++++++++++++++++++++++++++++ file-5.41-json-tests.patch | 35 ++++++++++++++++++++++++++++++++++ file.spec | 11 ++++++++++- 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 file-5.41-json-magic.patch create mode 100644 file-5.41-json-tests-fix.patch create mode 100644 file-5.41-json-tests.patch diff --git a/file-5.41-json-magic.patch b/file-5.41-json-magic.patch new file mode 100644 index 0000000..c18cc9f --- /dev/null +++ b/file-5.41-json-magic.patch @@ -0,0 +1,31 @@ +From c49e7805fd8aa48b8d2afad98d2115560ffaaf21 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Thu, 9 Dec 2021 18:38:43 +0000 +Subject: [PATCH] JSON is text data, requested by Vincent Mihalkovic. + +--- + src/is_json.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/is_json.c b/src/is_json.c +index 0b12438ff..4ff49b3bb 100644 +--- a/src/is_json.c ++++ b/src/is_json.c +@@ -32,7 +32,7 @@ + #include "file.h" + + #ifndef lint +-FILE_RCSID("@(#)$File: is_json.c,v 1.15 2020/06/07 19:05:47 christos Exp $") ++FILE_RCSID("@(#)$File: is_json.c,v 1.16 2021/12/09 18:38:43 christos Exp $") + #endif + + #include +@@ -414,7 +414,7 @@ file_is_json(struct magic_set *ms, const struct buffer *b) + return -1; + return 1; + } +- if (file_printf(ms, "JSON data") == -1) ++ if (file_printf(ms, "JSON text data") == -1) + return -1; + #if JSON_COUNT + #define P(n) st[n], st[n] > 1 ? "s" : "" diff --git a/file-5.41-json-tests-fix.patch b/file-5.41-json-tests-fix.patch new file mode 100644 index 0000000..e19a54d --- /dev/null +++ b/file-5.41-json-tests-fix.patch @@ -0,0 +1,35 @@ +From e83f5046ef2d8967f14db5063a09c91f54f68063 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Sun, 12 Dec 2021 16:23:06 +0000 +Subject: [PATCH] remove trailing newline + +--- + tests/json1.result | 2 +- + tests/json2.result | 2 +- + tests/json3.result | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/json1.result b/tests/json1.result +index 7d635242f..550d7ac2f 100644 +--- a/tests/json1.result ++++ b/tests/json1.result +@@ -1 +1 @@ +-JSON text data ++JSON text data +\ No newline at end of file +diff --git a/tests/json2.result b/tests/json2.result +index 7d635242f..550d7ac2f 100644 +--- a/tests/json2.result ++++ b/tests/json2.result +@@ -1 +1 @@ +-JSON text data ++JSON text data +\ No newline at end of file +diff --git a/tests/json3.result b/tests/json3.result +index 7d635242f..550d7ac2f 100644 +--- a/tests/json3.result ++++ b/tests/json3.result +@@ -1 +1 @@ +-JSON text data ++JSON text data +\ No newline at end of file diff --git a/file-5.41-json-tests.patch b/file-5.41-json-tests.patch new file mode 100644 index 0000000..0aa093a --- /dev/null +++ b/file-5.41-json-tests.patch @@ -0,0 +1,35 @@ +From 3012be8ca1cdee72471118eea0192e1e32cab862 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Fri, 10 Dec 2021 18:36:41 +0000 +Subject: [PATCH] Adjust tests to match what JSON prints now (Avinash Sonawane) + +--- + tests/json1.result | 2 +- + tests/json2.result | 2 +- + tests/json3.result | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/json1.result b/tests/json1.result +index 01442dc9c..7d635242f 100644 +--- a/tests/json1.result ++++ b/tests/json1.result +@@ -1 +1 @@ +-JSON data +\ No newline at end of file ++JSON text data +diff --git a/tests/json2.result b/tests/json2.result +index 01442dc9c..7d635242f 100644 +--- a/tests/json2.result ++++ b/tests/json2.result +@@ -1 +1 @@ +-JSON data +\ No newline at end of file ++JSON text data +diff --git a/tests/json3.result b/tests/json3.result +index 01442dc9c..7d635242f 100644 +--- a/tests/json3.result ++++ b/tests/json3.result +@@ -1 +1 @@ +-JSON data +\ No newline at end of file ++JSON text data diff --git a/file.spec b/file.spec index 25b9ba1..f9a379a 100644 --- a/file.spec +++ b/file.spec @@ -15,7 +15,7 @@ Summary: Utility for determining file types Name: file Version: 5.41 -Release: 2%{?dist} +Release: 3%{?dist} License: BSD Source0: http://ftp.astron.com/pub/file/file-%{version}.tar.gz @@ -28,6 +28,12 @@ Patch2: file-5.04-volume_key.patch # Upstream commit: https://github.com/file/file/commit/f687fa2b92cd9231 Patch3: file-5.41-javascript-magic.patch +# Upstream commit: https://github.com/file/file/commit/c49e7805fd8aa48b +Patch4: file-5.41-json-magic.patch +# Upstream commit: https://github.com/file/file/commit/3012be8ca1cdee72 +Patch5: file-5.41-json-tests.patch +# Upstream commit: https://github.com/file/file/commit/e83f5046ef2d8967 +Patch6: file-5.41-json-tests-fix.patch URL: https://www.darwinsys.com/file/ Requires: file-libs%{?_isa} = %{version}-%{release} @@ -211,6 +217,9 @@ make -C tests check %endif %changelog +* Tue Dec 14 2021 Vincent Mihalkovic - 5.41-3 +- change the identification for JSON files (#2020715) + * Wed Dec 08 2021 Vincent Mihalkovic - 5.41-2 - fix the JavaScript detection (#2029975)