[
https://issues.apache.org/jira/browse/HADOOP-9155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13535522#comment-13535522
]
Binglin Chang commented on HADOOP-9155:
---------------------------------------
Here is some code create files and dirs using default permission:
{code}
FileSystem.java
/**
* Create an FSDataOutputStream at the indicated Path with write-progress
* reporting.
* @param f the file name to open
* @param overwrite if a file with this name already exists, then if true,
* the file will be overwritten, and if false an error will be thrown.
* @param bufferSize the size of the buffer to be used.
* @param replication required block replication for the file.
*/
public FSDataOutputStream create(Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress
) throws IOException {
return this.create(f, FsPermission.getDefault().applyUMask(
FsPermission.getUMask(getConf())), overwrite, bufferSize,
replication, blockSize, progress);
}
/**
* Call {@link #mkdirs(Path, FsPermission)} with default permission.
*/
public boolean mkdirs(Path f) throws IOException {
return mkdirs(f, FsPermission.getDefault());
}
{code}
The problem is they both use same FsPermission.getDefault() as base permission.
mkdirs should use 777 and create should use 666
> 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