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

Daryn Sharp commented on HADOOP-8139:
-------------------------------------

@Alexander - Yes, nearly every FsShell command supports unix style globs.  
"tail" is the only exception that comes to mind.  The problem is the subbing of 
\ to / rendered it impossible to quote metachars.  For instance, \ * turned 
into /*!

One of the problems I encountered with trying to modify RLFS is it seems, based 
only on reading, that local files may be returned with \ or with /.  If true, 
we probably don't want to blindly convert \ to /.

If we don't want the as-backwards-compatible-as-possible solution I tried to 
implement, we can try modifying RLFS to sub \ to / during File->Path conversion 
if File.separatorChar != Path.SEPARATOR.  RLFS will also need to override 
globStatus to convert \ to ^ for quoting of metachars.

I think this is doable as long as we are willing to sacrifice c:\dir\... in 23.
                
> Path does not allow metachars to be escaped
> -------------------------------------------
>
>                 Key: HADOOP-8139
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8139
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 0.23.0, 0.24.0
>            Reporter: Daryn Sharp
>            Assignee: Daryn Sharp
>            Priority: Blocker
>         Attachments: HADOOP-8139-2.patch, HADOOP-8139-3.patch, 
> HADOOP-8139-4.patch, HADOOP-8139-5.patch, HADOOP-8139-6.patch, 
> HADOOP-8139.patch, HADOOP-8139.patch
>
>
> Path converts "\" into "/", probably for windows support?  This means it's 
> impossible for the user to escape metachars in a path name.  Glob expansion 
> can have deadly results.
> Here are the most egregious examples. A user accidentally creates a path like 
> "/user/me/*/file".  Now they want to remove it.
> {noformat}"hadoop fs -rmr -skipTrash '/user/me/\*'" becomes...
> "hadoop fs -rmr -skipTrash /user/me/*"{noformat}
> * User/Admin: Nuked their home directory or any given directory
> {noformat}"hadoop fs -rmr -skipTrash '\*'" becomes...
> "hadoop fs -rmr -skipTrash /*"{noformat}
> * User:  Deleted _everything_ they have access to on the cluster
> * Admin: *Nukes the entire cluster*
> Note: FsShell is shown for illustrative purposes, however the problem is in 
> the Path object, not FsShell.

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

        

Reply via email to