Issue Details (XML | Word | Printable)

Key: HADOOP-2190
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Mahadev konar
Reporter: Mukund Madhugiri
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

dfs ls and lsr commands differ from POSIX standards

Created: 12/Nov/07 06:56 PM   Updated: 08/Jul/09 04:42 PM
Component/s: None
Affects Version/s: 0.15.1, 0.16.0
Fix Version/s: 0.17.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works HADOOP-2190-1.patch 2007-11-16 12:03 AM Lohit Vijayarenu 4 kB
Text File Licensed for inclusion in ASF works HADOOP-2190-2.patch 2007-11-18 07:31 AM Lohit Vijayarenu 8 kB
Text File Licensed for inclusion in ASF works Hadoop-2190_1.patch 2008-02-13 06:52 PM Mahadev konar 2 kB
Text File Licensed for inclusion in ASF works Hadoop-2190_2.patch 2008-02-13 07:15 PM Mahadev konar 3 kB
Issue Links:
Cloners
 
Dependants
 

Resolution Date: 13/Feb/08 09:14 PM


 Description  « Hide
Assuming the dfs commands follow POSIX standards, there are some problems with the DFS ls and lsr commands. I compared the DFS output with that of RHEL 4u5

1. ls a directory when there are no files/directories in that directory:
Linux: No output
DFS: Found 0 items

2. ls a file/directory that does not exist:
Linux: ls: /doesnotexist: No such file or directory
DFS: Found 0 items

3. lsr a directory that does not exist:
Linux: ls: /doesnotexist: No such file or directory
DFS: No output



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Lohit Vijayarenu added a comment - 16/Nov/07 12:03 AM
Attached patch throws out error for ls, lsr, du, dus commands for non-existing files. There were 2 changes DistributedFileSyste.listPaths() was not returning null for non-existing files and FileSystem.listPaths() was consuming null returned from underlying listPaths and returning zero length Path[] array. So, I have made changes at few places so that listPaths returns null when required. I ran the tests and they look good. If anyone could take a look at the changes and approve it, I will prepare test cases and update another patch. The issue reported was also seen on local filesystem. fixing the second issue also takes care of local filesystem.

Below is the output after the patch

ls/lsr command 
[ hadoop-trunk]$ hadoop dfs -ls empty
Found 0 items
[ hadoop-trunk]$ hadoop dfs -ls nofile
ls: Could not get listing for nofile
[ hadoop-trunk]$ hadoop dfs -lsr nofile
lsr: Could not get listing for nofile

du command
[ hadoop-trunk]$ hadoop dfs -du empty
Found 0 items
[ hadoop-trunk]$ hadoop dfs -du nofile
du: Could not get listing for nofile

[ hadoop-trunk]$ hadoop dfs -dus empty
empty   0
[ hadoop-trunk]$ hadoop dfs -dus nofile
dus: dus: No match: nofile
[ hadoop-trunk]$

Mukund Madhugiri added a comment - 16/Nov/07 01:45 AM
Can the command output be along the lines of what we see on linux?

RHEL throws this:
ls: /doesnotexist: No such file or directory


Lohit Vijayarenu added a comment - 16/Nov/07 07:11 AM
sure, if patch is approved I will make these changes while adding testcase.

dhruba borthakur added a comment - 16/Nov/07 10:09 PM
It will be a good idea to remove the dependency of this patch on the deprecated FileSystem.listPath API

Lohit Vijayarenu added a comment - 18/Nov/07 07:31 AM
Another patch, which now calls listStatus instead of deprecated listPaths(Path) . updated test case and changes suggested by Mukund.

Mahadev konar added a comment - 13/Feb/08 06:52 PM
this patch fixes the issue but only on the FsShell side.The previous patch fix it on the filesystem side which would requrioe changes to all the filesysstems. Also, this just checks to see if the directory/ does not exist only if it gets 0 listings from listStatus.

Mahadev konar added a comment - 13/Feb/08 07:15 PM
this one takes care of globbing of non existent globs and returns an error, also added a test case for that.

Lohit Vijayarenu added a comment - 13/Feb/08 07:23 PM
+1 looks good.

Hadoop QA added a comment - 13/Feb/08 08:47 PM
+1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12375521/Hadoop-2190_2.patch
against trunk revision 619744.

@author +1. The patch does not contain any @author tags.

tests included +1. The patch appears to include 5 new or modified tests.

javadoc +1. The javadoc tool did not generate any warning messages.

javac +1. The applied patch does not generate any new javac compiler warnings.

release audit +1. The applied patch does not generate any new release audit warnings.

findbugs +1. The patch does not introduce any new Findbugs warnings.

core tests +1. The patch passed core unit tests.

contrib tests +1. The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1789/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1789/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1789/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1789/console

This message is automatically generated.


Raghu Angadi added a comment - 13/Feb/08 09:14 PM
just committed this. Thanks Mahadev!

Hudson added a comment - 14/Feb/08 12:03 PM