From 710fe14b5d1e00f9ae2d3fb49670b91a27dbe233 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 29 Mar 2016 17:17:50 +0000 Subject: merge revision(s) 53688,53689,53690,53702: [Backport #11874] * win32/win32.c (fileattr_to_unixmode, rb_w32_reparse_symlink_p): volume mount point should be treated as directory, not symlink. [ruby-core:72483] [Bug #11874] * win32/win32.c (rb_w32_read_reparse_point): check the reparse point is a volume mount point or not. * win32/file.c (rb_readlink): follow above change (but this pass won't be used). * win32/file.c (rb_readlink): drop garbage after the substitute name, as rb_w32_read_reparse_point returns the expected buffer size but "\??\" prefix is dropped from the result. * win32/win32.c (w32_readlink): ditto, including NUL-terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_file_exhaustive.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 8070d57bd0..4dc05a832c 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -557,6 +557,24 @@ class TestFileExhaustive < Test::Unit::TestCase end; end + if NTFS + def test_readlink_junction + base = File.basename(nofile) + err = IO.popen(%W"cmd.exe /c mklink /j #{base} .", chdir: @dir, err: %i[child out], &:read) + skip err unless $?.success? + assert_equal(@dir, File.readlink(nofile)) + end + + def test_realpath_mount_point + vol = IO.popen(["mountvol", DRIVE, "/l"], &:read).strip + Dir.mkdir(mnt = File.join(@dir, mntpnt = "mntpnt")) + system("mountvol", mntpnt, vol, chdir: @dir) + assert_equal(mnt, File.realpath(mnt)) + ensure + system("mountvol", mntpnt, "/d", chdir: @dir) + end + end + def test_unlink assert_equal(1, File.unlink(regular_file)) make_file("foo", regular_file) -- cgit v1.2.3