Repository: hadoop Updated Branches: refs/heads/trunk c01bee010 -> 97056c335
HADOOP-12718. Incorrect error message by fs -put local dir without permission. (John Zhuge via Yongjun Zhang) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/97056c33 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/97056c33 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/97056c33 Branch: refs/heads/trunk Commit: 97056c3355810a803f07baca89b89e2bf6bb7201 Parents: c01bee0 Author: Yongjun Zhang <yzh...@cloudera.com> Authored: Wed Jan 27 08:04:25 2016 -0800 Committer: Yongjun Zhang <yzh...@cloudera.com> Committed: Wed Jan 27 08:04:25 2016 -0800 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java | 5 +++++ 2 files changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/97056c33/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 5121a83..3b8376f 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -1648,6 +1648,9 @@ Release 2.8.0 - UNRELEASED HADOOP-12731. Remove useless boxing/unboxing code. (Kousuke Saruta via aajisaka) + HADOOP-12718. Incorrect error message by fs -put local dir without + permission. (John Zhuge via Yongjun Zhang) + Release 2.7.3 - UNRELEASED INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/97056c33/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java index 352b27a..3e984e3 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java @@ -33,6 +33,7 @@ import java.io.OutputStream; import java.io.FileDescriptor; import java.net.URI; import java.nio.ByteBuffer; +import java.nio.file.AccessDeniedException; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.attribute.BasicFileAttributes; @@ -463,6 +464,10 @@ public class RawLocalFileSystem extends FileSystem { if (localf.isDirectory()) { String[] names = localf.list(); if (names == null) { + if (!localf.canRead()) { + throw new AccessDeniedException("cannot open directory " + f + + ": Permission denied"); + } return null; } results = new FileStatus[names.length];