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

Ravi Phulari commented on HADOOP-6701:
--------------------------------------

*This patch changes exit codes returned from  chmod, chgrp and chown operations*

*  Old Behavior  of {{chmod,chown,chgrp}} operation.
  ** If operation is successful then - exit code 0 and no error message.
  ** If operation is unsuccessful then - exit code 0 and error message printed.
{noformat} 
*If files does not exist and with globbed input*
[rphul...@statepick-lm]> bin/hadoop fs -chmod 777 st*; echo $?
0

*If files does not exist without globbed input*
[rphul...@statepick-lm]> bin/hadoop fs -chmod 777 st; echo $?
chmod: could not get status for 'st': File does not exist: st
0

*If user does not have permission to change file-permission*
r...@localhost:~$ hadoop dfs -chgrp abcd /; echo $?
chgrp: changing ownership of
'hdfs://localhost/':org.apache.hadoop.security.AccessControlException: 
Permission denied
0

*If user does not have permission to change file-permission*
r...@localhost:~$ hadoop dfs -chown abcd /; echo $?
chown: changing ownership of
'hdfs://localhost/':org.apache.hadoop.security.AccessControlException: 
Permission denied
0

*If user has permission to change file-permission and file does not exist*
r...@localhost:~$ hadoop dfs -chmod 755 /DOESNTEXIST; echo $?
chmod: could not get status for '/DOESNTEXIST': File does not exist: 
/DOESNTEXIST
0
{noformat} 

*  New Behavior  of {{chmod,chown,chgrp}} operation.
  ** If operation is successful then - exit code 0 is returned and no error 
message.
  ** If operation is unsuccessful then - exit code 1 is returned and error 
message printed.

{noformat} 
*If file does not exist*
[rphul...@lm]> bin/hadoop fs -chown rphulari:users est; echo $?
chown: could not get status for 'est': File does not exist: est
1

*If files does not exist and with globbed input*
[rphul...@statepick-lm]> bin/hadoop fs -chown rphulari:users est\*; echo $?
chown: could not get status for 'est*'
1

*If file exist and operation is successful*
[rphul...@statepick-lm]> bin/hadoop fs -chmod 700 test; echo $?
0


*If file/dir with glob pattern exits and operation is successful*
[rphul...@statepick-lm]> bin/hadoop fs -chmod 777 test*; echo $?
0
[rphul...@statepick-lm]> bin/hadoop fs -ls 
Found 2 items
-rw-rw-rw-   1 admin    supergroup          0 2010-04-15 13:54 /user/rphulari/t
drwxrwxrwx   - rphulari userss              0 2010-03-30 23:39 
/user/rphulari/test

{noformat} 

*Unchanged behavior - need to be fixed in different Jira*
Because following bug is due to Permissions code we will change it in separate 
Jira .

{noformat} 
*If user does not have permission to change file-permission*
r...@localhost:~$ hadoop dfs -chown abcd /; echo $?
chown: changing ownership of
'hdfs://localhost/':org.apache.hadoop.security.AccessControlException: 
Permission denied
0
{noformat} 


>  Incorrect exit codes for "dfs -chown", "dfs -chgrp"
> ----------------------------------------------------
>
>                 Key: HADOOP-6701
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6701
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 0.19.1, 0.20.0, 0.20.1, 0.20.2
>            Reporter: Ravi Phulari
>            Assignee: Ravi Phulari
>            Priority: Minor
>             Fix For: 0.20.3, 0.21.0, 0.22.0
>
>         Attachments: HADOOP-6701.patch
>
>
> r...@localhost:~$ hadoop dfs -chgrp abcd /; echo $?
> chgrp: changing ownership of
> 'hdfs://localhost/':org.apache.hadoop.security.AccessControlException: 
> Permission denied
> 0
> r...@localhost:~$ hadoop dfs -chown  abcd /; echo $?
> chown: changing ownership of
> 'hdfs://localhost/':org.apache.hadoop.security.AccessControlException: 
> Permission denied
> 0
> r...@localhost:~$ hadoop dfs -chmod 755 /DOESNTEXIST; echo $?
> chmod: could not get status for '/DOESNTEXIST': File does not exist: 
> /DOESNTEXIST
> 0
> -
> Exit codes for both of the above invocations should be non-zero to indicate 
> that the command failed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to