hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Nauroth (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-9043) winutils can create unusable symlinks
Date Thu, 21 Feb 2013 16:40:13 GMT

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

Chris Nauroth commented on HADOOP-9043:

To fix this specific problem, we would want to change FileUtil#symlink to "normalize the slashes".
If you take a look at the branch-1-win code, it already does this so you can just forward
port the patch.

This code was already ported to branch-trunk-win several months ago:

  public static int symLink(String target, String linkname) throws IOException{
    // Run the input paths through Java's File so that they are converted to the
    // native OS form
    File targetFile = new File(target);
    File linkFile = new File(linkname);

I believe this jira is no longer valid, at least under its current description.  When I filed
it, I didn't realize that Windows requires slightly different API calls for creating a symlink
that targets a directory vs. a file.  Therefore, winutils really does need to call {{DirectoryCheck}}
to determine the type of target.  As a consequence, winutils differs from Unix ln in that
it cannot create a dangling symlink.  (It has no way of knowing whether the caller is trying
to create a "dangling file symlink" or a "dangling directory symlink".)  I believe that both
the Java code and the C code are doing the right thing for us now, without further changes.

The remaining issue is the failure of {{TestLocalFSFileContextSymlink}} on Windows, which
is what prompted me to file this jira initially.  We now know that this is an inevitable platform
difference, so let's use {{Assert.assumeTrue(!Shell.WINDOWS)}} to skip the tests that can't
possibly pass on Windows.  If needed, we could also add more tests to cover Windows behavior,
guarded with {{Assert.assumeTrue(Shell.WINDOWS)}}.  AFAIK, Hadoop product code does not actually
require the ability to create a dangling symlink, and the test suite is just trying to cover
ln functionality exhaustively.

I propose that we close this jira as invalid and create a new one to fix the tests.

> 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

View raw message