hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1348967 - in /hadoop/common/branches/branch-1-win: ./ src/mapred/org/apache/hadoop/mapred/ src/test/org/apache/hadoop/mapred/
Date Mon, 11 Jun 2012 19:03:51 GMT
Author: acmurthy
Date: Mon Jun 11 19:03:51 2012
New Revision: 1348967

URL: http://svn.apache.org/viewvc?rev=1348967&view=rev
Log:
MAPREDUCE-4321. Fix both DCE & LCE to use File.getAbsolutePath of the taskjvm.(sh,cmd)
to ensure it works on Windows. Contributed by Ivan Mitic.

Modified:
    hadoop/common/branches/branch-1-win/CHANGES.txt
    hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/DefaultTaskController.java
    hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java
    hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/TaskController.java
    hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestSetupWorkDir.java

Modified: hadoop/common/branches/branch-1-win/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/CHANGES.txt?rev=1348967&r1=1348966&r2=1348967&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1-win/CHANGES.txt Mon Jun 11 19:03:51 2012
@@ -28,6 +28,9 @@ branch-hadoop-1-win - unreleased
     HADOOP-8424. Fix classpath so that web-ui works on Windows. (Bikas Saha
     via acmurthy) 
 
+    MAPREDUCE-4321. Fix both DCE & LCE to use File.getAbsolutePath of the
+    taskjvm.(sh,cmd) to ensure it works on Windows. (Ivan Mitic via acmurthy)
+
 Release 1.1.0 - unreleased
 
   NEW FEATURES

Modified: hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/DefaultTaskController.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/DefaultTaskController.java?rev=1348967&r1=1348966&r2=1348967&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/DefaultTaskController.java
(original)
+++ hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/DefaultTaskController.java
Mon Jun 11 19:03:51 2012
@@ -124,7 +124,7 @@ public class DefaultTaskController exten
           TaskTracker.getPrivateDirTaskScriptLocation(user, jobId, attemptId),
           getConf()), COMMAND_FILE);
 
-      String commandFile = writeCommand(cmdLine, rawFs, p);
+      String commandFile = writeCommand(cmdLine, rawFs, p).getAbsolutePath();
       rawFs.setPermission(p, TaskController.TASK_LAUNCH_SCRIPT_PERMISSION);
       shExec = new ShellCommandExecutor(Shell.WINDOWS? new String[]{"cmd", "/c", commandFile}
:
           new String[]{"bash", "-c", commandFile},

Modified: hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java?rev=1348967&r1=1348966&r2=1348967&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java
(original)
+++ hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java
Mon Jun 11 19:03:51 2012
@@ -218,7 +218,7 @@ class LinuxTaskController extends TaskCo
       Path p = new Path(allocator.getLocalPathForWrite(
           TaskTracker.getPrivateDirTaskScriptLocation(user, jobId, attemptId),
           getConf()), COMMAND_FILE);
-      String commandFile = writeCommand(cmdLine, rawFs, p); 
+      String commandFile = writeCommand(cmdLine, rawFs, p).getAbsolutePath(); 
 
       String[] command = 
         new String[]{taskControllerExe, 

Modified: hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/TaskController.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/TaskController.java?rev=1348967&r1=1348966&r2=1348967&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/TaskController.java
(original)
+++ hadoop/common/branches/branch-1-win/src/mapred/org/apache/hadoop/mapred/TaskController.java
Mon Jun 11 19:03:51 2012
@@ -214,7 +214,7 @@ public abstract class TaskController imp
   // could potentially contain strings defined by a user. Hence, to
   // prevent special character attacks, we write the command line to
   // a file and execute it.
-  protected static String writeCommand(String cmdLine, FileSystem fs,
+  protected static File writeCommand(String cmdLine, FileSystem fs,
       Path commandFile) throws IOException {
     PrintWriter pw = null;
     LOG.info("Writing commands to " + commandFile);
@@ -230,7 +230,9 @@ public abstract class TaskController imp
         pw.close();
       }
     }
-    return commandFile.makeQualified(fs).toUri().getPath();
+    // Convert the result to a File and let Java convert the path to
+    // an appropriate OS shell path
+    return new File(commandFile.makeQualified(fs).toUri().getPath());
   }
   
   protected void logOutput(String output) {

Modified: hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestSetupWorkDir.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestSetupWorkDir.java?rev=1348967&r1=1348966&r2=1348967&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestSetupWorkDir.java
(original)
+++ hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestSetupWorkDir.java
Mon Jun 11 19:03:51 2012
@@ -104,7 +104,7 @@ public class TestSetupWorkDir extends Te
 
     // Make sure that the dir under myWorkDir is tmp
     assertTrue(fs.listStatus(myWorkDir)[0].getPath().toUri().getPath()
-               .toString().equals(myWorkDir.toString() + "/tmp"));
+               .equals(myWorkDir.toUri().getPath() + "/tmp"));
 
     // Make sure that myTargetDir is not changed/deleted
     assertTrue("Dir " + myTargetDir + " seem to be modified.",



Mime
View raw message