Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object#clone(freeze: boolean) is not supported (available since 2.4 in MRI) #1454

Closed
deepj opened this issue Nov 6, 2018 · 9 comments
Closed
Assignees
Milestone

Comments

@deepj
Copy link

deepj commented Nov 6, 2018

This is easily reproducible under truffleruby 1.0.0.rc9. Object#clone(freeze: boolean) option is available since Ruby 2.4. See https://ruby-doc.org/core-2.4.0/Object.html#method-i-clone

Truffleruby 1.0.0 claims it's Ruby 2.4 compatible. So this option would be supported as well.

To reproduce:

Object.new.clone(freeze: true)

Error:

ArgumentError: wrong number of arguments (1 for 0)
	from (irb):1:in `clone'
	from (irb):1
	from ~/.rubies/truffleruby-1.0.0-rc9/bin/irb:29:in `<main>'
@deepj deepj changed the title sequel: `clone': wrong number of arguments (1 for 0) (ArgumentError) Object#clone(freeze: true) is not support (available since 2.4 in MRI) Nov 11, 2018
@deepj
Copy link
Author

deepj commented Nov 11, 2018

Just for a record, here is the original report:

Here is a small script requiring running PostgreSQL. The below code failed during a try to create a table using sequel. No problem with Ruby 2.5.3.

# frozen_string_literal: true

require 'bundler/inline'
require 'logger'

gemfile do
  source 'https://rubygems.org'

  gem 'pg',     '1.1.3'
  gem 'sequel', '5.13.0'
end

DATABASE_URL = 'postgres://postgres:postgres@localhost:5432/truffleruby'

logger = Logger.new($stdout)

DB = Sequel.connect(DATABASE_URL, logger: logger)

DB.create_table?(:exchange_rates) do
  Date :date, primary_key: true
  BigDecimal :rate, size: [8, 4]
end

Error:

$ ruby sequel.rb
I, [2018-11-06T20:39:44.613000 #37428]  INFO -- : (0.019131s) SET standard_conforming_strings = ON
I, [2018-11-06T20:39:44.623000 #37428]  INFO -- : (0.002851s) SET client_min_messages = 'WARNING'
I, [2018-11-06T20:39:44.627000 #37428]  INFO -- : (0.001808s) SET DateStyle = 'ISO'
~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/dataset/query.rb:87:in `clone': wrong number of arguments (1 for 0) (ArgumentError)
	from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/dataset/query.rb:87:in `clone'
	from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/dataset/query.rb:263:in `from'
	from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/dataset.rb:64:in `block in from'
	from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/dataset/misc.rb:281:in `cached_dataset'
	from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/dataset.rb:64:in `send'
	from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/dataset.rb:64:in `from'
	from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/query.rb:196:in `table_exists?'
	from ~/.gem/truffleruby/2.4.4/gems/sequel-5.13.0/lib/sequel/database/schema_methods.rb:221:in `create_table?'
	from sequel.rb:19:in `<main>'

@deepj
Copy link
Author

deepj commented Nov 11, 2018

@eregon @chrisseaton I isolated the problem mentioned above.

@deepj deepj changed the title Object#clone(freeze: true) is not support (available since 2.4 in MRI) Object#clone(freeze: true) is not supported (available since 2.4 in MRI) Nov 11, 2018
@deepj deepj changed the title Object#clone(freeze: true) is not supported (available since 2.4 in MRI) Object#clone(freeze: boolean) is not supported (available since 2.4 in MRI) Nov 11, 2018
@eregon eregon added the bug label Nov 12, 2018
@deepj
Copy link
Author

deepj commented Nov 14, 2018

@eregon I don't want to push on this. This is just a question and I realize you Truffleruby team has own priorities. But I'd like to ask if this can be solved in RC10 release if possible. I'd like to explore more stuff around sequel but this seems to be the major blocker.

@chrisseaton
Copy link
Collaborator

It should be easy to fix - we'll try today.

@chrisseaton chrisseaton self-assigned this Nov 14, 2018
@chrisseaton
Copy link
Collaborator

This is a bit trickier than I thought, because #clone is implemented in Java and we don't support these keyword arguments in Java code.

@chrisseaton
Copy link
Collaborator

I think I've got a good fix.

@chrisseaton
Copy link
Collaborator

That's implemented now and will be in the next release. Thanks for the report. Priortising these issues is very useful to us, so if you have a next one you think is most important, comment on it.

Do you know how to build from source in order to test our fixes?

@deepj
Copy link
Author

deepj commented Nov 15, 2018

@chrisseaton I saw https://github.com/oracle/truffleruby/blob/master/doc/contributor/workflow.md But it seems to be a bit complicated. I wanted to create something like truffleruby-dev for ruby-build (where I contribute frequently). Because of the complicated building process I gave up it. I'd appreciate some binary release when I could use chruby/ruby-build. Have you though of building some kind of nightly builds of Truffleruby? Then it would be easy to add to ruby-build and have something like truffleruby-dev.

Anyway, are there some easy steps how to build it on macOS?

@deepj
Copy link
Author

deepj commented Nov 15, 2018

@chrisseaton I've pointed several issues on which would be interesting to take a look at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants