svn merge -c 1409848 FIXES: HDFS-4104. dfs -test -d prints inappropriate error on nonexistent directory (Andy Isaacson via daryn)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1409850 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daryn Sharp 2012-11-15 15:55:36 +00:00
parent fcc84bcf2a
commit dc2fee69d5
4 changed files with 28 additions and 18 deletions

View File

@ -91,8 +91,6 @@ class Test extends FsCommand {
@Override @Override
protected void processNonexistentPath(PathData item) throws IOException { 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; exitCode = 1;
} }
} }

View File

@ -238,6 +238,9 @@ Release 2.0.3-alpha - Unreleased
HDFS-4139. fuse-dfs RO mode still allows file truncation. HDFS-4139. fuse-dfs RO mode still allows file truncation.
(Colin Patrick McCabe via eli) (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 Release 2.0.2-alpha - 2012-09-07
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -452,6 +452,15 @@ public class TestDFSShell {
assertEquals(" no error ", 0, ret); assertEquals(" no error ", 0, ret);
assertTrue("empty path specified", assertTrue("empty path specified",
(returned.lastIndexOf("empty string") == -1)); (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 { } finally {
if (bak != null) { if (bak != null) {
System.setErr(bak); System.setErr(bak);

View File

@ -6264,8 +6264,8 @@
</cleanup-commands> </cleanup-commands>
<comparators> <comparators>
<comparator> <comparator>
<type>RegexpComparator</type> <type>ExactComparator</type>
<expected-output>^test: `/dir0/file': No such file or directory</expected-output> <expected-output></expected-output>
</comparator> </comparator>
</comparators> </comparators>
</test> </test>
@ -6280,8 +6280,8 @@
</cleanup-commands> </cleanup-commands>
<comparators> <comparators>
<comparator> <comparator>
<type>RegexpComparator</type> <type>ExactComparator</type>
<expected-output>^test: `file': No such file or directory</expected-output> <expected-output></expected-output>
</comparator> </comparator>
</comparators> </comparators>
</test> </test>
@ -6296,8 +6296,8 @@
</cleanup-commands> </cleanup-commands>
<comparators> <comparators>
<comparator> <comparator>
<type>RegexpComparator</type> <type>ExactComparator</type>
<expected-output>^test: `/dir': No such file or directory</expected-output> <expected-output></expected-output>
</comparator> </comparator>
</comparators> </comparators>
</test> </test>
@ -6312,8 +6312,8 @@
</cleanup-commands> </cleanup-commands>
<comparators> <comparators>
<comparator> <comparator>
<type>RegexpComparator</type> <type>ExactComparator</type>
<expected-output>^test: `dir0': No such file or directory</expected-output> <expected-output></expected-output>
</comparator> </comparator>
</comparators> </comparators>
</test> </test>
@ -6328,8 +6328,8 @@
</cleanup-commands> </cleanup-commands>
<comparators> <comparators>
<comparator> <comparator>
<type>RegexpComparator</type> <type>ExactComparator</type>
<expected-output>^test: `hdfs:///dir0/file': No such file or directory</expected-output> <expected-output></expected-output>
</comparator> </comparator>
</comparators> </comparators>
</test> </test>
@ -6344,8 +6344,8 @@
</cleanup-commands> </cleanup-commands>
<comparators> <comparators>
<comparator> <comparator>
<type>RegexpComparator</type> <type>ExactComparator</type>
<expected-output>^test: `hdfs:///dir': No such file or directory</expected-output> <expected-output></expected-output>
</comparator> </comparator>
</comparators> </comparators>
</test> </test>
@ -6360,8 +6360,8 @@
</cleanup-commands> </cleanup-commands>
<comparators> <comparators>
<comparator> <comparator>
<type>RegexpComparator</type> <type>ExactComparator</type>
<expected-output>^test: `hdfs://\w+[-.a-z0-9]*:[0-9]+/dir0/file': No such file or directory</expected-output> <expected-output></expected-output>
</comparator> </comparator>
</comparators> </comparators>
</test> </test>
@ -6376,8 +6376,8 @@
</cleanup-commands> </cleanup-commands>
<comparators> <comparators>
<comparator> <comparator>
<type>RegexpComparator</type> <type>ExactComparator</type>
<expected-output>^test: `hdfs://\w+[-.a-z0-9]*:[0-9]+/dir': No such file or directory</expected-output> <expected-output></expected-output>
</comparator> </comparator>
</comparators> </comparators>
</test> </test>