[jira] [Commented] (HDFS-10430) Refactor FileSystem#checkAccessPermissions for better reuse from tests

2016-05-24 Thread Chris Nauroth (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-10430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15298596#comment-15298596
 ] 

Chris Nauroth commented on HDFS-10430:
--

It's not immediately clear to me why another project's tests would need direct 
access to this method instead of using the public {{FileSystem#access}} method. 
 Maybe seeing the proposed patch or pointing out examples would help clarify.

The reason for the existence of the package-private 
{{FileSystem#checkAccessPermissions}} method is to provide code sharing between 
{{FileSystem}} and {{AbstractFileSystem}} for a default implementation of 
{{access}} in the base classes.  However, that default implementation is not 
necessarily complete or correct for all file systems.  For HDFS, 
{{DistributedFileSystem}} overrides {{access}} to use an RPC to the NameNode.  
The implementation of that RPC at the NameNode is different from the base class 
implementation, because it considers not only permissions but also HDFS ACLs.  
If {{checkAccessPermissions}} is made public, then there is a risk that 
applications would call it directly from main code, unaware that they could be 
bypassing ACL logic when connected to HDFS.

> Refactor FileSystem#checkAccessPermissions for better reuse from tests
> --
>
> Key: HDFS-10430
> URL: https://issues.apache.org/jira/browse/HDFS-10430
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>  Components: hdfs
>Reporter: Xiaobing Zhou
>Assignee: Xiaobing Zhou
>
> FileSystem#checkAccessPermissions could be used in a bunch of tests from 
> different projects, but it's in hadoop-common, which is not visible in some 
> cases.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org



[jira] [Commented] (HDFS-10430) Refactor FileSystem#checkAccessPermissions for better reuse from tests

2016-05-24 Thread Andras Bokor (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-10430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15298287#comment-15298287
 ] 

Andras Bokor commented on HDFS-10430:
-

cc: [~cnauroth]. He added this method. He may be able to share some more 
thoughts about this.

> Refactor FileSystem#checkAccessPermissions for better reuse from tests
> --
>
> Key: HDFS-10430
> URL: https://issues.apache.org/jira/browse/HDFS-10430
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>  Components: hdfs
>Reporter: Xiaobing Zhou
>Assignee: Xiaobing Zhou
>
> FileSystem#checkAccessPermissions could be used in a bunch of tests from 
> different projects, but it's in hadoop-common, which is not visible in some 
> cases.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org



[jira] [Commented] (HDFS-10430) Refactor FileSystem#checkAccessPermissions for better reuse from tests

2016-05-20 Thread Xiaobing Zhou (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-10430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15294712#comment-15294712
 ] 

Xiaobing Zhou commented on HDFS-10430:
--

[~boky01] thank you for the update.

We can add/refactor something like this. It should not have security concerns. 
I will post a patch.
{code}
static void checkAccessPermissions(
  final FileStatus stat,
  final FsAction mode,
  final UserGroupInformation ugi) throws IOException {
{code}

> Refactor FileSystem#checkAccessPermissions for better reuse from tests
> --
>
> Key: HDFS-10430
> URL: https://issues.apache.org/jira/browse/HDFS-10430
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>  Components: hdfs
>Reporter: Xiaobing Zhou
>Assignee: Xiaobing Zhou
>
> FileSystem#checkAccessPermissions could be used in a bunch of tests from 
> different projects, but it's in hadoop-common, which is not visible in some 
> cases.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org



[jira] [Commented] (HDFS-10430) Refactor FileSystem#checkAccessPermissions for better reuse from tests

2016-05-20 Thread Andras Bokor (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-10430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15293342#comment-15293342
 ] 

Andras Bokor commented on HDFS-10430:
-

I got your point.
As far as I understand the {{InterfaceAudinece}} annotation is to inform 
callers if the method/class can/should be used from outside of the project.
If we add a public counterpart syntactically we do not break the 
{{InterfaceAudience}} rules but semantically we call a 
{{InterfaceAudience.Private}} method.
Please check HDFS-6570. As far as I understand 
{{FileSystem#checkAccessPermissions}} was made private due to some security 
issues.
Even if we add counterpart to a class we should consider using 
@VisibleForTesting annotation.

> Refactor FileSystem#checkAccessPermissions for better reuse from tests
> --
>
> Key: HDFS-10430
> URL: https://issues.apache.org/jira/browse/HDFS-10430
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>  Components: hdfs
>Reporter: Xiaobing Zhou
>Assignee: Xiaobing Zhou
>
> FileSystem#checkAccessPermissions could be used in a bunch of tests from 
> different projects, but it's in hadoop-common, which is not visible in some 
> cases.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org



[jira] [Commented] (HDFS-10430) Refactor FileSystem#checkAccessPermissions for better reuse from tests

2016-05-18 Thread Xiaobing Zhou (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-10430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15290471#comment-15290471
 ] 

Xiaobing Zhou commented on HDFS-10430:
--

Thanks [~boky01] for comment.
Changing it to public could be one way, however, it's been annotated as 
@InterfaceAudience.Private. It'd be better to add the public counterpart in 
DistributedFileSystem and delegate it to FileSystem#checkAccessPermissions.

> Refactor FileSystem#checkAccessPermissions for better reuse from tests
> --
>
> Key: HDFS-10430
> URL: https://issues.apache.org/jira/browse/HDFS-10430
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>  Components: hdfs
>Reporter: Xiaobing Zhou
>
> FileSystem#checkAccessPermissions could be used in a bunch of tests from 
> different projects, but it's in hadoop-common, which is not visible in some 
> cases.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org



[jira] [Commented] (HDFS-10430) Refactor FileSystem#checkAccessPermissions for better reuse from tests

2016-05-18 Thread Andras Bokor (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-10430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15290009#comment-15290009
 ] 

Andras Bokor commented on HDFS-10430:
-

The Access Control Modifier of the method is default (visible in the package). 
With changing to public it will be visible from everywhere where hadoop-common 
is available.
What do you mean here? Change it to public?

> Refactor FileSystem#checkAccessPermissions for better reuse from tests
> --
>
> Key: HDFS-10430
> URL: https://issues.apache.org/jira/browse/HDFS-10430
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>  Components: hdfs
>Reporter: Xiaobing Zhou
>
> FileSystem#checkAccessPermissions could be used in a bunch of tests from 
> different projects, but it's in hadoop-common, which is not visible in some 
> cases.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org