From 7ba49c56aa05eb63b4c03e23dfca508df2c9cef1 Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Thu, 23 May 2013 21:17:38 +0000 Subject: [PATCH] Merge changes r1453645 for HADOOP-9373, r1453675 for HADOOP-9376, r1453676 for HADOOP-9365, r1454108 for HADOOP-9364. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1485853 13f79535-47bb-0310-9956-ffa450edef68 --- .../CHANGES.branch-trunk-win.txt | 0 .../hadoop-common/CHANGES.txt | 8 +++++++ .../org/apache/hadoop/fs/shell/PathData.java | 3 ++- .../apache/hadoop/fs/shell/TestPathData.java | 21 +++++++++++++++++++ .../org/apache/hadoop/ha/TestHAZKUtil.java | 3 ++- .../hadoop/security/TestProxyUserFromEnv.java | 9 ++++++++ .../hadoop-hdfs/CHANGES.branch-trunk-win.txt | 0 .../CHANGES.branch-trunk-win.txt | 0 .../CHANGES.branch-trunk-win.txt | 0 9 files changed, 42 insertions(+), 2 deletions(-) delete mode 100644 hadoop-common-project/hadoop-common/CHANGES.branch-trunk-win.txt delete mode 100644 hadoop-hdfs-project/hadoop-hdfs/CHANGES.branch-trunk-win.txt delete mode 100644 hadoop-mapreduce-project/CHANGES.branch-trunk-win.txt delete mode 100644 hadoop-yarn-project/CHANGES.branch-trunk-win.txt diff --git a/hadoop-common-project/hadoop-common/CHANGES.branch-trunk-win.txt b/hadoop-common-project/hadoop-common/CHANGES.branch-trunk-win.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 72f0cb73154..92c004d009a 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -307,6 +307,14 @@ Release 2.0.5-beta - UNRELEASED HADOOP-9372. Fix bad timeout annotations on tests. (Arpit Agarwal via suresh) + HADOOP-9376. TestProxyUserFromEnv fails on a Windows domain joined machine. + (Ivan Mitic via suresh) + + HADOOP-9365. TestHAZKUtil fails on Windows. (Ivan Mitic via suresh) + + HADOOP-9364. PathData#expandAsGlob does not return correct results for + absolute paths on Windows. (Ivan Mitic via suresh) + Release 2.0.4-beta - UNRELEASED 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 ae719f5796d..88a90c6e6ff 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 @@ -338,7 +338,8 @@ public class PathData implements Comparable { URI globUri = globPath.toUri(); if (globUri.getScheme() != null) { globType = PathType.HAS_SCHEME; - } else if (new File(globUri.getPath()).isAbsolute()) { + } else if (!globUri.getPath().isEmpty() && + new Path(globUri.getPath()).isAbsolute()) { globType = PathType.SCHEMELESS_ABSOLUTE; } else { globType = PathType.RELATIVE; diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java index 320a79eccaa..3ddd68da23f 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java @@ -23,11 +23,13 @@ import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; +import java.net.URI; import java.util.Arrays; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.util.Shell; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -173,6 +175,25 @@ public class TestPathData { sortedString(testDir+"/d1/f1", testDir+"/d1/f1.1"), sortedString(items) ); + + String absolutePathNoDriveLetter = testDir+"/d1/f1"; + if (Shell.WINDOWS) { + // testDir is an absolute path with a drive letter on Windows, i.e. + // c:/some/path + // and for the test we want something like the following + // /some/path + absolutePathNoDriveLetter = absolutePathNoDriveLetter.substring(2); + } + items = PathData.expandAsGlob(absolutePathNoDriveLetter, conf); + assertEquals( + sortedString(absolutePathNoDriveLetter), + sortedString(items) + ); + items = PathData.expandAsGlob(".", conf); + assertEquals( + sortedString("."), + sortedString(items) + ); } @Test (timeout = 30000) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestHAZKUtil.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestHAZKUtil.java index 7b4d63ad963..90371f3730f 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestHAZKUtil.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestHAZKUtil.java @@ -40,7 +40,8 @@ public class TestHAZKUtil { "test-file"); /** A path which is expected not to exist */ - private static final String BOGUS_FILE = "/xxxx-this-does-not-exist"; + private static final String BOGUS_FILE = + new File("/xxxx-this-does-not-exist").getPath(); @Test public void testEmptyACL() { diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestProxyUserFromEnv.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestProxyUserFromEnv.java index b83f91b3065..65756fcdd39 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestProxyUserFromEnv.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestProxyUserFromEnv.java @@ -42,6 +42,15 @@ public class TestProxyUserFromEnv { BufferedReader br = new BufferedReader (new InputStreamReader(pp.getInputStream())); String realUser = br.readLine().trim(); + + // On Windows domain joined machine, whoami returns the username + // in the DOMAIN\\username format, so we trim the domain part before + // the comparison. We don't have to special case for Windows + // given that Unix systems do not allow slashes in usernames. + int backslashIndex = realUser.indexOf('\\'); + if (backslashIndex != -1) { + realUser = realUser.substring(backslashIndex + 1); + } assertEquals(realUser, realUgi.getUserName()); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.branch-trunk-win.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.branch-trunk-win.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hadoop-mapreduce-project/CHANGES.branch-trunk-win.txt b/hadoop-mapreduce-project/CHANGES.branch-trunk-win.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hadoop-yarn-project/CHANGES.branch-trunk-win.txt b/hadoop-yarn-project/CHANGES.branch-trunk-win.txt deleted file mode 100644 index e69de29bb2d..00000000000