[ 
https://issues.apache.org/jira/browse/HADOOP-9483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13634226#comment-13634226
 ] 

Chris Nauroth commented on HADOOP-9483:
---------------------------------------

The trunk code still has a Unix command dependency on the readlink command for 
determining the target of a symlink. (See {{RawLocalFs#readLink}}.)  This is 
the source of some of the test failures.

I propose the addition of a new "winutils readlink" command. The logic of this 
command would be:
# Call {{CreateFile}} with {{OPEN_EXISTING}} and 
{{FILE_FLAG_OPEN_REPARSE_POINT}}.
## 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
# Call {{GetFileInformationByHandle}}.
## 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364952(v=vs.85).aspx
# Check the {{BY_HANDLE_FILE_INFORMATION}} for the presence of 
{{FILE_ATTRIBUTE_REPARSE_POINT}}.
## 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363788(v=vs.85).aspx
## 
http://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx
# If not a reparse point, exit with code 1 and print nothing to stdout. (This 
is what Unix readlink does.)
# Call {{DeviceIoControl}} with {{FSCTL_GET_REPARSE_POINT}}.
## http://msdn.microsoft.com/en-us/library/aa363216(v=VS.85).aspx
## http://msdn.microsoft.com/en-us/library/aa364571.aspx
# Get the {{REPARSE_DATA_BUFFER}} structure.
## http://msdn.microsoft.com/en-us/library/ff552012.aspx
# Check if {{ReparseTag}} is {{IO_REPARSE_TAG_SYMLINK}}.
## 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365511(v=vs.85).aspx
# If not {{IO_REPARSE_TAG_SYMLINK}}, then...?
# Get target from {{SymbolicLinkReparseBuffer}}.
# Print target to stdout and exit with code 0. (This is what Unix readlink 
does.)

                
> winutils support fo readlink command
> ------------------------------------
>
>                 Key: HADOOP-9483
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9483
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: util
>    Affects Versions: 3.0.0
>            Reporter: Chris Nauroth
>
> The current codebase relies on the Unix readlink command to determine the 
> target of a symlink on the local file system.  winutils currently does not 
> support this functionality on Windows.  Adding the command to winutils will 
> prevent the need to use GnuWin32 or Cygwin for readlink support.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to