diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 7e238772247..170ea3f8d16 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -25,6 +25,9 @@ Release 0.23.1 - Unreleased HADOOP-7787. Make source tarball use conventional name. (Bruno Mahé via tomwhite) + HADOOP-6614. RunJar should provide more diags when it can't create + a temp file. (Jonathan Hsieh via eli) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java index 46993e16aac..e6c6a14eeae 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java @@ -149,7 +149,17 @@ public class RunJar { File tmpDir = new File(new Configuration().get("hadoop.tmp.dir")); ensureDirectory(tmpDir); - final File workDir = File.createTempFile("hadoop-unjar", "", tmpDir); + File workDir; + try { + workDir = File.createTempFile("hadoop-unjar", "", tmpDir); + } catch (IOException ioe) { + // if user has insufficient perms to write to tmpDir, default + // "Permission denied" message doesn't specify a filename. + System.err.println("Error creating temp dir in " + tmpDir + " due to " + + ioe.getMessage()); + System.exit(-1); + } + if (!workDir.delete()) { System.err.println("Delete failed for " + workDir); System.exit(-1);