hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsz Wo (Nicholas), SZE (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-8173) FsShell needs to handle quoted metachars
Date Thu, 15 Mar 2012 21:06:38 GMT

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

Tsz Wo (Nicholas), SZE commented on HADOOP-8173:
------------------------------------------------

I tested it with the following:
{code}
  public static void main(String[] args) throws IOException {
    File f = new File("a.txt");
    final BufferedReader in = new BufferedReader(new FileReader(f));
    for(String line; (line = in.readLine()) != null;) {
      testPattern(line);
    }
  }
  
  static String testPattern(String s) {
    System.out.print("replace " + s);
    s = s.replaceAll("\\\\(.)", "$1");
    System.out.println(" to " + s);
    return s;
  }
{code}
and the result is 
{noformat}
replace foo* to foo*
replace foo\* to foo*
replace foo\\* to foo\*
replace foo\\\* to foo\*
replace foo\ to foo\
replace foo\\ to foo\
replace foo\\\ to foo\\
replace foo\** to foo**
replace foo*bar to foo*bar
replace foo\*bar to foo*bar
replace foo\\*bar to foo\*bar
replace foo\\\*bar to foo\*bar
replace foo\bar to foobar
replace foo\\bar to foo\bar
replace foo\\\bar to foo\bar
replace foo\**bar to foo**bar
replace foo*bar* to foo*bar*
replace foo\*bar\* to foo*bar*
replace foo\\*bar\\* to foo\*bar\*
replace foo\\\*bar\\\* to foo\*bar\*
replace foo\bar\ to foobar\
replace foo\\bar\\ to foo\bar\
replace foo\\\bar\\\ to foo\bar\\
replace foo\**bar\** to foo**bar**
{noformat}
Do you think that they are all expected?
                
> FsShell needs to handle quoted metachars
> ----------------------------------------
>
>                 Key: HADOOP-8173
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8173
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs
>    Affects Versions: 0.24.0, 0.23.2
>            Reporter: Daryn Sharp
>            Assignee: Daryn Sharp
>         Attachments: HADOOP-8173.patch
>
>
> Commands that access paths with quoted metachars work correctly, however commands that
create paths with quoted metachars leave the \ in the path.  Ex. 
> {noformat}
> fs -mkdir "foo\*bar" will create "foo\*bar" instead of "foo*bar".
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message