You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Mike Dillon (JIRA)" <ji...@apache.org> on 2008/05/01 01:42:55 UTC
[jira] Created: (HADOOP-3331) Return code for "hadoop dfs -test"
does not match standard return codes from System.exit
Return code for "hadoop dfs -test" does not match standard return codes from System.exit
----------------------------------------------------------------------------------------
Key: HADOOP-3331
URL: https://issues.apache.org/jira/browse/HADOOP-3331
Project: Hadoop Core
Issue Type: Bug
Components: fs
Environment: All
Reporter: Mike Dillon
Priority: Minor
The output of "hadoop dfs -test" does the opposite of what normal Unix commands to (which is also the opposite of the recommended return codes in the javadocs for System.exit). Normal commands return zero for success and non-zero for error, but "hadoop dfs -test" does this opposite. This makes writing shell scripts that use "hadoop dfs -test" clunky and unnatural since you can't do standard stuff like this:
{noformat}
if hadoop dfs -test -e /missing/file/name; then
# Do something only if the file exists
else
# Do something else if the file is missing
fi
{noformat}
Creating a patch for this would introduce a breaking change and would require changing the Ant DFS task as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (HADOOP-3331) Return code for "hadoop dfs -test"
does not match standard return codes from System.exit
Posted by "Chris Douglas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-3331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chris Douglas resolved HADOOP-3331.
-----------------------------------
Resolution: Duplicate
Duplicate of HADOOP-3792
> Return code for "hadoop dfs -test" does not match standard return codes from System.exit
> ----------------------------------------------------------------------------------------
>
> Key: HADOOP-3331
> URL: https://issues.apache.org/jira/browse/HADOOP-3331
> Project: Hadoop Core
> Issue Type: Bug
> Components: fs
> Environment: All
> Reporter: Mike Dillon
> Priority: Minor
>
> The output of "hadoop dfs -test" does the opposite of what normal Unix commands to (which is also the opposite of the recommended return codes in the javadocs for System.exit). Normal commands return zero for success and non-zero for error, but "hadoop dfs -test" does this opposite. This makes writing shell scripts that use "hadoop dfs -test" clunky and unnatural since you can't do standard stuff like this:
> {noformat}
> if hadoop dfs -test -e /missing/file/name; then
> # Do something only if the file exists
> else
> # Do something else if the file is missing
> fi
> {noformat}
> Creating a patch for this would introduce a breaking change and would require changing the Ant DFS task as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HADOOP-3331) Return code for "hadoop dfs -test"
does not match standard return codes from System.exit
Posted by "Ronen Botzer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-3331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645711#action_12645711 ]
Ronen Botzer commented on HADOOP-3331:
--------------------------------------
The [current documentation|http://hadoop.apache.org/core/docs/current/hdfs_shell.html#test] (0.18) states the exact opposite from the current behavior:
{noformat}
Usage: hadoop fs -test -[ezd] URI
Options:
-e check to see if the file exists. Return 0 if true.
{noformat}
In fact:
{noformat}
-bash-3.1$ hadoop fs -ls /user/rbotzer/
Found 1 items
-rw-r--r-- 2 rbotzer supergroup 7603 2008-11-06 23:05 /user/rbotzer/testlog
-bash-3.1$ # capture the exit status
-bash-3.1$ ./ec /user/rbotzer/testlog
hadoop fs -test -e /user/rbotzer/testlog
int(1)
{noformat}
> Return code for "hadoop dfs -test" does not match standard return codes from System.exit
> ----------------------------------------------------------------------------------------
>
> Key: HADOOP-3331
> URL: https://issues.apache.org/jira/browse/HADOOP-3331
> Project: Hadoop Core
> Issue Type: Bug
> Components: fs
> Environment: All
> Reporter: Mike Dillon
> Priority: Minor
>
> The output of "hadoop dfs -test" does the opposite of what normal Unix commands to (which is also the opposite of the recommended return codes in the javadocs for System.exit). Normal commands return zero for success and non-zero for error, but "hadoop dfs -test" does this opposite. This makes writing shell scripts that use "hadoop dfs -test" clunky and unnatural since you can't do standard stuff like this:
> {noformat}
> if hadoop dfs -test -e /missing/file/name; then
> # Do something only if the file exists
> else
> # Do something else if the file is missing
> fi
> {noformat}
> Creating a patch for this would introduce a breaking change and would require changing the Ant DFS task as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.