Project

General

Profile

Actions

Bug #13907

closed

Operation not permitted (Errno::EPERM) when adjusting .irbrc_history file permissions

Added by heaven (Alexander S.) over 6 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
[ruby-core:82821]

Description

This is happening every time I close irb on the server:

$ bin/rails console
Loading staging environment (Rails 5.1.3)
2.3.0 :001 > IRB.conf[:SAVE_HISTORY]
 => 100
2.3.0 :002 > IRB.conf[:HISTORY_FILE]
 => nil
2.3.0 :003 > IRB.rc_file("_history")
 => "/usr/local/rvm/rubies/ruby-2.3.3/.irbrc_history"
2.3.0 :004 > exit
/usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:91:in `chmod': Operation not permitted @ chmod_internal - /usr/local/rvm/rubies/ruby-2.3.3/.irbrc_history (Errno::EPERM)
	from /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:91:in `save_history'
	from /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:64:in `block in extended'
	from /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb.rb:404:in `block in irb_at_exit'
	from /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb.rb:404:in `each'
	from /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb.rb:404:in `irb_at_exit'
	from /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb.rb:398:in `start'
	from /var/www/crm.wegohealth.com/shared/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/commands/console/console_command.rb:62:in `start'
	from /var/www/crm.wegohealth.com/shared/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/commands/console/console_command.rb:17:in `start'
	from /var/www/crm.wegohealth.com/shared/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/commands/console/console_command.rb:85:in `perform'
	from /var/www/crm.wegohealth.com/shared/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from /var/www/crm.wegohealth.com/shared/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from /var/www/crm.wegohealth.com/shared/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	from /var/www/crm.wegohealth.com/shared/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/command/base.rb:63:in `perform'
	from /var/www/crm.wegohealth.com/shared/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/command.rb:44:in `invoke'
	from /var/www/crm.wegohealth.com/shared/bundle/ruby/2.3.0/gems/railties-5.1.3/lib/rails/commands.rb:16:in `<top (required)>'
	from bin/rails:10:in `require'
	from bin/rails:10:in `<main>'

IRB is trying to adjust file permissions File.chmod(0600, history_file) which isn't possible because the file owner is root:rvm. I am not sure if this is really an IRB bug or not, but perhaps it should check the owner first.

$ ls -la /usr/local/rvm/rubies/ruby-2.3.3/
total 36
drwxrwsr-x 6 root rvm 4096 Sep 15 11:46 .
drwxrwsr-x 4 root rvm 4096 Aug 14 12:05 ..
drwxrwsr-x 2 root rvm 4096 Aug 14 12:05 bin
-rw-rw-r-- 1 root rvm 7954 Aug 14 12:05 config
drwxrwsr-x 3 root rvm 4096 Aug 14 12:05 include
-rwxrwxr-x 1 root rvm  406 Aug 14 12:05 .irbrc
-rw-rw-r-- 1 root rvm    0 Sep 15 12:28 .irbrc_history
drwxrwsr-x 4 root rvm 4096 Aug 14 12:05 lib
drwxrwsr-x 3 root rvm 4096 Aug 14 12:05 share
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0