7

What happened to mimemagic? @rails activerecord depends on @basecamp marcel which depends on mimemagic 0.3.2. Now that mimemagic 0.3.2 has been yanked, what is the way forward?

razvans
  • 1,190
  • 3
  • 15
  • 18

7 Answers7

4

Note: upgrading to Mimemagic 0.3.8 is still under GPL-2.0 license which may not be desirable under all circumstances.

I ran into this today and here's what I ended up doing to fix the issue
(I'm on a MBP Catalina 10.15.7)

Step 1: update Gemfile.lock to mimemagic 0.3.8 by running

  $ brew install shared-mime-info
  $ bundle update mimemagic

(Be sure the system you're deploying to has the proper libraries installed).

✅ Mimemagic issue solved thanks to this comment

Step 2: Upgrade yarn packages
when I did this, it updated everything in homebrew so when I went to restart my server, I received the

  Your Yarn packages are out of date!
  Please run `yarn install` to update.

but, running $yarn install gave me the error:

  dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.67.dylib
  Referenced from: /usr/local/bin/node

and

  yarn check v1.22.10
  warning Integrity check: System parameters don't match
  error Integrity check failed
  error Found 1 errors.

Finally fixed yarn issues by running

   $ yarn --update-checksums

Yarn Issue solved (thanks to this blog post )

Step 3 Last, brew also updated my Postgresql from 12 to 13.2 so I received the

  PG::ConnectionBad - could not connect to server: No such file or directory
  Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

No PID to remove, stopping and restarting, unloading and reloading, launch ctl didn't work... finally, this worked check postgres.log by running

  $ tail -n 10 /usr/local/var/log/postgres.log 

last line shows:

 FATAL:  database files are incompatible with server
 DETAIL:  The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 13.2.

Fixed with:

  $ brew postgresql-upgrade-database

Last, postgres db upgrade fixed thanks to this post

ea0723
  • 625
  • 7
  • 20
3

The gem author has pulled all versions due the gem itself violating the GPL license requirements. Currently there's people working solutions to make a MIT compatible solution or to work around the dependencies.

Discussion: https://github.com/rails/rails/issues/41750

codingbunny
  • 3,809
  • 6
  • 24
  • 53
1

hard coded gem reference for a workaround here

Fdwillis
  • 960
  • 8
  • 20
1

You can get the gem back. The gem binary built might have been removed but the commit ref of each release still there. You can ref to the gem with the github commit ref like this:

# 0.3.2
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '3543363026121ee28d98dfce4cb6366980c055ee'

for other commit ref you can see this link:

https://github.com/mimemagicrb/mimemagic/commits/0.3?after=22c06826417ed67c02b94ebc9998c24da5a03c56+69&branch=0.3

channa ly
  • 7,062
  • 13
  • 44
  • 70
0

Fixed this by just updating mimemagic version to 0.3.6 my Gemfile.lock

  • 1
    Note that this is NOT a good solution for most people. That version back port is licensed under GPL, meaning any of your code must also be GPL. GPL requires all source code derived on it to be open source, something that will not work for a vast majority of rails projects, likely including your own. – Ethan Z Mar 25 '21 at 13:03
  • It could be okay if you don't distribute the source code, e.g. a SaaS product source code is not distributed but accessed via a network. https://resources.whitesourcesoftware.com/blog-whitesource/the-saas-loophole-in-gpl-open-source-licenses – Kris Mar 25 '21 at 15:43
0

Please install shared-mime-info and add FREEDESKTOP_MIME_TYPES_PATH in your environment. if you use windows or linux, please download from https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/0440063a2e6823a4b1a6fb2f2af8350f/shared-mime-info-2.0.tar.xz and extract it

Phuc TC
  • 11
  • 1
  • 2
0

Rails team has posted a patch update that remove the mimemagic dependency. The Marcel library now uses Apache Tika, released under the permissive and compatible Apache License 2.0

Read more at: https://weblog.rubyonrails.org/2021/3/26/marcel-upgrade-releases/