kwilczynski / ruby-magic

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

Vendor libmagic source code? #1

Closed ghost closed 3 years ago

ghost commented 9 years ago

This would be wonderful! CentOS 6,7,... / RHEL 6,7 do not provide a source rpm for that. So the magic.h needs to be added manually.

kwilczynski commented 9 years ago

@dg-ratiodata definitely! It's on my list of things to do, I will move it as priority then!

Meanwhile, did you try installing file-devel? If I recall correctly, it should have libmagic headers.

ghost commented 9 years ago

Oh... I looked for file-libs-devel. I was not aware of file-devel. I will try that. Thanks for the hint. :smile:

kwilczynski commented 9 years ago

@dg-ratiodata no worries :) I hope it will work for you.

kwilczynski commented 8 years ago

@dg-ratiodata sorry for the delay! It's been a while. I will be looking into vendoring now. It needs figuring out, since libmagic needs to be decoupled from file, so might be a bit of a manual work there to separate the two.

kwilczynski commented 7 years ago

It has taken a while for me to find the time to look into vendoring libmagic, but I think the same approach that Nokogiri has would work here. Especially, since I need to ship patches too, as libmagic was a bit broken in the past. So, a healthy look at https://github.com/flavorjones/mini_portile makes me think, that it would be the way to go.

stanhu commented 3 years ago

To unblock our pipelines, I did this: https://gitlab.com/gitlab-org/ruby-magic/-/merge_requests/1

It's available as https://rubygems.org/gems/ruby-magic-static at the moment, but if you're okay with vendoring in this manner, I'm happy to submit a pull request here so it can be maintained upstream.

kwilczynski commented 3 years ago

Hi @stanhu, thank you for working on this!

I don't mind, and in the past I've been planning to add support for mini_portile similarly to how Nokogiri does it at the moment vendoring its dependencies such as e.g., libxml, libzlib, etc.

Your work in the commit 8787495974021e93adbed0a8dafc26d22629be86 is a huge step closer to proper vendoring, thank you for that!

Krzysztof

stanhu commented 3 years ago

@kwilczynski Thanks for the quick response! I submitted #3.

More context for your reading pleasure:

  1. https://gitlab.com/gitlab-org/gitlab/-/issues/325851
  2. https://github.com/rails/rails/issues/41750#issuecomment-805977682
kwilczynski commented 3 years ago

Hi @stanhu, no worries!

I did seen the calamity unfolding as people were commenting and discussing a lot on Twitter. I am very sorry that this license change and then subsequent deprecation of the mimemagic Ruby Gem affected so many people.

I only hope that ruby-magic has the functionality you require, and it's reasonably trouble free for you. If there are some problems or issues, I am going to try to address everything quickly. I actually never expected that anyone would be interested in looking at this particular implementation I matain, especially since there are potentially many others out there (and some do not require any external libraries to link against or even the need to compile anything at the installation time).

Krzysztof

kwilczynski commented 3 years ago

I will allow myself to mention @georgeclaghorn and @jhawthorn for visibility.