hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daryn Sharp (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-2685) hadoop fs -ls globbing gives inconsistent exit code
Date Tue, 03 Jan 2012 15:50:39 GMT

    [ https://issues.apache.org/jira/browse/HDFS-2685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178791#comment-13178791
] 

Daryn Sharp commented on HDFS-2685:
-----------------------------------

Incorrect exit codes in 205 and earlier are pretty pervasive.  I did a complete overhaul of
FsShell on 23/trunk that fixed this issue and many many others.  In general, an as-is back
port of the new shell should be moderately trivial.  However, it'll be a dicey change since
it contains a number of "incompatible" output changes to make it more shell-like.  Reverting
the output to be 205-compatible will be difficult since all commands now use common code to
make the output more consistent.

I'll gladly answer questions if anyone would like to take on this jira and runs into issues.
                
> hadoop fs -ls globbing gives inconsistent exit code
> ---------------------------------------------------
>
>                 Key: HDFS-2685
>                 URL: https://issues.apache.org/jira/browse/HDFS-2685
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 0.20.2, 0.20.204.0, 0.20.205.0
>            Reporter: Mitesh Singh Jat
>
> _hadoop fs -ls_ command gives exit code for globbed input path, which is the exit code
for the last resolved absolute path. Whereas _ls_ command always give same exit code regardless
of position of non-existent path in globbing.
> {code}$ hadoop fs -mkdir input/20110{1,2,3}/{A,B,C,D}/{1,2} {code}
> Since directory 'input/201104/' is not present, the following command gives 255 as exit
code.
> {code}$ hadoop fs -ls input/20110{1,2,3,4}/ ; echo $? {code}
> {noformat}
> Found 4 items
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201101/A
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201101/B
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201101/C
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201101/D
> Found 4 items
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201102/A
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201102/B
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201102/C
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201102/D
> Found 4 items
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201103/A
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201103/B
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201103/C
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201103/D
> ls: Cannot access input/201104/: No such file or directory.
> 255
> {noformat}
> The directory 'input/201104/' is not present but given as second last parameter in globbing.
> The following command gives 0 as exit code, because directory 'input/201103/' is present.
> {code}$ hadoop fs -ls input/20110{1,2,4,3}/ ; echo $? {code}
> {noformat}
> Found 4 items
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201101/A
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201101/B
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201101/C
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201101/D
> Found 4 items
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201102/A
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201102/B
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201102/C
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201102/D
> ls: Cannot access input/201104/: No such file or directory.
> Found 4 items
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201103/A
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201103/B
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201103/C
> drwxr-xr-x   - mitesh supergroup          0 2011-12-15 11:51 /user/mitesh/input/201103/D
> 0
> {noformat}
> Whereas, on Linux, ls command gives non-zero(2) as exit code, irrespective of position
of non-existent path in globbing.
> {code}$ mkdir -p input/20110{1,2,3,4}/{A,B,C,D}/{1,2} {code}
> {code}$ ls input/20110{1,2,4,3}/ ; echo $? {code}
> {noformat}
> /bin/ls: input/201104/: No such file or directory
> input/201101/:
> ./  ../  A/  B/  C/  D/
> input/201102/:
> ./  ../  A/  B/  C/  D/
> input/201103/:
> ./  ../  A/  B/  C/  D/
> 2
> {noformat}
> {code}$ ls input/20110{1,2,3,4}/ ; echo $? {code}
> {noformat}
> /bin/ls: input/201104/: No such file or directory
> input/201101/:
> ./  ../  A/  B/  C/  D/
> input/201102/:
> ./  ../  A/  B/  C/  D/
> input/201103/:
> ./  ../  A/  B/  C/  D/
> 2
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message