Xiaoyu Yao created HADOOP-12290: ----------------------------------- Summary: hadoop fs -ls command returns inconsistent results with wildcards Key: HADOOP-12290 URL: https://issues.apache.org/jira/browse/HADOOP-12290 Project: Hadoop Common Issue Type: Bug Reporter: Xiaoyu Yao
I cannot find any document for wildcard support for "hadoop fs -ls" cmd and the expected behavior. So I did some experiments and got inconsistent results below. This looks like a bug to me. But if we don't support wildcard for "hadoop fs -ls", we should at least document it. On a single node cluster with "fs.default.name" configured as hdfs://localhost:9000. Root without wildcard: HDFS only. {code} $ hdfs dfs -ls / Found 11 items drwxrwxrwx - xyao hadoop 0 2015-07-28 15:27 /data drwxr-xr-x - xyao hadoop 0 2015-07-26 23:05 /noez drwxr-xr-x - xyao hadoop 0 2015-07-29 17:33 /path3 drwxrwxrwx - xyao hadoop 0 2015-07-26 23:04 /tmp drwx------ - xyao hadoop 0 2015-07-26 23:03 /user drwxr-xr-x - xyao hadoop 0 2015-07-29 17:34 /uu drwxr-xr-x - xyao hadoop 0 2015-07-26 23:08 /z1_1 drwxr-xr-x - xyao hadoop 0 2015-07-26 21:43 /z1_2new drwxr-xr-x - xyao hadoop 0 2015-07-26 22:00 /z2_0 drwxr-xr-x - xyao hadoop 0 2015-07-26 21:43 /z2_1 drwxr-xr-x - xyao hadoop 0 2015-07-26 21:55 /z2_2 {code} Root with wildcard: HDFS and local. {code} $ hadoop fs -ls /* ls: `/Applications': No such file or directory ls: `/Library': No such file or directory ls: `/Network': No such file or directory ls: `/System': No such file or directory ls: `/User Information': No such file or directory ls: `/Users': No such file or directory ls: `/Volumes': No such file or directory ls: `/bin': No such file or directory ls: `/dev': No such file or directory ls: `/etc': No such file or directory ls: `/home': No such file or directory ls: `/mach_kernel': No such file or directory ls: `/net': No such file or directory ls: `/opt': No such file or directory ls: `/private': No such file or directory ls: `/proc': No such file or directory ls: `/sbin': No such file or directory ls: `/test.jks': No such file or directory Found 3 items drwxrwxrwx - xyao hadoop 0 2015-07-22 10:48 /tmp/test drwxrwxrwx - xyao hadoop 0 2015-07-22 10:50 /tmp/test drwxrwxrwx - xyao hadoop 0 2015-07-22 10:49 /tmp/test hello ls: `/usr': No such file or directory ls: `/var': No such file or directory {code} Wildcard with prefix 1: HDFS and Local. But HDFS goes one level down. {code} HW11217:hadoop-hdfs-project xyao$ hadoop fs -ls /t* ls: `/test.jks': No such file or directory Found 3 items drwxrwxrwx - xyao hadoop 0 2015-07-22 10:48 /tmp/test drwxrwxrwx - xyao hadoop 0 2015-07-22 10:50 /tmp/test drwxrwxrwx - xyao hadoop 0 2015-07-22 10:49 /tmp/test hello {code} Wildcard and prefix 2: Empty result even though HDFS does have a few directories starts with "z" as shown above. {code} hadoop fs -ls /z* {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)