[
https://issues.apache.org/jira/browse/HADOOP-9155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13537770#comment-13537770
]
Binglin Chang commented on HADOOP-9155:
---------------------------------------
Look through the code, FsPermission::getDefault are used across all projects.
Most of them are used to create dirs(and symlinks, also should have default
value 0777), a few are used to create files. I think we should fix this way:
1. keep the same name getDefault for compatibility, but its meaning has changed
to "default permission for dir and symlink", add getFileDefault() to return
0666, further we can add getDirDefault for clearity. No need for symlink cause
we never let user choose symlink permission when create symlink.
2. Do the same for FileContext.DEFAULT_PERM, add FileContext.FILE_DEFAULT_PERM
3. Keep all mkdir(and createSymlink) call using getDefault or
FileContext.DEFAULT_PERM unchanged(there are too many of them, most in test
code), make all create file call use getFileDefault() or
FileContext.FILE_DEFAULT_PERM, so as to keep changes at minimal.
4. when creating new FileStatus with default permission, use following logic
{code}
this.permission = (permission == null) ? ((isdir || symlink!=null) ?
FsPermission.getDefault() :
FsPermission.getFileDefault()) : permission;
{code}
5. Create multiple sub JIRAs for each sub-project.
> 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
>
> The default permission for {{FileSystem#create}} is the same default as for
> {{FileSystem#mkdirs}}, namely {{0777}}. It would make more sense for the
> default to be {{0666}} for files and {{0777}} for directories. The current
> default leads to a lot of files being created with the executable bit that
> really should not be. One example is anything created with FsShell's
> copyToLocal.
> For reference, {{fopen}} creates files with a mode of {{0666}} (minus
> whatever bits are set in the umask; usually {{0022}}. This seems to be the
> standard behavior and we should follow it. This is also a regression since
> branch-1.
--
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