Bug 1773477

Summary: file is recognized as "Linux Journalled Flash File system" if the beginning of the file content is "1984"
Product: Red Hat Enterprise Linux 8 Reporter: Kamil Dudka <kdudka>
Component: fileAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Karel Volný <kvolny>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: fsumsal, jhuo, kdudka, kvolny, qe-baseos-daemons
Target Milestone: betaKeywords: Patch
Target Release: 8.2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: file-5.33-13.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1771242 Environment:
Last Closed: 2020-04-28 16:40:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1771242    

Description Kamil Dudka 2019-11-18 08:56:04 UTC
+++ This bug was initially created as a clone of Bug #1771242 +++

Description of problem:

Version-Release number of selected component (if applicable):
RHEL 6, RHEL 7, RHEL 8

How reproducible:
I easily reproduced the issue on RHEL 6.7,RHEL 7.7, RHEL 8.0.

use RHEL 7.7 as example:

[root@vm77 tmp]# uname -a
Linux vm77 3.10.0-1062.el7.x86_64 #1 SMP Thu Jul 18 20:25:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@vm77 tmp]# rpm -qa file
file-5.11-35.el7.x86_64

Steps to Reproduce:
1.
create a file with content "1984"

[root@vm77 tmp]# vi test
[root@vm77 tmp]# cat test 
1984
[root@vm77 tmp]# file test 
test: Linux Journalled Flash File system, little endian

2.
change file content to "1985", the file is recognized as "ASCII text"

[root@vm77 tmp]# cat test 
1985
[root@vm77 tmp]# file test 
test: ASCII text

3.

Actual results:

[root@vm77 tmp]# cat test 
1984
[root@vm77 tmp]# file test 
test: Linux Journalled Flash File system, little endian

Expected results:

the text file should be recognized as "ASCII text"

[root@vm77 tmp]# cat test 
1985
[root@vm77 tmp]# file test 
test: ASCII text

Additional info:

--- Additional comment from Kamil Dudka on 2019-11-12 09:49:45 CET ---

I can see that 0x1984 is magic of an old JFFS2 file system format:

    https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/uapi/linux/jffs2.h?h=v5.3.10#n24

I need to double check it but there might be a mistake in file's magic database that the pattern is ASCII encoded while it should be binary encoded.

--- Additional comment from Kamil Dudka on 2019-11-12 10:43:27 CET ---

I have proposed a patch upstream:

https://mailman.astron.com/pipermail/file/2019-November/000231.html

--- Additional comment from Kamil Dudka on 2019-11-17 00:02:09 CET ---

upstream commit:

https://github.com/file/file/commit/FILE5_37-108-g5ad78c72

Comment 1 Kamil Dudka 2019-11-18 10:43:35 UTC
fixed in file-5.37-9.fc32:

https://src.fedoraproject.org/rpms/file/c/ca697060

Comment 6 errata-xmlrpc 2020-04-28 16:40:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1772