LuciferYang opened a new pull request, #8932: URL: https://github.com/apache/hadoop/pull/8932
### Description of PR JIRA: https://issues.apache.org/jira/browse/HADOOP-20068 `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 an empty string. `getFileLinkStatus` then reports a live link as a regular file and throws `FileNotFoundException` for a dangling one, and `getLinkTarget` throws `is not a symbolic link`. This is the default code path: only `useStatIfAvailable()` switches it off, and only tests call it. Paths from `listStatus()` are qualified, and `FileContext` qualifies relative paths, so both reach it. This patch uses `pathToFile(f)`, as the rest of the method does. A relative path now resolves against the file system's working directory instead of the JVM's current directory, the same as the `getFileStatus(f)` call next to it. ### How was this patch tested? Added two cases to `TestSymlinkLocalFS`, which run through both the `FileContext` and the `FileSystem` wrappers, with the deprecated implementation forced on: - `testGetLinkStatusQualPathDeprecated`: `getFileLinkStatus` on a qualified link path reports a symlink with the right target, and `getLinkTarget` returns the target. - `testDanglingLinkQualPathDeprecated`: `getFileLinkStatus` on a qualified dangling link reports a symlink instead of throwing. Both fail without the fix. ### For code changes: - [x] Does the title of this PR start with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')? - [ ] Object storage: Have the integration tests been executed and the endpoint declared according to the connector-specific documentation? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files? ### AI Tooling - [x] The PR includes the phrase "Contains content generated by Claude Opus". - [x] My use of AI contributions follows the ASF legal policy https://www.apache.org/legal/generative-tooling.html Contains content generated by Claude Opus. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
