hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-9155) FsPermission should have different default value, 777 for directory and 666 for file
Date Tue, 18 Dec 2012 23:16:12 GMT

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

Colin Patrick McCabe commented on HADOOP-9155:
----------------------------------------------

Do {{rm -f /tmp/foo /tmp/bar; rmdir /tmp/foodir /tmp/bardir}} and try this test program:

{code}
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(void) {
  int fd = creat("/tmp/foo", S_IRWXU);
  close(fd);
  mkdir("/tmp/foodir", S_IRWXU);
  umask(0700);
  fd = creat("/tmp/bar", S_IRWXU);
  close(fd);
  mkdir("/tmp/bardir", S_IRWXU);
  return 0;
}
{code}

If, like me, your umask is set to {{022}}, you should have two files and two directories in
your /tmp directory that look like this:
{code}
cmccabe@keter:~/test> ls -ld /tmp/foo* /tmp/bar*
---------- 1 cmccabe users    0 Dec 18 15:10 /tmp/bar
d--------- 2 cmccabe users 4096 Dec 18 15:10 /tmp/bardir
-rwx------ 1 cmccabe users    0 Dec 18 15:10 /tmp/foo
drwx------ 2 cmccabe users 4096 Dec 18 15:10 /tmp/foodir
{code}

So there is not umask bug here.  In UNIX, umask is applied consistently to files and directories;
we do the same in Hadoop.

However, there is a bug here-- an HDFS-specific problem, HDFS-4319.  The issue is that HDFS
is treating all files as executable, even though it doesn't actually store that bit for any
files.  So really it would make sense to treat all files in HDFS as *not* executable, the
same way as was done in branch-1.
                
> FsPermission should have different default value, 777 for directory and 666 for file
> ------------------------------------------------------------------------------------
>
>                 Key: HADOOP-9155
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9155
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Binglin Chang
>            Priority: Minor
>
> Currently umask works differently as linux convention, which is:
> The default umask 0002 is used for regular users. 
> The default umask for the root user is 0022.
> For directories, the base permissions are 0777 and for files 0666.

--
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

Mime
View raw message