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

format and sprintf do not support '%a' and '%A' #5122

Open
ericldelaney opened this issue Mar 28, 2018 · 3 comments · May be fixed by #7612
Open

format and sprintf do not support '%a' and '%A' #5122

ericldelaney opened this issue Mar 28, 2018 · 3 comments · May be fixed by #7612
Labels

Comments

@ericldelaney
Copy link

ericldelaney commented Mar 28, 2018

Environment

Provide at least:

  • jruby 9.1.15.0 (2.3.3) 2017-12-07 929fde8 Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [darwin-x86_64]
  • MacOS

Expected Behavior

$ $HOME/.rbenv/versions/2.2.8/bin/ruby --version
ruby 2.2.8p477 (2017-09-14 revision 59906) [x86_64-darwin17]
$ $HOME/.rbenv/versions/2.2.8/bin/ruby -e 'puts Kernel.format("%A", 0.1)'
0X1.999999999999AP-4
$ $HOME/.rbenv/versions/2.2.8/bin/ruby -e 'puts Kernel.sprintf("%A", 0.1)'
0X1.999999999999AP-4
$ $HOME/.rbenv/versions/2.2.8/bin/ruby -e 'puts Kernel.format("%a", 0.1)'
0x1.999999999999ap-4
$ $HOME/.rbenv/versions/2.2.8/bin/ruby -e 'puts Kernel.sprintf("%a", 0.1)'
0x1.999999999999ap-4

Actual Behavior

$ $HOME/.rbenv/versions/jruby-9.1.15.0/bin/ruby --version
jruby 9.1.15.0 (2.3.3) 2017-12-07 929fde8 Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [darwin-x86_64]
$ $HOME/.rbenv/versions/jruby-9.1.15.0/bin/ruby -e 'puts Kernel.format("%A", 0.1)'
ArgumentError: malformed format string - %A
        % at org/jruby/RubyString.java:1195
  sprintf at org/jruby/RubyKernel.java:811
   <main> at -e:1
$ $HOME/.rbenv/versions/jruby-9.1.15.0/bin/ruby -e 'puts Kernel.sprintf("%A", 0.1)'
ArgumentError: malformed format string - %A
        % at org/jruby/RubyString.java:1195
  sprintf at org/jruby/RubyKernel.java:811
   <main> at -e:1
$ $HOME/.rbenv/versions/jruby-9.1.15.0/bin/ruby -e 'puts Kernel.format("%a", 0.1)'
ArgumentError: malformed format string - %a
        % at org/jruby/RubyString.java:1195
  sprintf at org/jruby/RubyKernel.java:811
   <main> at -e:1
$ $HOME/.rbenv/versions/jruby-9.1.15.0/bin/ruby -e 'puts Kernel.sprintf("%a", 0.1)'
ArgumentError: malformed format string - %a
        % at org/jruby/RubyString.java:1195
  sprintf at org/jruby/RubyKernel.java:811
   <main> at -e:1

This is an issue in 9k and in master:
https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/util/Sprintf.java#L367

@headius
Copy link
Member

headius commented Apr 11, 2018

Right you are! I'll see if it's easy to add.

@headius
Copy link
Member

headius commented Apr 11, 2018

Well there's a bit of work needed, but it should be sortable out of the original commit to MRI: ruby/ruby@12b2e16e21b.

@headius
Copy link
Member

headius commented Feb 1, 2023

PR pushed for the new sprintf work in #7612. It has a lot of work left to do.

@headius headius linked a pull request Feb 1, 2023 that will close this issue
@headius headius removed the ruby 1.9 label Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants