From eec27822879dd151c6489771a717efdeaed6198e Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Mon, 21 Nov 2011 08:00:59 +0000 Subject: [PATCH] HADOOP-6614. RunJar should provide more diags when it can't create a temp file. Contributed by Jonathan Hsieh git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1204388 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 6 +++--- .../main/java/org/apache/hadoop/util/RunJar.java | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 44abba3a6f..83a2594551 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -118,9 +118,6 @@ Release 0.23.1 - Unreleased HADOOP-7802. Hadoop scripts unconditionally source "$bin"/../libexec/hadoop-config.sh. (Bruno Mahé via tomwhite) - HADOOP-6614. RunJar should provide more diags when it can't create - a temp file. (Jonathan Hsieh via eli) - OPTIMIZATIONS BUG FIXES @@ -131,6 +128,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 46993e16aa..a785cacc34 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,18 @@ public static void main(String[] args) throws Throwable { File tmpDir = new File(new Configuration().get("hadoop.tmp.dir")); ensureDirectory(tmpDir); - final File workDir = File.createTempFile("hadoop-unjar", "", tmpDir); + final 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 hadoop.tmp.dir " + + tmpDir + " due to " + ioe.getMessage()); + System.exit(-1); + return; + } + if (!workDir.delete()) { System.err.println("Delete failed for " + workDir); System.exit(-1);