Bug 1945122

Summary: Printing ext4 filesystem UUIDs is broken with file 5.40
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: fileAssignee: Vincent Mihalkovič <vmihalko>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jkaluza, kdudka, odubaj, svashisht, vmihalko
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: file-5.40-5.fc35 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-26 18:08:17 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: 910269    

Description Richard W.M. Jones 2021-03-31 11:42:19 UTC
Description of problem:

file 5.40 can no longer print ext4 filesystem UUIDs correctly.

Version-Release number of selected component (if applicable):

  file-5.40-1.fc35.x86_64

How reproducible:

  100%

Steps to Reproduce:

1. Prepare a disk image in a file:

  $ rm /var/tmp/test.img
  $ truncate -s 1G /var/tmp/test.img
  $ mkfs.ext4 /var/tmp/test.img

2. Run 'file' against it to display the UUID.

With the previous version of file it would display the UUID correcctly, eg:

  $ file /var/tmp/test.img
  /var/tmp/test.img: Linux rev 1.0 ext4 filesystem data, UUID=b1bc22cc-7392-4780-8b50-77dac556236d (extents) (64bit) (large files) (huge files)

With the current version of file it displays it incorrectly, eg:

  $ file /var/tmp/test.img 
  /var/tmp/test.img: Linux rev 1.0 ext4 filesystem data, UUID=b1bc22cc-7392-4780-ffff8b50-77dac556236d (extents) (64bit) (large files) (huge files)

Notice that some parts of the UUID are sign-extended.

I cannot register with the upstream tracker at the moment, but
I did bisect this to the following upstream commit:

  0478d9251abafd0876cdb3121ef2c07af6c99513 is the first bad commit
  commit 0478d9251abafd0876cdb3121ef2c07af6c99513
  Author: Christos Zoulas <christos>
  Date:   Sat Aug 22 18:27:42 2020 +0000

    Treat printf numbers as signed.

   src/softmagic.c | 28 ++++++++++++++--------------
   1 file changed, 14 insertions(+), 14 deletions(-)

Comment 1 Richard W.M. Jones 2021-03-31 11:47:04 UTC
Upstream bug report:
https://bugs.astron.com/view.php?id=253

Comment 2 Vincent Mihalkovič 2021-04-26 18:08:17 UTC
Thank you, Richard!

dist-git commit: https://src.fedoraproject.org/rpms/file/c/15baab7f108ac146e8af7d358ab590e3782b6fa8