kwilczynski / ruby-magic

Simple interface to libmagic for Ruby Programming Language
Apache License 2.0
27 stars 8 forks source link

Fix regression with file/libmagic 5.44 #38

Closed cbiedl closed 1 year ago

cbiedl commented 1 year ago

The file package changed the FILE_BYTES_MAX value in the last release 5.44, this breaks the test suite, see Debian#1026988 https://bugs.debian.org/1026988. This trivial patch fixes the issue:

--- a/test/test_magic.rb
+++ b/test/test_magic.rb
@@ -205,7 +205,7 @@
   end

   def test_magic_get_parameter_with_PARAM_BYTES_MAX
-    assert_equal(1024 * 1024, @magic.get_parameter(Magic::PARAM_BYTES_MAX))
+    assert_equal(1024 * 1024 * 7, @magic.get_parameter(Magic::PARAM_BYTES_MAX))
   end

   def test_magic_get_parameter_lower_boundary
kwilczynski commented 1 year ago

Hi @cbiedl, thank you for getting in touch!

I am aware of this change, as per: https://github.com/file/file/commit/d2659ae455c7df7e8c6355dfaaea1180236a2932

However, this is something that I disagree with, and I need to take this up with Christos. This is nonsensical and increases the memory footprint of libmagic for no good reason whatsoever. That said, I will fix this in the meantime.

Sorry for the trouble!

kwilczynski commented 1 year ago

@cbiedl, should be fixed via https://github.com/kwilczynski/ruby-magic/commit/bc1db5b7c06f516847346b0e362cffa5e6ae5573.

Hopefully, this will also fix the failures you see in Debian's CI pipeline.

Again, sorry for the trouble!

kwilczynski commented 1 year ago

@cbiedl, I am going to close this issue now, but feel free to re-open if needed!

Thank you again!