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

Doug Cutting commented on HADOOP-8139:
--------------------------------------

I suspect that simply removing this will break things on Windows.  Windows 
directory listings return paths with backslashes as the directory separator, 
but URIs expect slashes as directory separators, and Java on Windows permits 
slashes as directory separators.

An approach to fixing this might be to change RawLocalFileSystem#listStatus() 
to replace backslash with slash on Windows, then remove this in 
Path#normalizePath().  Slash is reserved in Windows path names, so this should 
be safe there.

There are probably other places that would need fixing too.  On Windows, paths 
from the classpath and environment will contain backslashes that confuse the 
directory parsing of Path and URI.  So we'd need to find each place such a path 
enters and perform substitution there.

                
> 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
>            Priority: Blocker
>
> 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