choroba has asked for the wisdom of the Perl Monks concerning the following question:

My June assignment for The CPAN Pull Request Challenge is File::LibMagic. The module fails exclusively on OpenBSD, and the test suite never passes on it. The problem seems to be the same every time:
# Failed test 'got expected info for symlink to PDF' # at t/constructor-params.t line 27. # Structures begin differing at: # $got->{mime_with_encoding} = 'application/pdf; charset=unkn +own' # $expected->{mime_with_encoding} = 'application/pdf; charset=bina +ry'

Is it just a difference between libmagic on OpenBSD and other systems? If so, could the test be fixed with

my $encoding = 'openbsd' eq $^O ? 'unknown' : 'binary'; is_deeply( $info, { description => 'PDF document, version 1.4', mime_type => 'application/pdf', encoding => $encoding, mime_with_encoding => 'application/pdf; charset=' . $encod +ing, }, 'got expected info for symlink to PDF' );

Or is the encoding of a PDF something that could break dependent code?

Bonus points

Some of the tests also end prematurely

error calling magic_file: zlib: (null) at /home/cpan/pit/bare/conf/per +l-5.12.4/.cpanplus/5.12.4/build/File-LibMagic-1.12/blib/lib/File/LibM +agic.pm line 107. # Tests were run but no plan was declared and done_testing() was not s +een. # Looks like your test exited with 79 just after 2.

Again, does it mean that zlib on OpenBSD isn't installed by default, unlike other OSes? How could one solve the problem?

Answers from OpenBSD users most welcome.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re: File::LibMagic's tests fail on OpenBSD
by Anonymous Monk on Jun 23, 2015 at 23:53 UTC

    I'm sure the solution is to distribute libmagic with File::LibMagic and not rely on the systems libmagic

    But I'm also sure that solution is missing some point

    Good luck :)

Re: File::LibMagic's tests fail on OpenBSD
by ryanc (Monk) on Jun 25, 2015 at 21:51 UTC