You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Having require "irb/ext/history" and IRB.conf[:EVAL_HISTORY]= in .irbrc causes error #804
% irb
/home/knu/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.10.1/lib/irb/workspace.rb:117:in `eval': no implicit conversion of IRB::Context into String (TypeError)
eval(statements, @binding, file, line)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.10.1/lib/irb/workspace.rb:117:in `evaluate'
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/3.2.0/irb/ext/history.rb:58:in `eval_history='
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.10.1/lib/irb/context.rb:66:in `initialize'
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.10.1/lib/irb.rb:428:in `new'
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.10.1/lib/irb.rb:428:in `initialize'
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.10.1/lib/irb.rb:394:in `new'
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.10.1/lib/irb.rb:394:in `start'
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.10.1/exe/irb:9:in `<top (required)>'
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/bin/irb:25:in `load'
from /home/knu/.local/share/rtx/installs/ruby/3.2.2/bin/irb:25:in `<main>'
The above .irbrc works with irb 1.6.x, but any later version I tested failed. I haven't bisected, but starting from 1.7.2, I guess? -- #623
Result of irb_info
irb(main):001> irb_info
Ruby version: 3.2.2
IRB version: irb 1.10.1 (2023-12-05)
InputMethod: RelineInputMethod with Reline 0.4.1 and /home/knu/.inputrc
Completion: Autocomplete, RegexpCompletor
.irbrc path: /home/knu/.irbrc
RUBY_PLATFORM: x86_64-linux
LANG env: ja_JP.UTF-8
East Asian Ambiguous Width: 2
changed the title [-]Having `require "irb/ext/history` and `IRB.conf[:EVAL_HISTORY]=` in .irbrc causes error[/-][+]Having `require "irb/ext/history"` and `IRB.conf[:EVAL_HISTORY]=` in .irbrc causes error[/+]on Dec 6, 2023
I'm sorry for the trouble. The require hasn't been needed for a long while (since as least IRB v0.9.6) as Context#eval_history would load it when IRB.conf[:EVAL_HISTORY] is set. So when I was implementing #623, I considered it as an implementation detail instead of a public component.
Thanks for your investigation. It took me some time to figure out what was going on from the error output because nothing was found on Google, so I hope whoever encounters this problem in the future will find this issue and the solution.
Activity
knu commentedon Dec 6, 2023
I know I can just omit the require and the problem is gone, but I've filed this anyway because the error was so unexpected.
[-]Having `require "irb/ext/history` and `IRB.conf[:EVAL_HISTORY]=` in .irbrc causes error[/-][+]Having `require "irb/ext/history"` and `IRB.conf[:EVAL_HISTORY]=` in .irbrc causes error[/+]tompng commentedon Dec 6, 2023
The file
irb/ext/historydoes not exist anymore.In my environment, these two require requires a file from different IRB version.
st0012 commentedon Dec 6, 2023
I'm sorry for the trouble. The require hasn't been needed for a long while (since as least IRB v0.9.6) as
Context#eval_historywould load it whenIRB.conf[:EVAL_HISTORY]is set. So when I was implementing #623, I considered it as an implementation detail instead of a public component.knu commentedon Dec 6, 2023
Thank you both! So, the solution here is to just remove the require as I said and it'll work also for reasonably old versions of irb, correct?
st0012 commentedon Dec 6, 2023
Yes. From my testing, it should work at least with IRB v1.2.0 without the require (can't test earlier due to other errors).
knu commentedon Dec 7, 2023
Thanks for your investigation. It took me some time to figure out what was going on from the error output because nothing was found on Google, so I hope whoever encounters this problem in the future will find this issue and the solution.