Project

General

Profile

Actions

Bug #11478

closed

symlinks support broken on win32

Added by scorpion007 (Alex Budovski) over 9 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

Description

The symlink support is completely broken on win32 because it thinks ALL reparse points are symlinks.

/* License: Ruby's */
static unsigned
fileattr_to_unixmode(DWORD attr, const WCHAR *path)
…
    if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
	mode |= S_IFLNK | S_IEXEC;
    }

But that is plainly false. I have dedup enabled on my volume, and some files are deduped, resulting in reparse points with tag == 0x80000013 (IO_REPARSE_TAG_DEDUP)

See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365511(v=vs.85).aspx

One obvious problem is with nmake install we skip a number of files from being copied due to this logic:

E:\dev\ruby\tool\rbinstall.rb:
def install_recursive(srcdir, dest, options = {})
  opts = options.clone
…
        elsif stat.symlink?
          # skip
          puts "**** skipping #{src} ****" # I added this line to check
        else

Example file that was skipped:

E:\dev\ruby>fsutil reparsepoint query E:/dev/ruby/lib/optparse.rb
Reparse Tag Value : 0x80000013
Tag value: Microsoft

Reparse Data Length: 0x0000007c
Reparse Data:
0000:  01 02 7c 00 00 00 00 00  fd e0 00 00 00 00 00 00  ..|.............
0010:  00 00 00 00 00 00 00 00  f7 38 52 15 a0 a8 c2 46  .........8R....F
0020:  a2 70 6e d0 4e 28 5d f5  40 00 40 00 40 00 00 00  .pn.N(].@.@.@...
0030:  97 4a a2 d6 a0 d4 d0 01  7b 2f 01 00 00 00 0a 00  .J......{/......
0040:  30 2e 9c 05 00 00 03 00  01 00 00 00 88 00 00 00  0...............
0050:  88 00 00 00 00 00 00 00  30 cf fe d1 25 e3 d7 d6  ........0...%...
0060:  07 79 02 88 4a 46 79 35  31 2d b7 31 49 87 de f8  .y..JFy51-.1I...
0070:  50 20 af 62 27 db 87 76  fc 44 d2 88              P .b'..v.D..

File that hadn't been deduped yet:

E:\dev\ruby>fsutil reparsepoint query E:/dev/ruby/include/ruby/backward/classext.h
Error:  The file or directory is not a reparse point.

So the nmake install is incomplete! But naturally, anything that depends on stat.symlink? will not work right.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #11462: win32 readlink doesn't support dedupClosedActions
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Related to Bug #11462: win32 readlink doesn't support dedup added
Actions #2

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Status changed from Open to Feedback

r51640 doesn't fix it too?

Actions #3

Updated by djberg96 (Daniel Berger) over 9 years ago

FWIW, this is how we implemented File.symlink? in win32-file: https://github.com/djberg96/win32-file/blob/ffi/lib/win32/file.rb#L241-L271

Note that we use CreateSymbolicLink for our own File.symlink method, however. I'm not sure why core Ruby doesn't yet. It's been around since Vista.

Actions #4

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

  • Status changed from Feedback to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0