HADOOP-6898. FileSystem.copyToLocal creates files with 777 permissions. Contributed by Aaron T. Myers.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1091588 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas White 2011-04-12 22:34:11 +00:00
parent 7568e9c88c
commit 6e5bd7b622
3 changed files with 8 additions and 2 deletions

View File

@ -568,6 +568,9 @@ Release 0.22.0 - Unreleased
HADOOP-7156. Workaround for unsafe implementations of getpwuid_r (todd)
HADOOP-6898. FileSystem.copyToLocal creates files with 777 permissions.
(Aaron T. Myers via tomwhite)
Release 0.21.1 - Unreleased
IMPROVEMENTS

View File

@ -659,7 +659,8 @@ public abstract class FileSystem extends Configured implements Closeable {
long blockSize,
Progressable progress
) throws IOException {
return this.create(f, FsPermission.getDefault(), overwrite, bufferSize,
return this.create(f, FsPermission.getDefault().applyUMask(
FsPermission.getUMask(getConf())), overwrite, bufferSize,
replication, blockSize, progress);
}

View File

@ -71,7 +71,9 @@ public class TestLocalFileSystemPermission extends TestCase {
String filename = "foo";
Path f = writeFile(localfs, filename);
try {
System.out.println(filename + ": " + getPermission(localfs, f));
FsPermission initialPermission = getPermission(localfs, f);
System.out.println(filename + ": " + initialPermission);
assertEquals(FsPermission.getDefault().applyUMask(FsPermission.getUMask(conf)), initialPermission);
}
catch(Exception e) {
System.out.println(StringUtils.stringifyException(e));