change the identification for JSON files (#2020715)

This commit is contained in:
Vincent Mihalkovic 2021-12-14 13:18:15 +01:00
parent 0be129eb87
commit 411766c484
4 changed files with 111 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From c49e7805fd8aa48b8d2afad98d2115560ffaaf21 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
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 <string.h>
@@ -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" : ""

View File

@ -0,0 +1,35 @@
From e83f5046ef2d8967f14db5063a09c91f54f68063 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
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

View File

@ -0,0 +1,35 @@
From 3012be8ca1cdee72471118eea0192e1e32cab862 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
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

View File

@ -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 <vmihalko@redhat.com> - 5.41-3
- change the identification for JSON files (#2020715)
* Wed Dec 08 2021 Vincent Mihalkovic <vmihalko@redhat.com> - 5.41-2
- fix the JavaScript detection (#2029975)