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 "Jason Lowe (JIRA)" <ji...@apache.org> on 2015/07/31 00:45:04 UTC

[jira] [Resolved] (HADOOP-12290) hadoop fs -ls command returns inconsistent results with wildcards

     [ https://issues.apache.org/jira/browse/HADOOP-12290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Lowe resolved HADOOP-12290.
---------------------------------
    Resolution: Invalid

This appears to be pilot error rather than a bug in Hadoop.  The wildcards are not quoted and therefore the shell is expanding them _before_ Hadoop even sees the wildcard.  You must be running on a Mac, which would explain why it's trying to lookup things like /Applications, /Library, /System, etc.  This needs to be something like:
{noformat}
hadoop fs -ls '/*'
{noformat}
to keep the shell from expanding it.

The same thing is occurring for the /t* case.

For the last case, the shell is not finding anything for /z* and therefore is passing it unexpanded to Hadoop, and Hadoop is expanding it to the various z* directories.  However I suspect all of those directories are empty, so it lists nothing as a result.

Closing as invalid.  Please reopen if there's a real issue here.

> 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)