You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:50:08 UTC

svn commit: r1077738 - in /hadoop/common/branches/branch-0.20-security-patches/src: core/org/apache/hadoop/fs/ mapred/org/apache/hadoop/filecache/ test/org/apache/hadoop/mapred/ test/testshell/

Author: omalley
Date: Fri Mar  4 04:50:07 2011
New Revision: 1077738

URL: http://svn.apache.org/viewvc?rev=1077738&view=rev
Log:
commit 26b2b48dd7f6e72ec6ba58de0c9db2573a9d795b
Author: Devaraj Das <dd...@yahoo-inc.com>
Date:   Thu Oct 21 11:48:47 2010 -0700

    . Restores the behavior of recursive chmod for Distributed Cache archives.
    
    +++ b/YAHOO-CHANGES.txt
    +Release 0.20.201.4 - unreleased
    +
    +     Restores the behavior of recursive chmod for Distributed
    +    Cache archives. (ddas)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileUtil.java
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestCommandLineJobSubmission.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/testshell/ExternalMapReduce.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileUtil.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileUtil.java?rev=1077738&r1=1077737&r2=1077738&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileUtil.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileUtil.java Fri Mar  4 04:50:07 2011
@@ -721,7 +721,7 @@ public class FileUtil {
    * @throws InterruptedException
    */
   public static int chmod(String filename, String perm, boolean recursive)
-                            throws IOException, InterruptedException {
+                            throws IOException {
     StringBuffer cmdBuf = new StringBuffer();
     cmdBuf.append("chmod ");
     if (recursive) {

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java?rev=1077738&r1=1077737&r2=1077738&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java Fri Mar  4 04:50:07 2011
@@ -502,6 +502,7 @@ public class TrackerDistributedCacheMana
         // else will not do anyhting
         // and copy the file into the dir as it is
       }
+      FileUtil.chmod(destDir.toString(), "ugo+rx", true);
     }
     // promote the output to the final location
     if (!localFs.rename(workDir, finalDir)) {

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestCommandLineJobSubmission.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestCommandLineJobSubmission.java?rev=1077738&r1=1077737&r2=1077738&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestCommandLineJobSubmission.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestCommandLineJobSubmission.java Fri Mar  4 04:50:07 2011
@@ -96,11 +96,13 @@ public class TestCommandLineJobSubmissio
       libjars[1] = fs.getUri().resolve(cachePath + "/test.jar").toString();
       
       // construct options for -archives
-      String[] archives = new String[3];
+      String[] archives = new String[4];
       archives[0] = tgzPath.toString();
       archives[1] = tarPath + "#tarlink";
       archives[2] = 
         fs.getUri().resolve(cachePath + "/test.zip#ziplink").toString();
+      archives[3] = 
+        fs.getUri().resolve(cachePath + "/test.jar#jarlink").toString();
       
       String[] args = new String[8];
       args[0] = "-files";

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java?rev=1077738&r1=1077737&r2=1077738&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java Fri Mar  4 04:50:07 2011
@@ -579,13 +579,9 @@ public class TestTaskTrackerLocalization
     out.writeBytes("dummy input");
     out.close();
     // no write permission for subDir and subDir/file
-    try {
-      int ret = 0;
-      if((ret = FileUtil.chmod(subDir.toUri().getPath(), "a=rx", true)) != 0) {
-        LOG.warn("chmod failed for " + subDir + ";retVal=" + ret);
-      }
-    } catch(InterruptedException e) {
-      LOG.warn("Interrupted while doing chmod for " + subDir);
+    int ret = 0;
+    if((ret = FileUtil.chmod(subDir.toUri().getPath(), "a=rx", true)) != 0) {
+      LOG.warn("chmod failed for " + subDir + ";retVal=" + ret);
     }
   }
 

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/testshell/ExternalMapReduce.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/testshell/ExternalMapReduce.java?rev=1077738&r1=1077737&r2=1077738&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/testshell/ExternalMapReduce.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/testshell/ExternalMapReduce.java Fri Mar  4 04:50:07 2011
@@ -18,6 +18,7 @@
 
 package testshell;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.Iterator;
 
@@ -73,7 +74,7 @@ public class ExternalMapReduce extends C
       //fork off ls to see if the file exists.
       // java file.exists() will not work on 
       // cygwin since it is a symlink
-      String[] argv = new String[7];
+      String[] argv = new String[8];
       argv[0] = "ls";
       argv[1] = "files_tmp";
       argv[2] = "localfilelink";
@@ -81,6 +82,7 @@ public class ExternalMapReduce extends C
       argv[4] = "tarlink";
       argv[5] = "ziplink";
       argv[6] = "test.tgz";
+      argv[7] = "jarlink";
       Process p = Runtime.getRuntime().exec(argv);
       int ret = -1;
       try {
@@ -91,6 +93,10 @@ public class ExternalMapReduce extends C
       if (ret != 0) {
         throw new IOException("files_tmp does not exist");
       }
+      File file = new File("./jarlink/test.txt");
+      if (!file.canExecute()) {
+        throw new IOException("jarlink/test.txt is not executable");
+      }
     }
   }