diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Test.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Test.java index 011cdac1f86..3acb4b2df25 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Test.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Test.java @@ -91,8 +91,6 @@ class Test extends FsCommand { @Override protected void processNonexistentPath(PathData item) throws IOException { - // NOTE: errors for FNF is not how the shell works! - if (flag != 'e') displayError(new PathNotFoundException(item.toString())); exitCode = 1; } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index dad80b2300b..56b5e4dde98 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -592,6 +592,9 @@ Release 2.0.3-alpha - Unreleased HDFS-4139. fuse-dfs RO mode still allows file truncation. (Colin Patrick McCabe via eli) + HDFS-4104. dfs -test -d prints inappropriate error on nonexistent directory + (Andy Isaacson via daryn) + Release 2.0.2-alpha - 2012-09-07 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java index f24444fb693..4b26e77d809 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java @@ -452,6 +452,15 @@ public class TestDFSShell { assertEquals(" no error ", 0, ret); assertTrue("empty path specified", (returned.lastIndexOf("empty string") == -1)); + out.reset(); + argv = new String[3]; + argv[0] = "-test"; + argv[1] = "-d"; + argv[2] = "/no/such/dir"; + ret = ToolRunner.run(shell, argv); + returned = out.toString(); + assertEquals(" -test -d wrong result ", 1, ret); + assertTrue(returned.isEmpty()); } finally { if (bak != null) { System.setErr(bak); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testHDFSConf.xml b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testHDFSConf.xml index 9d37df99b5d..b1a7764dbe5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testHDFSConf.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testHDFSConf.xml @@ -6264,8 +6264,8 @@ - RegexpComparator - ^test: `/dir0/file': No such file or directory + ExactComparator + @@ -6280,8 +6280,8 @@ - RegexpComparator - ^test: `file': No such file or directory + ExactComparator + @@ -6296,8 +6296,8 @@ - RegexpComparator - ^test: `/dir': No such file or directory + ExactComparator + @@ -6312,8 +6312,8 @@ - RegexpComparator - ^test: `dir0': No such file or directory + ExactComparator + @@ -6328,8 +6328,8 @@ - RegexpComparator - ^test: `hdfs:///dir0/file': No such file or directory + ExactComparator + @@ -6344,8 +6344,8 @@ - RegexpComparator - ^test: `hdfs:///dir': No such file or directory + ExactComparator + @@ -6360,8 +6360,8 @@ - RegexpComparator - ^test: `hdfs://\w+[-.a-z0-9]*:[0-9]+/dir0/file': No such file or directory + ExactComparator + @@ -6376,8 +6376,8 @@ - RegexpComparator - ^test: `hdfs://\w+[-.a-z0-9]*:[0-9]+/dir': No such file or directory + ExactComparator +