Issue #7373 has been reported by asterite (Ary Borenszweig).

----------------------------------------
Bug #7373: FileUtils#chmod verbose gives error when mode is string
https://bugs.ruby-lang.org/issues/7373

Author: asterite (Ary Borenszweig)
Status: Open
Priority: Normal
Assignee: 
Category: lib
Target version: 
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0]


I can see the wrong code in trunk, even though it happened in 1.9.3p194: https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1037 )

asterite @ ~ $ irb
irb(main):001:0> require 'fileutils'
=> true
irb(main):002:0> FileUtils.chmod '+x', 'foo'
=> ["foo"]
irb(main):003:0> FileUtils.chmod '+x', 'foo', verbose: true
ArgumentError: invalid value for Integer(): "+x"
	from /Users/asterite/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:967:in `sprintf'
	from /Users/asterite/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:967:in `chmod'
	from (irb):3
	from /Users/asterite/.rbenv/versions/1.9.3-p194/bin/irb:12:in `<main>'

This is because chmod in verbose mode assumes the mode is a number, and tries to format it in octal:

    fu_output_message sprintf('chmod %o %s', mode, list.join(' ')) if options[:verbose]

The same problem is present in chmod_R.

Sorry I don't include a patch, I'm not sure how to solve it. Maybe check if mode is a number and then use %o, else use %s.


-- 
http://bugs.ruby-lang.org/