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:21:49 UTC
svn commit: r704818 - in /hadoop/core/trunk: CHANGES.txt
src/core/org/apache/hadoop/fs/FileUtil.java
Author: ddas
Date: Wed Oct 15 02:21:49 2008
New Revision: 704818
URL: http://svn.apache.org/viewvc?rev=704818&view=rev
Log:
HADOOP-4410. Adds an extra arg to the API FileUtil.makeShellPath to determine whether to canonicalize file paths or not. Contributed by Amareshwari Sriramadasu.
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/core/org/apache/hadoop/fs/FileUtil.java
Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=704818&r1=704817&r2=704818&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Oct 15 02:21:49 2008
@@ -917,6 +917,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/trunk/src/core/org/apache/hadoop/fs/FileUtil.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/fs/FileUtil.java?rev=704818&r1=704817&r2=704818&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/fs/FileUtil.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/fs/FileUtil.java Wed Oct 15 02:21:49 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);