ruby / racc

Racc is an LALR(1) parser generator. It is written in Ruby itself, and generates ruby programs.
Other
541 stars 88 forks source link

to_a method on String class with splat operator #33

Closed EppO closed 8 years ago

EppO commented 11 years ago

I hit the same bug using racc and devise (which depends on orm_adapter) as described in this blog post

According to rubyspec, *"" should gives [""] and not an empty array.

Issue comes from that line, lines.to_a gives [] if lines is empty.

tenderlove commented 11 years ago

Erm, how are you getting this file required? AFAIK, it should only get required when you compile a grammar via the command line, not during runtime with the generated parser. Also, we should probably just find the places where racc depends on String#to_a, stop using it, then rm this method.

EppO commented 11 years ago

Mhhhh, if I remember correctly, I added racc in my gemfile because rubinius 2.1 was complaining about a missing racc/parser.rb while booting a RoR app. Later on, I noticed a bug affecting ActiveRecord order method using Devise authentication method that was due to this String#to_a extension.

tenderlove commented 11 years ago

Ok, I guess that would do it. I'm fairly certain that changing this will break the parser generator. I'll find the places racc is using this monkey patch and fix them. I'd much rather just remove this monkey patch.

EppO commented 11 years ago

that would be the best option for sure. Thanks for your quick response. I guess you can close this issue then.

zenspider commented 10 years ago

I just put a raise "no" in the monkeypatch and there are only 2 call sites (tested!) that it detected. I'm gonna test against 1.8 and 1.9 to ensure everything is cool and then I'll push.