Yang Jie created HADOOP-20068:
---------------------------------
Summary: RawLocalFileSystem#getFileLinkStatus and #getLinkTarget
miss symlinks when given a qualified file: path
Key: HADOOP-20068
URL: https://issues.apache.org/jira/browse/HADOOP-20068
Project: Hadoop Common
Issue Type: Bug
Components: fs
Reporter: Yang Jie
deprecatedGetFileLinkStatusInternal locates the link with {{new
File(f.toString())}}. For a qualified path such as file:/tmp/link that is a
relative file named "file:/tmp/link", so FileUtil.readLink() returns "" and:
* getFileLinkStatus(file:/tmp/link) on a live link returns the target's status
with isSymlink() false;
* on a dangling link it throws FileNotFoundException;
* getLinkTarget(file:/tmp/link) throws "Path ... is not a symbolic link".
This is the code path RawLocalFileSystem uses by default:
{{useDeprecatedFileStatus}} is only turned off by useStatIfAvailable(), which
is called only from tests. Paths returned by listStatus() are qualified, and
FileContext qualifies relative paths, so both reach it. The {{new
File(f.toString())}} came in with HADOOP-9527.
The fix uses pathToFile(f), which is how the rest of the method and the class
locate files.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]