rom-sql: Sequel 5 RuntimeError

This commit in Sequel version 5 changes Sequel::SQL::Expression.to_s_method by freezing @comparison_attrs and causing a RuntimeError with the message “can’t modify frozen Array” when using the master branch.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

In my case this issue happened because sequel/sql was loaded twice

  1. the first time in sequel/core
 require_relative "sql"
  1. and the second time in rom/sql/types:
require 'sequel/sql'

When sequel/sql is loaded the second time, something like this happens: Sequel::SQL::Expression.attr_reader([].freeze) -> [].freeze.concat [:comparison_attrs] -> RuntimeError: can’t modify frozen Array

The reason why sequel/sql is loaded twice is because require and require_relative behave differently: require_relative uses real path without symlinks and require does not. If you install rbenv or asdf via Homebrew then everything is stored in /usr/local/Cellar/x/1.2.3 and symlinked to /usr/local/opt/x, which explains this issue.

This bug has been fixed in Ruby recently, please see https://bugs.ruby-lang.org/issues/10222

@flash-gordon and @solnic, I am glad to say I have managed to narrow the runtime error down to Rbenv version 1.1.0. I haven’t worked out what was causing it, but it is fixed in the latest release v1.1.1.