[
https://issues.apache.org/jira/browse/HDFS-2685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ravi Prakash resolved HDFS-2685.
--------------------------------
Resolution: Won't Fix
I don't think we plan to fix this in the 0.20 or branch-1 line ever. Closing as
Won't Fix.
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)