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

Chuan Liu commented on HADOOP-9043:
-----------------------------------

To summary the cause of the problem:
Windows symlink creation API - CreateSymbolicLink() - needs to know if the 
destination is a file or directory. We called DirectoryCheck() to tell if the 
given path is a file or directory. This leads to two issues:

1) The path needs exist in order for the symlink to be created successfully. 
This diverges from the Unix behavior, where invalid link can be created 
regardless existence of the destination.

2) We have an inconsistency in Windows API in treating forward slashes and 
backslashes. In this case, DirectoryCheck() will accept forward slashes and 
backslashes when checking if a path is directory or file, while the link 
contains forward slashes will become invalid symlinks even if the destination 
exists as indicated by DirectoryCheck().


We will not fix the first problem as this roots in how OS handle symlinks and 
API differences in symlink creation.

For 2), I think both Arpit's and Ivan's fixes should work. I think Ivan's fix 
is safer in general by not considering paths containing forward slashes.
                
> winutils can create unusable symlinks
> -------------------------------------
>
>                 Key: HADOOP-9043
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9043
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: util
>    Affects Versions: 1-win, trunk-win
>            Reporter: Chris Nauroth
>            Assignee: Arpit Agarwal
>         Attachments: HADOOP-9043.branch-1-win.patch, HADOOP-9043.trunk.patch
>
>
> In general, the winutils symlink command rejects attempts to create symlinks 
> targeting a destination file that does not exist.  However, if given a 
> symlink destination with forward slashes pointing at a file that does exist, 
> then it creates the symlink with the forward slashes, and then attempts to 
> open the file through the symlink will fail.

--
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