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

bignum too big to convert into `long' (RangeError) #112

Closed
Souravgoswami opened this issue Jun 25, 2020 · 0 comments · Fixed by #116
Closed

bignum too big to convert into `long' (RangeError) #112

Souravgoswami opened this issue Jun 25, 2020 · 0 comments · Fixed by #116

Comments

@Souravgoswami
Copy link

Souravgoswami commented Jun 25, 2020

Description

When I have a SAVE_HISTORY value specified to ~/.irbrc in Bignum, for example:

{
	USE_COLORIZE: false,
	SAVE_HISTORY: 10 ** 19,
	VERBOSE: true,
	SINGLE_IRB: true
}
.each { |x| IRB.conf[x[0]] = x[1] }

I can run IRB successfully, but the problems that I face:

  1. IRB crash during exit:
Traceback (most recent call last):
	10: from /usr/bin/irb:23:in `<main>'
	 9: from /usr/bin/irb:23:in `load'
	 8: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.4/exe/irb:11:in `<top (required)>'
	 7: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.4/lib/irb.rb:399:in `start'
	 6: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.4/lib/irb.rb:474:in `run'
	 5: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.4/lib/irb.rb:474:in `each'
	 4: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.4/lib/irb.rb:474:in `block in run'
	 3: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.4/lib/irb/ext/save-history.rb:62:in `block in extended'
	 2: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.4/lib/irb/ext/save-history.rb:110:in `save_history'
	 1: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.4/lib/irb/ext/save-history.rb:110:in `open'
/usr/lib/ruby/gems/2.7.0/gems/irb-1.2.4/lib/irb/ext/save-history.rb:112:in `block in save_history': bignum too big to convert into `long' (RangeError)
  1. No histories are saved.
  2. All the previous histories in ~/.irb_history are wiped out.

Although I think the length of a number to become Bignum depends on the system (like 64bit vs. 32bit), but eventually it can crash irb, but it shouldn't happen, for example, take a look at .bashrc, you can have values like:

export HISTORY=`ruby -e "print 10 ** 5_000"`

Terminal Emulator

Current => Tilix
Affected => All

Setting Files

Are you using ~/.irbrc and ~/.inputrc?
Yes, take a look above ;)

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

Successfully merging a pull request may close this issue.

1 participant