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

Ivan Mitic updated HADOOP-9364:
-------------------------------

    Attachment: HADOOP-9364.branch-trunk-win.pathdata.patch

Attaching the fix and the test that validates the fix.

Problem is in {{PathData#expandAsGlob}} and is caused by {{new 
File(path).isAbsolute()}} returning false for absolute paths on Windows.

For example:
{code}
new File("/dir1").isAbsolute() == false
{code}

Fix is to use {{Path#isAbsolute}} instead as we already invested into making 
Path work well cross platform.

Additional problem I had to address is passing "." to PathData#expandAsGlob. 
Passing "." to Path constructor will run it thru the URI normalization which 
will leave an empty string only. Passing an empty string to {{new 
File("").isAbsolute()}} works fine and returns false, however, {{new 
Path("").isAbsolute()}} throws.

The patch fixes all TestHDFSCli test cases expect for the below ones 
(HADOOP-8139 is tracking those).
2013-03-05 01:43:25,967 INFO  cli.CLITestHelper 
(CLITestHelper.java:displayResults(239)) - 26: ls: Negative test for quoted 
/*/* globbing 
2013-03-05 01:43:25,967 INFO  cli.CLITestHelper 
(CLITestHelper.java:displayResults(239)) - 27: ls: Test for quoted globbing 
2013-03-05 01:43:25,967 INFO  cli.CLITestHelper 
(CLITestHelper.java:displayResults(239)) - 28: rm: Test for quoted globbing

                
> PathData#expandAsGlob does not return correct results for absolute paths on 
> Windows
> -----------------------------------------------------------------------------------
>
>                 Key: HADOOP-9364
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9364
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: trunk-win
>            Reporter: Ivan Mitic
>            Assignee: Ivan Mitic
>         Attachments: HADOOP-9364.branch-trunk-win.pathdata.patch
>
>
> This causes {{FsShell ls}} not to work properly for absolute paths. For 
> example:
> {code}
> -fs hdfs://127.0.0.1:58559 -ls -R /dir0
> {code}
> returns
> {code}
> drwxr-xr-x   - ivanmi supergroup          0 2013-03-05 11:15 ../../dir0/dir1
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to