Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-15233

PathData invalid relativize for root and root dir

Add voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7.3, 3.0.0
    • None
    • common, fs, tools
    • None
    • shell

    Description

      Let's say current working directory is set to "/"  (FileSystem.setCurrentWorkingDirectory()) and there is "/test" folder on HDFS.

      when I call

      org.apache.hadoop.fs.shell.PathData.expandAsGlob("test", new Configuration());
      
      

      (the relative path to test is an intention)

      then I get PathData with a "../test" path. But such path is invalid. The problem is probably inside Path.relativize method, where for "/" and "test" the "../test" is produced.

       

      What I really  want is to call "rm -R test" command with cwd set to root ("/"), but it won't work because command expands it to invalid path (DFSUtil.isValidName(result) is false).

      Using relative paths will work fine for another cwd except the root. This is just the only special case for which it fails.

      Stacktrace attached for more details.

       

      Attachments

        1. stacktrace.txt
          2 kB
          George Smith

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            cabot George Smith

            Dates

              Created:
              Updated:

              Slack

                Issue deployment