[ https://issues.apache.org/jira/browse/HADOOP-8139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13224444#comment-13224444 ]
Daryn Sharp commented on HADOOP-8139: ------------------------------------- bq. It'd be nice to fix the problem for Windows users too. True, which I believe it would it in the small snippet above. For windows only, \ is converted to /, and the windows escape char ^ is converted to \. bq. Why not try fixing it in RawLocalFileSystem? I think that could work, but windows users who might be relying on "\my\hdfs\path" to work will be in for an incompatible surprise. While it might be the right long-term approach, I think presents more risk than conditionalizing the \ to / for now. bq. Thinking further, perhaps this is not a bug. Perhaps the user error is assuming that backslash is an escape character in paths. The escape character in URIs is %. Does this work with 'rm %2A'? No, it doesn't work because paths are not subject to percent encoding. Path has hybrid behavior of a URI and a File. Path is really only using a URI to hold the scheme and authority. The rest of the URI is considered a literal path. Percent encoding would require many non-alphanumeric characters to be escaped, including almost all of the glob metachars. Changing Path to require percent encoding would be extremely disruptive and incompatible. > 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