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 dd...@apache.org on 2008/10/15 11:29:45 UTC

svn commit: r704821 - in /hadoop/core/branches/branch-0.19: CHANGES.txt src/core/org/apache/hadoop/fs/FileUtil.java

Author: ddas
Date: Wed Oct 15 02:29:45 2008
New Revision: 704821

URL: http://svn.apache.org/viewvc?rev=704821&view=rev
Log:
Merge -r 704817:704818 from trunk onto 0.19 branch. Fixes HADOOP-4410.

Modified:
    hadoop/core/branches/branch-0.19/CHANGES.txt
    hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/FileUtil.java

Modified: hadoop/core/branches/branch-0.19/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/CHANGES.txt?rev=704821&r1=704820&r2=704821&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.19/CHANGES.txt Wed Oct 15 02:29:45 2008
@@ -863,6 +863,10 @@
     HADOOP-4376. Fix formatting in hadoop-default.xml for
     hadoop.http.filter.initializers. (Enis Soztutar via acmurthy) 
 
+    HADOOP-4410. Adds an extra arg to the API FileUtil.makeShellPath to
+    determine whether to canonicalize file paths or not.
+    (Amareshwari Sriramadasu via ddas)
+
 Release 0.18.2 - Unreleased
 
   BUG FIXES

Modified: hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/FileUtil.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/FileUtil.java?rev=704821&r1=704820&r2=704821&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/FileUtil.java (original)
+++ hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/FileUtil.java Wed Oct 15 02:29:45 2008
@@ -392,7 +392,24 @@
    * @throws IOException on windows, there can be problems with the subprocess
    */
   public static String makeShellPath(File file) throws IOException {
-    return makeShellPath(file.getCanonicalPath());
+    return makeShellPath(file, false);
+  }
+
+  /**
+   * Convert a os-native filename to a path that works for the shell.
+   * @param file The filename to convert
+   * @param makeCanonicalPath 
+   *          Whether to make canonical path for the file passed
+   * @return The unix pathname
+   * @throws IOException on windows, there can be problems with the subprocess
+   */
+  public static String makeShellPath(File file, boolean makeCanonicalPath) 
+  throws IOException {
+    if (makeCanonicalPath) {
+      return makeShellPath(file.getCanonicalPath());
+    } else {
+      return makeShellPath(file.toString());
+    }
   }
 
   /**
@@ -570,8 +587,8 @@
        hardLinkCommand[len-1] = target.getCanonicalPath();
        hardLinkCommand[len-2] = linkName.getCanonicalPath();
       } else {
-       hardLinkCommand[len-2] = makeShellPath(target);
-       hardLinkCommand[len-1] = makeShellPath(linkName);
+       hardLinkCommand[len-2] = makeShellPath(target, true);
+       hardLinkCommand[len-1] = makeShellPath(linkName, true);
       }
       // execute shell command
       Process process = Runtime.getRuntime().exec(hardLinkCommand);