From 8336b05ec89af8f80314982a19d97acc76eee0db Mon Sep 17 00:00:00 2001 From: Todd Lipcon Date: Mon, 6 Jun 2011 20:58:14 +0000 Subject: [PATCH] HADOOP-7325. The hadoop command should not accept class names starting with a hyphen. Contributed by Brock Noland. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1132769 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ bin/hadoop | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index e2d5828c4a..48d6175f74 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -532,6 +532,9 @@ Release 0.22.0 - Unreleased HADOOP-7335. Force entropy to come from non-true random for tests. (todd via eli) + HADOOP-7325. The hadoop command should not accept class names starting with + a hyphen. (Brock Noland via todd) + OPTIMIZATIONS HADOOP-6884. Add LOG.isDebugEnabled() guard for each LOG.debug(..). diff --git a/bin/hadoop b/bin/hadoop index 88c49eb3c2..e1eaedc686 100755 --- a/bin/hadoop +++ b/bin/hadoop @@ -109,6 +109,10 @@ case $COMMAND in CLASS=org.apache.hadoop.tools.HadoopArchives CLASSPATH=${CLASSPATH}:${TOOL_PATH} HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS" + elif [[ "$COMMAND" = -* ]] ; then + # class and package names cannot begin with a - + echo "Error: No command named \`$COMMAND' was found. Perhaps you meant \`hadoop ${COMMAND#-}'" + exit 1 else CLASS=$COMMAND fi