Bug 463809

Summary: rpmbuild rpmfcClassify: Assertion fails on some binary files
Product: [Fedora] Fedora Reporter: Tim Jackson <rpm>
Component: fileAssignee: Daniel Novotny <dnovotny>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: medium    
Version: rawhideCC: dnovotny, ffesti, jnovy, pmatilai, pnasrat, tcallawa
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-10-07 15:01:04 UTC Type: ---
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: 463814    
Attachments:
Description Flags
An XLX file which I think "file" detected correctly, although it's not entirely clear from the output
none
The file which "file" didn't detect correctly
none
a patch none

Description Tim Jackson 2008-09-24 19:05:39 UTC
rpm-build.x86_64 0-4.5.90-0.git8461.7 

When trying to build a firmware package, at least one binary file causes rpmbuild to throw an "assertion failed" error:

magic_file(ms, "/builddir/build/BUILDROOT/alsa-firmware-1.0.17-1.fc10.x86_64/lib/firmware/mixart/miXart8.xlx") failed: mode 100644 DOS executable (device driver)vasprintf failed (Invalid or incomplete multibyte or wide character)

rpmbuild: rpmfc.c:1405: rpmfcClassify: Assertion `ftype != ((void *)0)' failed.

See

http://linux.dell.com/files/fedora/FixBuildRequires/mock-results/x86_64/alsa-firmware-1.0.17-1.fc10.src.rpm/result/build.log

for full build log.

Comment 1 Jindrich Novy 2008-09-24 19:13:33 UTC
This is not a bug or RPM itself but a bug of "file" utility RPM calls to figure out a file type.

The current upstream RPM no more complains with this cryptic assertion error but produces more readable message when detection of file type fails :)

Reassigning to file.

Comment 2 Daniel Novotny 2008-09-25 07:50:56 UTC
Hello Tim,
can you please attach the "xlx" files, that cause the error? The best would be if you can attach one that was recognized correctly and then the "miXart8.xlx" which was incorrectly classified as DOS executable
thanks,
  Daniel

Comment 3 Tim Jackson 2008-09-25 13:46:48 UTC
Created attachment 317687 [details]
An XLX file which I think "file" detected correctly, although it's not entirely clear from the output

Comment 4 Tim Jackson 2008-09-25 13:48:09 UTC
Created attachment 317688 [details]
The file which "file" didn't detect correctly

I believe the attached files will demonstrate it, however I don't have a working F10 alpha build sys at the moment, so these are from a build on F-9 and it's possible they may be somehow different

Comment 5 Panu Matilainen 2008-09-25 14:25:24 UTC
Yup, with file 4.26 built from CVS I get:
[pmatilai@localhost Download]$ file *.xlx
miXart8.xlx:  ERROR: DOS executable (device driver)vasprintf failed (Invalid or incomplete multibyte or wide character)
x1_1_vxp.xlx: data

Comment 6 Daniel Novotny 2008-09-26 11:59:54 UTC
it seems that file(1) has false positive test for a DOS device driver

0       belong  0xffffffff              DOS executable (device driver)

(see /usr/share/magic)

because the file "miXart8.xlx" begins with 0xffffffff

That means I can reproduce the error and analyze it... if you want the compilation to be succesful, try -as a temporarily workaround- comment out the line and recompile magic file...

Another thing: why is the build script dependent on magic in .xlx files? Does anyone know?

Comment 7 Tom "spot" Callaway 2008-09-26 21:33:12 UTC
rpm runs magic_open() on every file in the package manifest, then, performs secondary operations on certain types of files. Because file is blowing up trying to parse these xlx files, rpm bails.

From build/rpmfc.c:

    ms = magic_open(msflags);
    if (ms == NULL) {
        rpmlog(RPMLOG_ERR, _("magic_open(0x%x) failed: %s\n"),
                msflags, strerror(errno));
assert(ms != NULL);     /* XXX figger a proper return path. */
    }

Comment 8 Daniel Novotny 2008-10-06 16:25:27 UTC
(In reply to comment #0)

> http://linux.dell.com/files/fedora/FixBuildRequires/mock-results/x86_64/alsa-firmware-1.0.17-1.fc10.src.rpm/result/build.log
                  ^^^^

reassigning the bug from F9 to F10

Comment 9 Daniel Novotny 2008-10-07 14:55:55 UTC
Created attachment 319651 [details]
a patch

I have changed the magic file in order to define the "DOS executable (device driver)" section more precisely, so file(1) will not crash and will not return negative value to rpmbuild(8)

Comment 10 Daniel Novotny 2008-10-07 15:01:04 UTC
fixed in file-4.26-2.fc10