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

Brandon Li commented on HADOOP-8956:
------------------------------------

The patch looks good. Some minor comments: 
1. isValidFileNameOnPlatform() only does check for Windows and always returns 
true for non-windows platform. Though it's good enough for this tests, it's 
better update this method's javadoc or name to reflect its real functionality 
(since on Linux, at least '/' and '\0' are not valid file name). 
2. it takes some mental effort to understand the WIN_INVALID_FILE_NAME_PATTERN. 
:-) 
Searching online, I found a similar pattern with comments which makes it easier 
to understand. http://stackoverflow.com/a/6804755
{noformat}
    Pattern pattern = Pattern.compile(
        "# Match a valid Windows filename (unspecified file system).          
\n" +
        "^                                # Anchor to start of string.        
\n" +
        "(?!                              # Assert filename is not: CON, PRN, 
\n" +
        "  (?:                            # AUX, NUL, COM1, COM2, COM3, COM4, 
\n" +
        "    CON|PRN|AUX|NUL|             # COM5, COM6, COM7, COM8, COM9,     
\n" +
        "    COM[1-9]|LPT[1-9]            # LPT1, LPT2, LPT3, LPT4, LPT5,     
\n" +
        "  )                              # LPT6, LPT7, LPT8, and LPT9...     
\n" +
        "  (?:\\.[^.]*)?                  # followed by optional extension    
\n" +
        "  $                              # and end of string                 
\n" +
        ")                                # End negative lookahead assertion. 
\n" +
        "[^<>:\"/\\\\|?*\\x00-\\x1F]*     # Zero or more valid filename 
chars.\n" +
        "[^<>:\"/\\\\|?*\\x00-\\x1F\\ .]  # Last char is not a space or dot.  
\n" +
        "$                                # Anchor to end of string.            
", 
        Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS);
{noformat}
                
> FileSystem.primitiveMkdir failures on Windows cause multiple test suites to 
> fail
> --------------------------------------------------------------------------------
>
>                 Key: HADOOP-8956
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8956
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: trunk-win
>            Reporter: Chris Nauroth
>            Assignee: Chris Nauroth
>         Attachments: HADOOP-8956-branch-trunk-win.patch, 
> HADOOP-8956-branch-trunk-win.patch
>
>
> Multiple test suites fail on Windows in calls to FileSystem.primitiveMkdir.

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