-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Closed
Copy link
Milestone
Description
Environment
$ jruby -v
jruby 9.2.5.0 (2.5.0) 2018-12-06 6d5a228 Java HotSpot(TM) 64-Bit Server VM 25.40-b25 on 1.8.0_40-b27 +jit [darwin-x86_64]
$ uname -a
Darwin Jankos-MacBook-Pro-2.local 18.2.0 Darwin Kernel Version 18.2.0: Fri Oct 5 19:41:49 PDT 2018; root:xnu-4903.221.2~2/RELEASE_X86_64 x86_64
Expected behaviour
In MRI, when a Pathname instance points to a symlink, Pathname#find will follow the symlink if you add a trailing slash. To illustrate, this script:
require "pathname"
require "tmpdir"
require "fileutils"
source_path = "#{Dir.tmpdir}/foo"
link_path = "#{Dir.tmpdir}/foo-symlink"
FileUtils.rm_rf(source_path)
FileUtils.mkdir(source_path)
FileUtils.touch("#{source_path}/file")
FileUtils.rm_f(link_path)
FileUtils.ln_s(source_path, link_path)
Pathname(link_path).find { |path| p path }
puts "===="
Pathname("#{link_path}/").find { |path| p path }will output the following on MRI:
#<Pathname:/var/folders/k7/6zx6dx6x7ys3rv3srh0nyfj00000gn/T/foo-symlink>
====
#<Pathname:/var/folders/k7/6zx6dx6x7ys3rv3srh0nyfj00000gn/T/foo-symlink/>
#<Pathname:/var/folders/k7/6zx6dx6x7ys3rv3srh0nyfj00000gn/T/foo-symlink/file>
Actual behaviour
JRuby won't follow the symlink on trailing slash:
<Pathname:/var/folders/k7/6zx6dx6x7ys3rv3srh0nyfj00000gn/T/foo-symlink>
====
<Pathname:/var/folders/k7/6zx6dx6x7ys3rv3srh0nyfj00000gn/T/foo-symlink/>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels