Yes, this is backwards; it was fixed in HADOOP-3792 and committed to trunk (0.19). -C

On Aug 6, 2008, at 10:44 PM, Frank Singleton wrote:

Hi,

According to docs, I thought dfs -test -e URI would return 0 if file exists,
but that does not appear to be the case.

- Fedora 9
- java
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)



test
Usage: hadoop dfs -test -[ezd] URI
Options:
-e check to see if the file exists. Return 0 if true.
-z check to see if the file is zero length. Return 0 if true
-d check return 1 if the path is directory else return 0.

This is what I get.

dfs -ls   return code is 0 , this is ok.

[EMAIL PROTECTED] hadoop-0.17.1]$ /home/hadoop/hadoop-0.17.1/bin/hadoop dfs -ls /frank/unittest/tmpGeKbCF.txt
Found 1 items
/frank/unittest/tmpGeKbCF.txt <r 3> 13 2008-08-06 23:57 rw-r--r-- frank supergroup
[EMAIL PROTECTED] hadoop-0.17.1]$ echo $?
0

Now run dfs -test -e on same file, note return code is 1

[EMAIL PROTECTED] hadoop-0.17.1]$
[EMAIL PROTECTED] hadoop-0.17.1]$ /home/hadoop/hadoop-0.17.1/bin/hadoop dfs -test -e /frank/unittest/tmpGeKbCF.txt
[EMAIL PROTECTED] hadoop-0.17.1]$ echo $?
1

This time try a file I know does not exist (I rrop the last char off the end of the filename for test)
Note the return code is 0

[EMAIL PROTECTED] hadoop-0.17.1]$
[EMAIL PROTECTED] hadoop-0.17.1]$ /home/hadoop/hadoop-0.17.1/bin/hadoop dfs -test -e /frank/unittest/tmpGeKbCF.tx
[EMAIL PROTECTED] hadoop-0.17.1]$ echo $?
0
[EMAIL PROTECTED] hadoop-0.17.1]$

Thanks / Frank



Reply via email to