[
https://issues.apache.org/jira/browse/HADOOP-7974?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eli Collins updated HADOOP-7974:
--------------------------------
Component/s: test
> TestViewFsTrash incorrectly determines the user's home directory
> ----------------------------------------------------------------
>
> Key: HADOOP-7974
> URL: https://issues.apache.org/jira/browse/HADOOP-7974
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs, test
> Affects Versions: 0.23.1
> Reporter: Eli Collins
> Assignee: Harsh J
> Fix For: 0.23.1
>
> Attachments: HADOOP-7974.patch
>
>
> 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).
> {code}
> // 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);
> {code}
> 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.
--
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