From dffd37926d8cca10b12103ffbf83bd14518be63b Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Thu, 15 Mar 2012 22:36:00 +0000 Subject: [PATCH] HADOOP-8173. FsShell needs to handle quoted metachars. Contributed by Daryn Sharp git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1301250 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/fs/shell/PathData.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 68065faf78..eba60c1315 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -373,6 +373,9 @@ Release 0.23.2 - UNRELEASED HADOOP-8164. Back slash as path separator is handled for Windows only. (Daryn Sharp via suresh) + HADOOP-8173. FsShell needs to handle quoted metachars. (Daryn Sharp via + szetszwo) + Release 0.23.1 - 2012-02-17 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathData.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathData.java index afcba24de5..cb481c8e0e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathData.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathData.java @@ -36,7 +36,6 @@ import org.apache.hadoop.fs.shell.PathExceptions.PathIsDirectoryException; import org.apache.hadoop.fs.shell.PathExceptions.PathIsNotDirectoryException; import org.apache.hadoop.fs.shell.PathExceptions.PathNotFoundException; -import org.apache.hadoop.io.Writable; /** * Encapsulates a Path (path), its FileStatus (stat), and its FileSystem (fs). @@ -267,6 +266,8 @@ public static PathData[] expandAsGlob(String pattern, Configuration conf) PathData[] items = null; if (stats == null) { + // remove any quoting in the glob pattern + pattern = pattern.replaceAll("\\\\(.)", "$1"); // not a glob & file not found, so add the path with a null stat items = new PathData[]{ new PathData(fs, pattern, null) }; } else {