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

Regression(?) in String#% from 9.1.7.0 to 9.1.8.0 #4542

Closed
mwpastore opened this issue Mar 23, 2017 · 3 comments
Closed

Regression(?) in String#% from 9.1.7.0 to 9.1.8.0 #4542

mwpastore opened this issue Mar 23, 2017 · 3 comments

Comments

@mwpastore
Copy link

Environment

Darwin poseidon.local 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64

Expected Behavior

jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae Java HotSpot(TM) 64-Bit Server VM 25.51-b03 on 1.8.0_51-b16 +jit [darwin-x86_64]
irb(main):001:0> '%<adapter>s://%<host>s/%<database>s?user=%<user>s&password=%<password>s' % {:adapter=>"jdbc:postgresql", :host=>"TFB-database", :database=>"hello_world", :user=>"benchmarkdbuser", :password=>"benchmarkdbpass"}
=> "jdbc:postgresql://TFB-database/hello_world?user=benchmarkdbuser&password=benchmarkdbpass"

Actual Behavior

jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.51-b03 on 1.8.0_51-b16 +jit [darwin-x86_64]
irb(main):001:0> '%<adapter>s://%<host>s/%<database>s?user=%<user>s&password=%<password>s' % {:adapter=>"jdbc:postgresql", :host=>"TFB-database", :database=>"hello_world", :user=>"benchmarkdbuser", :password=>"benchmarkdbpass"}
ArgumentError: name<host> after <adapter>
	from org/jruby/RubyString.java:1191:in `%'
	from (irb):1:in `<eval>'
	from org/jruby/RubyKernel.java:1000:in `eval'
	from org/jruby/RubyKernel.java:1298:in `loop'
	from org/jruby/RubyKernel.java:1120:in `catch'
	from org/jruby/RubyKernel.java:1120:in `catch'
	from /Users/mwp/.rbenv/versions/jruby-9.1.8.0/bin/irb:13:in `<main>'
@mwpastore
Copy link
Author

Kernel.sprintf suffers from the same regression.

Using the format-less %{ .. } syntax (instead of %< .. >s) seems to work around the issue in both cases.

mwpastore added a commit to mwpastore/FrameworkBenchmarks that referenced this issue Mar 23, 2017
...and work-around a regression in JRuby's String#% and Kernel.sprintf
(jruby/jruby#4542).
NateBrady23 pushed a commit to TechEmpower/FrameworkBenchmarks that referenced this issue Mar 23, 2017
* [Ruby] Fix TorqueBox benchmark descriptions

* [Ruby] Update MRI 2.4 and JRuby 9.1 versions

...and work-around a regression in JRuby's String#% and Kernel.sprintf
(jruby/jruby#4542).
@enebo enebo added this to the JRuby 9.1.9.0 milestone Mar 23, 2017
@enebo
Copy link
Member

enebo commented Mar 23, 2017

Several commits since 9.1.8.0 have fixed all known %/sprintf bugs (except one negative value with %u issue). This particular case is working as expected. 9.1.9.0 in a week or so...

@enebo enebo closed this as completed Mar 23, 2017
@mwpastore
Copy link
Author

Great! Thank you.

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

2 participants