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

Uma Maheswara Rao G commented on HADOOP-17029:
----------------------------------------------

[~abhishekd], I have reopened this issue to discuss further. 

As we are representing mount link as symlinks in ViewFS I am just wondering 
whether we should leave it to show the link permissions only? Here link 
permissions in ViewFS is kind of static as link will be updated from xml 
configurations.

When we check on linux or mac symlinks, link permissions are not changed if you 
change targetDir permissions. That means, it's not showing any targetDir 
permissions on link.

 
{code:java}
lrwxr-xr-x   1 umagangumalla  own   6 Jun  6 15:54 srcLink -> target
drwxrwxrwx   3 umagangumalla  own  96 Jun  8 11:05 target
{code}
 

However, GetFileStatus will get resolved path FileStatus so, we can get target 
directory permissions in there. 

How does this impact in your scenarios? Looks like this behavior is same in 
HDFS symlink case as well.

 
{code:java}
public void testPErmissionsWithSymlinksOnHDFS() throws Exception {
    // add ur hdfs uri here: ex hdfs://10.0.1.75:9000
    URI hdfsURI = dfs.getUri();
    FileSystem.enableSymlinks();
    try (FileSystem hdfs = new DistributedFileSystem()) {
      hdfs.initialize(hdfsURI, new HdfsConfiguration());
      final Path targetLinkDir = new Path("/user", "targetRegularDir");
      hdfs.mkdirs(targetLinkDir);
      Path symLinkDir = new Path("/links/linkDir");
      hdfs.createSymlink(targetLinkDir, symLinkDir, true);
      // ListStatus Test
      FileStatus[] listStatus = hdfs.listStatus(new Path("/links"));
      FileStatus fsFromLs = listStatus[0]; // FileStatus of /links/linkDir
      Assert.assertEquals(fsFromLs.isDirectory(), false);
      Assert.assertEquals(symLinkDir,
          Path.getPathWithoutSchemeAndAuthority(fsFromLs.getPath()));
      Assert.assertEquals(FsPermission.valueOf("-rwxrwxrwx"),
          fsFromLs.getPermission());
      
     // Change permissions on target
      hdfs.setPermission(targetLinkDir, FsPermission.valueOf("-rw-rw-rw-"));
      listStatus = hdfs.listStatus(new Path("/links"));
      fsFromLs = listStatus[0]; // FileStatus of /links/linkDir
      Assert.assertEquals(fsFromLs.isDirectory(), false);
      Assert.assertEquals(symLinkDir,
          Path.getPathWithoutSchemeAndAuthority(fsFromLs.getPath()));
      Assert.assertEquals(FsPermission.valueOf("-rwxrwxrwx"),
          fsFromLs.getPermission());
      // GetFileStatus test
      // FileStatus of /links/linkDir
      FileStatus fileStatus = hdfs.getFileStatus(symLinkDir);
      Assert.assertEquals(true, fileStatus.isDirectory());
      // resolved to FileStatus of /user/targetRegularDir
      Assert.assertEquals(targetLinkDir,
          Path.getPathWithoutSchemeAndAuthority(fileStatus.getPath()));
      Assert.assertEquals(FsPermission.valueOf("-rw-rw-rw-"),
          fileStatus.getPermission());
    }
{code}
 

 

> ViewFS does not return correct user/group and ACL
> -------------------------------------------------
>
>                 Key: HADOOP-17029
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17029
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs, viewfs
>            Reporter: Abhishek Das
>            Assignee: Abhishek Das
>            Priority: Major
>
> When doing ls on a mount point parent, the returned user/group ACL is 
> incorrect. It always showing the user and group being current user, with some 
> arbitrary ACL. Which could misleading any application depending on this API.
> cc [~cliang] [~virajith] 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to