[ 
https://issues.apache.org/jira/browse/HADOOP-9887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13745158#comment-13745158
 ] 

Chuan Liu commented on HADOOP-9887:
-----------------------------------

I did some initial investigation on the issue.

I think the patch in HADOOP-9817 did not have the following check in the 
original {{FileSystem#globStatusInternal()}} method. The new relevant code is 
in {{Globber#glob()}}. As a result, Windows paths beginning with a drive letter 
no longer work with globStatus() method.

{code:java}
    // determine starting point
    int level = 0;
    String baseDir = Path.CUR_DIR;
    if (pathPattern.isAbsolute()) {
      level = 1; // need to skip empty item at beginning of split list
      baseDir = Path.SEPARATOR;
    }
{code}

I am not sure why we need the above check for Unix in original 
{{FileSystem#globStatusInternal()}} method. However, it does help to skip the 
drive letter that may appear in a Windows path. Without the equivalent logic, 
the code follows will fail for a path that begins with drive letter. 1) We 
divide the path into "components" separated by path separator; 2) we begin list 
from root, and add file/directory that matches the "component" for each 
"component" in the "components" list to the candidate list. For path begins 
with drive letter, the code will think the drive letter as some path on root 
directory; thus leads to the failure.
                
> globStatus does not correctly handle paths starting with a drive spec on 
> Windows
> --------------------------------------------------------------------------------
>
>                 Key: HADOOP-9887
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9887
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 3.0.0, 2.3.0
>            Reporter: Chris Nauroth
>
> Recent file system changes have caused globStatus to stop working for paths 
> starting with a drive spec on Windows.  The problem is most easily visible by 
> running {{TestFileUtil#createJarWithClassPath}} on Windows.  This method 
> attempts a globStatus with pattern {{*\{.jar,.JAR\}}}, and it no longer 
> correctly identifies files at the path ending in .jar or .JAR.

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