Bug 928995

Summary: file on zero-sized file now produces "empty " instead of "empty"
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: fileAssignee: Jan Kaluža <jkaluza>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jkaluza
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-29 07:42:58 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:

Description Richard W.M. Jones 2013-03-28 23:55:40 UTC
Description of problem:

In Rawhide, the output of:

  $ rm -f /tmp/empty
  $ touch /tmp/empty
  $ file /tmp/empty

has unfortunately changed from "empty" to "empty " (note
extra space).

Try hexdumping the output:

$ file /tmp/empty | hexdump -C
00000000  2f 74 6d 70 2f 65 6d 70  74 79 3a 20 65 6d 70 74  |/tmp/empty: empt|
00000010  79 20 0a                                          |y .|
             ^^^ note stray space
00000013

Yet again, it's very annoying that file doesn't have a
consistent, reliable output.  Also annoying that the
upstream website is down .... again.

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

file 5.14-2.fc20 

How reproducible:

100%

Comment 1 Jan Kaluža 2013-03-29 07:42:58 UTC
Thanks for the report, I have fixed it in file-5.14-3 - http://koji.fedoraproject.org/koji/taskinfo?taskID=5186664 .

Unfortunately, File upstream developer does not test his project well and I think he does lot of changes without any testing. He also does some nasty things like changing already released tarballs without version bump and so on. I have test suite, but I can't test every commit upstream does.

I have already skipped 2 versions (5.12 and 5.13), because they were really buggy and 5.14 finally looked better after running my test-suite. I just want to say you are not the only one frustrated... But I still should update at some point, because it contains my fixes for Fedora bugs. Since File is critical component, I'm always updating early in the rawhide cycle and don't update at all once the new Fedora is branched.

Comment 2 Jan Kaluža 2013-03-29 07:44:21 UTC
(This comment is just for me to cache my comment for upstream bugzilla, because it has some database problems right now and I'm not able to submit that bugreport)

attached patch fixes useless white-space at the end of fsmagic output. I don't see why this white-space is printed, because there is no chance to add anything else to output if we are in that part of code. if ret==0, then nothing was printed at all and there's no need for space. if ret==1, then in magic.c (the only place where fsmagic is called) we return without more detection (and therefore without more prints).

Comment 3 Richard W.M. Jones 2013-03-29 20:10:04 UTC
Thanks.  For the record, I also added a workaround in libguestfs
in case people are using upstream file or other distros:

https://github.com/libguestfs/libguestfs/commit/d6ea2f5911a6c7f3037ae822e872b810ad80ba51

Comment 4 Fedora Update System 2013-03-31 13:24:39 UTC
libguestfs-1.20.5-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/libguestfs-1.20.5-1.fc18

Comment 5 Fedora Update System 2013-04-08 22:52:31 UTC
libguestfs-1.20.5-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 6 Jan Kaluža 2013-04-17 06:36:58 UTC
Upstream bugreport: http://bugs.gw.com/view.php?id=247