Skip Menu |

This queue is for tickets about the File-MMagic-XS CPAN distribution.

Report information
The Basics
Id: 94570
Status: open
Priority: 0/
Queue: File-MMagic-XS

People
Owner: Nobody in particular
Requestors: TODDR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.09007
Fixed in: (no value)



Subject: 0.09007 breaks 100% of tests
This appears to be a result of changes to the lib/File/MMagic/magic file without updating tests? t/001_load.t .............. ok t/002_runthrough.t ........ 1/35 # Failed test 't/data/test.rtf: expected application/rtf' # at t/002_runthrough.t line 28. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from fhmagic' # at t/002_runthrough.t line 31. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from bufmagic' # at t/002_runthrough.t line 36. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/002_runthrough.t: expected text/plain' # at t/002_runthrough.t line 28. # got: undef # expected: 'text/plain' # Failed test 't/002_runthrough.t: expected text/plain from fhmagic' # at t/002_runthrough.t line 31. # got: undef # expected: 'text/plain' # Failed test 't/002_runthrough.t: expected text/plain from bufmagic' # at t/002_runthrough.t line 36. # got: undef # expected: 'text/plain' # Failed test 't/002_runthrough.t: expected text/plain from ascmagic' # at t/002_runthrough.t line 38. # got: undef # expected: 'text/plain' # Failed test 't/data/test.xml: expected text/xml' # at t/002_runthrough.t line 28. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from fhmagic' # at t/002_runthrough.t line 31. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from bufmagic' # at t/002_runthrough.t line 36. # got: '' # expected: 'text/xml' # Failed test 't/data/test.rtf: expected application/rtf' # at t/002_runthrough.t line 28. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from fhmagic' # at t/002_runthrough.t line 31. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from bufmagic' # at t/002_runthrough.t line 36. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/002_runthrough.t: expected text/plain' # at t/002_runthrough.t line 28. # got: undef # expected: 'text/plain' # Failed test 't/002_runthrough.t: expected text/plain from fhmagic' # at t/002_runthrough.t line 31. # got: undef # expected: 'text/plain' # Failed test 't/002_runthrough.t: expected text/plain from bufmagic' # at t/002_runthrough.t line 36. # got: undef # expected: 'text/plain' # Failed test 't/002_runthrough.t: expected text/plain from ascmagic' # at t/002_runthrough.t line 38. # got: undef # expected: 'text/plain' # Failed test 't/data/test.xml: expected text/xml' # at t/002_runthrough.t line 28. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from fhmagic' # at t/002_runthrough.t line 31. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from bufmagic' # at t/002_runthrough.t line 36. # got: '' # expected: 'text/xml' # Looks like you failed 20 tests of 35. t/002_runthrough.t ........ Dubious, test returned 20 (wstat 5120, 0x1400) Failed 20/35 subtests t/003_error.t ............. ok t/004_slurp.t ............. ok t/005_clone.t ............. 1/49 # Failed test 't/data/test.rtf: expected application/rtf' # at t/005_clone.t line 42. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from fhmagic' # at t/005_clone.t line 45. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from bufmagic' # at t/005_clone.t line 50. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/005_clone.t: expected text/plain' # at t/005_clone.t line 42. # got: undef # expected: 'text/plain' # Failed test 't/005_clone.t: expected text/plain from fhmagic' # at t/005_clone.t line 45. # got: undef # expected: 'text/plain' # Failed test 't/005_clone.t: expected text/plain from bufmagic' # at t/005_clone.t line 50. # got: undef # expected: 'text/plain' # Failed test 't/data/test.xml: expected text/xml' # at t/005_clone.t line 42. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from fhmagic' # at t/005_clone.t line 45. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from bufmagic' # at t/005_clone.t line 50. # got: '' # expected: 'text/xml' # Failed test 't/data/test.rtf: expected application/rtf' # at t/005_clone.t line 42. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from fhmagic' # at t/005_clone.t line 45. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from bufmagic' # at t/005_clone.t line 50. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/005_clone.t: expected text/plain' # at t/005_clone.t line 42. # got: undef # expected: 'text/plain' # Failed test 't/005_clone.t: expected text/plain from fhmagic' # at t/005_clone.t line 45. # got: undef # expected: 'text/plain' # Failed test 't/005_clone.t: expected text/plain from bufmagic' # at t/005_clone.t line 50. # got: undef # expected: 'text/plain' # Failed test 't/data/test.xml: expected text/xml' # at t/005_clone.t line 42. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from fhmagic' # at t/005_clone.t line 45. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from bufmagic' # at t/005_clone.t line 50. # got: '' # expected: 'text/xml' # Failed test 't/data/test.rtf: expected application/rtf' # at t/005_clone.t line 42. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from fhmagic' # at t/005_clone.t line 45. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from bufmagic' # at t/005_clone.t line 50. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/005_clone.t: expected text/plain' # at t/005_clone.t line 42. # got: undef # expected: 'text/plain' # Failed test 't/005_clone.t: expected text/plain from fhmagic' # at t/005_clone.t line 45. # got: undef # expected: 'text/plain' # Failed test 't/005_clone.t: expected text/plain from bufmagic' # at t/005_clone.t line 50. # got: undef # expected: 'text/plain' # Failed test 't/data/test.xml: expected text/xml' # at t/005_clone.t line 42. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from fhmagic' # at t/005_clone.t line 45. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from bufmagic' # at t/005_clone.t line 50. # got: '' # expected: 'text/xml' # Failed test 't/data/test.rtf: expected application/rtf' # at t/005_clone.t line 42. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from fhmagic' # at t/005_clone.t line 45. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/data/test.rtf: expected application/rtf from bufmagic' # at t/005_clone.t line 50. # got: 'text/rtf' # expected: 'application/rtf' # Failed test 't/005_clone.t: expected text/plain' # at t/005_clone.t line 42. # got: undef # expected: 'text/plain' # Failed test 't/005_clone.t: expected text/plain from fhmagic' # at t/005_clone.t line 45. # got: undef # expected: 'text/plain' # Failed test 't/005_clone.t: expected text/plain from bufmagic' # at t/005_clone.t line 50. # got: undef # expected: 'text/plain' # Failed test 't/data/test.xml: expected text/xml' # at t/005_clone.t line 42. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from fhmagic' # at t/005_clone.t line 45. # got: '' # expected: 'text/xml' # Failed test 't/data/test.xml: expected text/xml from bufmagic' # at t/005_clone.t line 50. # got: '' # expected: 'text/xml' # Looks like you failed 36 tests of 49. t/005_clone.t ............. Dubious, test returned 36 (wstat 9216, 0x2400) Failed 36/49 subtests t/100_compat_selfcheck.t .. 1/2 # Failed test 'mime should be 'text/plain'. got ' # at t/100_compat_selfcheck.t line 14. # got: undef # expected: 'text/plain' # Looks like you failed 1 test of 2. t/100_compat_selfcheck.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests t/101_compat_extmagic.t ... ok Test Summary Report ------------------- t/002_runthrough.t (Wstat: 5120 Tests: 35 Failed: 20) Failed tests: 2, 4-5, 7, 9-12, 14-15, 19, 21-22, 24, 26-29 31-32 Non-zero exit status: 20 t/005_clone.t (Wstat: 9216 Tests: 49 Failed: 36) Failed tests: 2, 4-6, 8-10, 12-14, 16-18, 20-22, 24-26 28-30, 32-34, 36-38, 40-42, 44-46, 48-49 Non-zero exit status: 36 t/100_compat_selfcheck.t (Wstat: 256 Tests: 2 Failed: 1) Failed test: 2 Non-zero exit status: 1 Files=7, Tests=95, 1 wallclock secs ( 0.12 usr 0.04 sys + 0.39 cusr 0.07 csys = 0.62 CPU) Result: FAIL Failed 3/7 test programs. 57/95 subtests failed.
included to that answer, a potential patch to solve these issues need to fix the file lib/File/MMagic/magic for xml and application rtf in fmm_append_buf we forgot to copy the mime type in fmm_ascmagic, replace the switch by a simple if and flag as ok when mime type is ascii do not use each in t/002_runthrough.t On Wed Apr 09 13:14:02 2014, TODDR wrote: Show quoted text
> This appears to be a result of changes to the lib/File/MMagic/magic > file without updating tests? > t/001_load.t .............. ok > t/002_runthrough.t ........ 1/35 > # Failed test 't/data/test.rtf: expected application/rtf' > # at t/002_runthrough.t line 28. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > fhmagic' > # at t/002_runthrough.t line 31. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > bufmagic' > # at t/002_runthrough.t line 36. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/002_runthrough.t: expected text/plain' > # at t/002_runthrough.t line 28. > # got: undef > # expected: 'text/plain' > > # Failed test 't/002_runthrough.t: expected text/plain from fhmagic' > # at t/002_runthrough.t line 31. > # got: undef > # expected: 'text/plain' > > # Failed test 't/002_runthrough.t: expected text/plain from > bufmagic' > # at t/002_runthrough.t line 36. > # got: undef > # expected: 'text/plain' > > # Failed test 't/002_runthrough.t: expected text/plain from > ascmagic' > # at t/002_runthrough.t line 38. > # got: undef > # expected: 'text/plain' > > # Failed test 't/data/test.xml: expected text/xml' > # at t/002_runthrough.t line 28. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from fhmagic' > # at t/002_runthrough.t line 31. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from bufmagic' > # at t/002_runthrough.t line 36. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.rtf: expected application/rtf' > # at t/002_runthrough.t line 28. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > fhmagic' > # at t/002_runthrough.t line 31. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > bufmagic' > # at t/002_runthrough.t line 36. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/002_runthrough.t: expected text/plain' > # at t/002_runthrough.t line 28. > # got: undef > # expected: 'text/plain' > > # Failed test 't/002_runthrough.t: expected text/plain from fhmagic' > # at t/002_runthrough.t line 31. > # got: undef > # expected: 'text/plain' > > # Failed test 't/002_runthrough.t: expected text/plain from > bufmagic' > # at t/002_runthrough.t line 36. > # got: undef > # expected: 'text/plain' > > # Failed test 't/002_runthrough.t: expected text/plain from > ascmagic' > # at t/002_runthrough.t line 38. > # got: undef > # expected: 'text/plain' > > # Failed test 't/data/test.xml: expected text/xml' > # at t/002_runthrough.t line 28. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from fhmagic' > # at t/002_runthrough.t line 31. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from bufmagic' > # at t/002_runthrough.t line 36. > # got: '' > # expected: 'text/xml' > # Looks like you failed 20 tests of 35. > t/002_runthrough.t ........ Dubious, test returned 20 (wstat 5120, > 0x1400) > Failed 20/35 subtests > t/003_error.t ............. ok > t/004_slurp.t ............. ok > t/005_clone.t ............. 1/49 > # Failed test 't/data/test.rtf: expected application/rtf' > # at t/005_clone.t line 42. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > fhmagic' > # at t/005_clone.t line 45. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > bufmagic' > # at t/005_clone.t line 50. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/005_clone.t: expected text/plain' > # at t/005_clone.t line 42. > # got: undef > # expected: 'text/plain' > > # Failed test 't/005_clone.t: expected text/plain from fhmagic' > # at t/005_clone.t line 45. > # got: undef > # expected: 'text/plain' > > # Failed test 't/005_clone.t: expected text/plain from bufmagic' > # at t/005_clone.t line 50. > # got: undef > # expected: 'text/plain' > > # Failed test 't/data/test.xml: expected text/xml' > # at t/005_clone.t line 42. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from fhmagic' > # at t/005_clone.t line 45. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from bufmagic' > # at t/005_clone.t line 50. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.rtf: expected application/rtf' > # at t/005_clone.t line 42. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > fhmagic' > # at t/005_clone.t line 45. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > bufmagic' > # at t/005_clone.t line 50. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/005_clone.t: expected text/plain' > # at t/005_clone.t line 42. > # got: undef > # expected: 'text/plain' > > # Failed test 't/005_clone.t: expected text/plain from fhmagic' > # at t/005_clone.t line 45. > # got: undef > # expected: 'text/plain' > > # Failed test 't/005_clone.t: expected text/plain from bufmagic' > # at t/005_clone.t line 50. > # got: undef > # expected: 'text/plain' > > # Failed test 't/data/test.xml: expected text/xml' > # at t/005_clone.t line 42. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from fhmagic' > # at t/005_clone.t line 45. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from bufmagic' > # at t/005_clone.t line 50. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.rtf: expected application/rtf' > # at t/005_clone.t line 42. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > fhmagic' > # at t/005_clone.t line 45. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > bufmagic' > # at t/005_clone.t line 50. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/005_clone.t: expected text/plain' > # at t/005_clone.t line 42. > # got: undef > # expected: 'text/plain' > > # Failed test 't/005_clone.t: expected text/plain from fhmagic' > # at t/005_clone.t line 45. > # got: undef > # expected: 'text/plain' > > # Failed test 't/005_clone.t: expected text/plain from bufmagic' > # at t/005_clone.t line 50. > # got: undef > # expected: 'text/plain' > > # Failed test 't/data/test.xml: expected text/xml' > # at t/005_clone.t line 42. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from fhmagic' > # at t/005_clone.t line 45. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from bufmagic' > # at t/005_clone.t line 50. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.rtf: expected application/rtf' > # at t/005_clone.t line 42. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > fhmagic' > # at t/005_clone.t line 45. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/data/test.rtf: expected application/rtf from > bufmagic' > # at t/005_clone.t line 50. > # got: 'text/rtf' > # expected: 'application/rtf' > > # Failed test 't/005_clone.t: expected text/plain' > # at t/005_clone.t line 42. > # got: undef > # expected: 'text/plain' > > # Failed test 't/005_clone.t: expected text/plain from fhmagic' > # at t/005_clone.t line 45. > # got: undef > # expected: 'text/plain' > > # Failed test 't/005_clone.t: expected text/plain from bufmagic' > # at t/005_clone.t line 50. > # got: undef > # expected: 'text/plain' > > # Failed test 't/data/test.xml: expected text/xml' > # at t/005_clone.t line 42. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from fhmagic' > # at t/005_clone.t line 45. > # got: '' > # expected: 'text/xml' > > # Failed test 't/data/test.xml: expected text/xml from bufmagic' > # at t/005_clone.t line 50. > # got: '' > # expected: 'text/xml' > # Looks like you failed 36 tests of 49. > t/005_clone.t ............. Dubious, test returned 36 (wstat 9216, > 0x2400) > Failed 36/49 subtests > t/100_compat_selfcheck.t .. 1/2 > # Failed test 'mime should be 'text/plain'. got ' > # at t/100_compat_selfcheck.t line 14. > # got: undef > # expected: 'text/plain' > # Looks like you failed 1 test of 2. > t/100_compat_selfcheck.t .. Dubious, test returned 1 (wstat 256, > 0x100) > Failed 1/2 subtests > t/101_compat_extmagic.t ... ok > > Test Summary Report > ------------------- > t/002_runthrough.t (Wstat: 5120 Tests: 35 Failed: 20) > Failed tests: 2, 4-5, 7, 9-12, 14-15, 19, 21-22, 24, 26-29 > 31-32 > Non-zero exit status: 20 > t/005_clone.t (Wstat: 9216 Tests: 49 Failed: 36) > Failed tests: 2, 4-6, 8-10, 12-14, 16-18, 20-22, 24-26 > 28-30, 32-34, 36-38, 40-42, 44-46, 48-49 > Non-zero exit status: 36 > t/100_compat_selfcheck.t (Wstat: 256 Tests: 2 Failed: 1) > Failed test: 2 > Non-zero exit status: 1 > Files=7, Tests=95, 1 wallclock secs ( 0.12 usr 0.04 sys + 0.39 cusr > 0.07 csys = 0.62 CPU) > Result: FAIL > Failed 3/7 test programs. 57/95 subtests failed.
Subject: 0001-RT-ticket-94570.patch
From 6749991f0dabfdab31331f20d5794de5da6afcd7 Mon Sep 17 00:00:00 2001 From: Nicolas Rochelemagne <nicolas.rochelemagne@cpanel.net> Date: Wed, 9 Apr 2014 19:48:33 -0600 Subject: [PATCH] RT ticket 94570: fix unit tests and adjust magic file for xml files --- lib/File/MMagic/magic | 10 ++++------ src/perl-mmagic-xs.c | 24 ++++++++++++------------ t/002_runthrough.t | 10 ++++++---- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/File/MMagic/magic b/lib/File/MMagic/magic index cdf9ac5..02a81a9 100644 --- a/lib/File/MMagic/magic +++ b/lib/File/MMagic/magic @@ -99,14 +99,13 @@ # svg -0 string \<?xml +#0 string \<?xml # text/xml ->38 string \<\!DOCTYPE\040svg image/svg+xml +>38 string \<\!DOCTYPE\040svg image/svg+xml # xml -0 string \<?xml text/xml - +0 string \<?xml text/xml #------------------------------------------------------------------------------ # Java @@ -581,7 +580,7 @@ 0 leshort 0x02f7 application/x-dvi # RTF - Rich Text Format -0 string {\\rtf text/rtf +0 string {\\rtf application/rtf #------------------------------------------------------------------------------ # animation: file(1) magic for animation/movie formats @@ -932,4 +931,3 @@ # This entry is only semi-helpful, as Gnumeric compresses its files, so # they will ordinarily reported as "compressed", but at least -z helps 39 string =<gmr:Workbook application/x-gnumeric - diff --git a/src/perl-mmagic-xs.c b/src/perl-mmagic-xs.c index 3ba631f..9442c54 100644 --- a/src/perl-mmagic-xs.c +++ b/src/perl-mmagic-xs.c @@ -358,6 +358,8 @@ fmm_append_buf(PerlFMM *state, char **dst, char *str, ...) char buf[MAXMIMESTRING]; SV *err; + strcpy( buf, str ); + va_start(ap, str); vsnprintf(buf, sizeof(buf), str, ap); va_end(ap); @@ -611,7 +613,7 @@ fmm_append_mime(PerlFMM *state, char **buf, union VALUETYPE *p, fmmagic *m) break; case STRING: if (m->reln == '=') { - fmm_append_buf(state, buf, m->desc, m->value.s); + fmm_append_buf(state, buf, m->desc, m->value.s ); } else { fmm_append_buf(state, buf, m->desc, p->s); } @@ -1302,20 +1304,17 @@ fmm_ascmagic(unsigned char *buf, size_t nbytes, char **mime_type) } } - switch (is_tar(buf, nbytes)) { - case 1: - /* V7 tar archive */ - strcpy(*mime_type, "application/x-tar"); - return 0; - case 2: - /* POSIX tar archive */ - strcpy(*mime_type, "application/x-tar"); - return 0; + int is_tarball = is_tar(buf, nbytes); + if ( is_tarball == 1 || is_tarball == 2 ) { + /* 1: V7 tar archive */ + /* 2: POSIX tar archive */ + strcpy(*mime_type, "application/x-tar"); + return 0; } /* all else fails, but it is ascii... */ strcpy(*mime_type, "text/plain"); - return 1; + return 0; } static int @@ -1412,10 +1411,11 @@ fmm_bufmagic(PerlFMM *state, unsigned char **buffer, char **mime_type) if (fmm_ascmagic(*buffer, HOWMANY, mime_type) == 0) { #ifdef FMM_DEBUG - PerlIO_printf(PerlIO_stder(), "[fmm_bufmagic]: fmm_ascmagic returns 0\n"); + PerlIO_printf(PerlIO_stderr(), "[fmm_bufmagic]: fmm_ascmagic returns 0\n"); #endif return 0; } + return 1; } diff --git a/t/002_runthrough.t b/t/002_runthrough.t index f718c29..3f81b14 100644 --- a/t/002_runthrough.t +++ b/t/002_runthrough.t @@ -23,12 +23,14 @@ foreach my $eol (undef, "\0") { local $/ = $eol; my $fm = File::MMagic::XS->new; - while (my($file, $mime) = each %map) { - my $got = $fm->get_mime($file); - is($got, $mime, "$file: expected $mime"); + foreach my $file (keys %map) { + + my $mime = $map{$file}; + my $got = $fm->get_mime($file); + is($got, $mime, "$file: expected $mime") or die; ok(open(F, $file), "ok to open $file"); - is($fm->fhmagic(\*F), $mime, "$file: expected $mime from fhmagic"); + is($fm->fhmagic(\*F), $mime, "$file: expected $mime from fhmagic") or die; seek(F, 0, 0); my $buf = do { local $/ = undef; <F> }; -- 1.8.5.2 (Apple Git-48)
Thank you, I was just looking at it this morning, but hadn't had the time to properly diagnose it yet. I will probably have time to check it out within the next few hours.
Just uploaded 0.09008