You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opening a symlink pointing to an empty directory fails - os.Open returns nil,nil.
On Windows opening a directory ends up in file_windows.go openDir function. If the directory is empty then ERROR_FILE_NOT_FOUND is returned and it goes to the if brances. Then syscall.GetFileAttributesEx is called.
However GetFileAttributesEx is like Lstat - not Stat.
I.e. 1) Create a symlink to a non-directory, 2) target is deleted, and there is now an empty directory, 3) target file system thinks this is fine, 4) Symlink now should point to a directory and try to open it -> everything fails.
This seems like a limitation in Windows, closing it.
Opening a symlink pointing to an empty directory fails - os.Open returns nil,nil.
On Windows opening a directory ends up in file_windows.go openDir function. If the directory is empty then ERROR_FILE_NOT_FOUND is returned and it goes to the if brances. Then syscall.GetFileAttributesEx is called.
However GetFileAttributesEx is like Lstat - not Stat.
As per https://msdn.microsoft.com/en-us/library/windows/desktop/aa365682%28v=vs.85%29.aspx#getfileattributes "If the path points to a symbolic link, the function returns attributes for the symbolic link.".
Thus the
if fa.FileAttributes&syscall.FILE_ATTRIBUTE_DIRECTORY == 0 {
succeeds and it returns nil, nil.The text was updated successfully, but these errors were encountered: