[
https://issues.apache.org/jira/browse/HADOOP-9417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13702679#comment-13702679
]
Colin Patrick McCabe commented on HADOOP-9417:
----------------------------------------------
looks good overall.
{code}
+ private String readLink(Path p) {
+ /* NB: Use readSymbolicLink in java.nio.file.Path once available. Could
+ * use getCanonicalPath in File to get the target of the symlink but that
+ * does not indicate if the given path refers to a symlink.
+ */
+ try {
+ final String path = p.toUri().getPath();
+ return Shell.execCommand(Shell.READ_LINK_COMMAND, path).trim();
+ } catch (IOException x) {
+ return "";
+ }
+ }
{code}
Silent failure seems like a bad idea here. We should at least be doing what we
do in the "FileNotFound" section of getFileLinkStatusInternal. Currently you
just pretend it isn't a symlink at all when an error happens... seems wrong.
from FileSystemTestWrapper.java:
{code}
@Override
public void mkdir(Path dir, FsPermission permission, boolean createParent)
throws AccessControlException, FileAlreadyExistsException,
FileNotFoundException, ParentNotDirectoryException,
UnsupportedFileSystemException, IOException {
// Note that there is no "mkdir" in FileSystem, it always does
// "mkdir -p" (creating parent directories).
fs.mkdirs(dir, permission);
}
{code}
Sorry, I guess I missed this in a previous review, but this should throw an
exception if createParent = false, no?
It bothers me that symlinks on the local filesystem can't link to other
filesystems. It seems inconsistent that I can't link, to, say hdfs://foo/bar
from file:///baz. But I will open another JIRA to discuss that.
> Support for symlink resolution in LocalFileSystem / RawLocalFileSystem
> ----------------------------------------------------------------------
>
> Key: HADOOP-9417
> URL: https://issues.apache.org/jira/browse/HADOOP-9417
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: fs
> Affects Versions: 3.0.0
> Reporter: Andrew Wang
> Assignee: Andrew Wang
> Attachments: hadoop-9417-1.patch, hadoop-9417-2.patch,
> hadoop-9417-3.patch, hadoop-9417-4.patch, hadoop-9417-5.patch
>
>
> Add symlink resolution support to LocalFileSystem/RawLocalFileSystem as well
> as tests.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira