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

TestViewFsTrash incorrectly determines the user's home directory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.23.1
    • 0.23.1
    • fs, test
    • None
    • Reviewed

    Description

      HADOOP-7284 added a test called TestViewFsTrash which contains the following code to determine the user's home directory. It only works if the user's directory is one level deep, and breaks if the home directory is more than one level deep (eg user hudson, who's home dir might be /usr/lib/hudson instead of /home/hudson).

          // create a link for home directory so that trash path works
          // set up viewfs's home dir root to point to home dir root on target
          // But home dir is different on linux, mac etc.
          // Figure it out by calling home dir on target
          
         String homeDir = fsTarget.getHomeDirectory().toUri().getPath();
         int indexOf2ndSlash = homeDir.indexOf('/', 1);
         String homeDirRoot = homeDir.substring(0, indexOf2ndSlash);
         ConfigUtil.addLink(conf, homeDirRoot,
             fsTarget.makeQualified(new Path(homeDirRoot)).toUri()); 
         ConfigUtil.setHomeDirConf(conf, homeDirRoot);
         Log.info("Home dir base " + homeDirRoot);
      

      Seems like we should instead search from the end of the path for the last slash and use that as the base, ie ask the home directory for its parent.

      Attachments

        1. HADOOP-7974.patch
          2 kB
          Harsh J

        Issue Links

          Activity

            People

              qwertymaniac Harsh J
              eli Eli Collins
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: