Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.2
-
Fix Version/s: JRuby 1.4
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:HideDarwin lunchbox.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-206)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-82, mixed mode)
jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-06-10 rev 6586) [x86_64-java]
ShowDarwin lunchbox.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386 java version "1.6.0_13" Java(TM) SE Runtime Environment (build 1.6.0_13-b03-206) Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-82, mixed mode) jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-06-10 rev 6586) [x86_64-java]
-
Number of attachments :
Description
Given a directory structure like this:
LUNCHBOX ~/test> ls -alh
total 4.0K
drwxr-xr-x 6 coda staff 204 2009-06-15 22:33 .
drwx------+ 87 coda staff 2.9K 2009-06-15 22:32 ..
lrwxr-xr-x 1 coda staff 3 2009-06-15 22:33 four -> two
drwxr-xr-x 2 coda staff 68 2009-06-15 22:32 one
drwxr-xr-x 2 coda staff 68 2009-06-15 22:32 three
drwxr-xr-x 2 coda staff 68 2009-06-15 22:32 two
This code:
FileUtils.chown_R("coda", nil, "/Users/coda/test", :verbose => false)
raises an ArgmentException:
/opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:1374:in `check_have_lchown?': wrong # of arguments(2 for 3) (ArgumentError)
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:1367:in `have_lchown?'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:1222:in `chown'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:961:in `chown_R'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:1324:in `preorder_traverse'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:959:in `chown_R'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:958:in `each'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:958:in `chown_R'
The same code in Ruby does not. The exception is only raised when there are symbolic links in the path to be chown'd.
Here's a test case for the bug.
My output looks like this:
UNCHBOX ~> ruby ~/Desktop/lchown-testcase.rb /tmp/lchown-test
LUNCHBOX ~> jruby ~/Desktop/lchown-testcase.rb /tmp/lchown-test
/opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:1374:in `check_have_lchown?': wrong # of arguments(2 for 3) (ArgumentError)
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:1367:in `have_lchown?'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:1222:in `chown'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:961:in `chown_R'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:1324:in `preorder_traverse'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:959:in `chown_R'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:958:in `each'
from /opt/local/share/java/jruby/lib/ruby/1.8/fileutils.rb:958:in `chown_R'
from /Users/coda/Desktop/lchown-testcase.rb:8