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

Charles Lamb commented on HDFS-6422:
------------------------------------

[~andrew.wang] and I discussed this offline. We also ran some tests on the ext4 
extended attribute functions. It appears that getfattr always returns names and 
values. listfattr ionly returns names. The new HDFS listxattr api will be 
covered separately under HDFS-6375. The attached diff covers getting HDFS 
getfattr to mimic the Linux/ext4 functionality. To wit:

Throw an exception if:
.  the caller requests an attribute that doesn't exist,
.  the caller requests an attribute and they don't have proper permissions, 
.  the caller requests an attribute and they don't have permission to the 
namespace. This applies to the trusted namespace.
.  the caller specifies an unknown namespace.

The gist of Linux extended attribute permissions is that you need access to the 
inode to read/write xattr names and you need access to the entity itself (i.e. 
a file or directory) to read/write xattr values. The former is determined by 
the parent directory permissions and the latter by the entity's permissions 
(i.e. the thing on which the extended attributes are associated).

You need scan/execute permissions on the parent (owning) directory to access 
extended attribute names. You need read permission on the entity itself to read 
extended attribute values and you need write permission to modify them.

The patch purports to implement those semantics and adds appropriate unit tests 
for the same.


> getfattr in CLI doesn't throw exception or return non-0 return code when 
> xattr doesn't exist
> --------------------------------------------------------------------------------------------
>
>                 Key: HDFS-6422
>                 URL: https://issues.apache.org/jira/browse/HDFS-6422
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: HDFS XAttrs (HDFS-2006)
>            Reporter: Charles Lamb
>            Assignee: Charles Lamb
>         Attachments: HDFS-6422.1.patch, HDFS-6422.2.patch
>
>
> If you do
> hdfs dfs -getfattr -n user.blah /foo
> and user.blah doesn't exist, the command prints
> # file: /foo
> and a 0 return code.
> It should print an exception and return a non-0 return code instead.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to