[
https://issues.apache.org/jira/browse/YARN-11532?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated YARN-11532:
----------------------------------
Labels: pull-request-available (was: )
> Incorrect Check for Permission in Test
> --------------------------------------
>
> Key: YARN-11532
> URL: https://issues.apache.org/jira/browse/YARN-11532
> Project: Hadoop YARN
> Issue Type: Bug
> Reporter: ConfX
> Priority: Critical
> Labels: pull-request-available
> Attachments: reproduce.sh
>
>
> h2. What happened:
> In test
> org.apache.hadoop.yarn.util.TestFSDownload#testDownloadPublicWithStatCache,
> the file path is not correct and cause java.io.FileNotFoundException.
> h2. Buggy code:
> {code:java}
> public void testDownloadPublicWithStatCache() throws IOException,
> URISyntaxException, InterruptedException, ExecutionException {
> ...
> assumeTrue(FSDownload.ancestorsHaveExecutePermissions(f, basedir, null));
> {code}
> Here the {{basedir}} has not been created and should not be checked for
> permission. However, in the code for {{ancestorsHaveExecutePermissions}}
> {code:java}
> static boolean ancestorsHaveExecutePermissions(FileSystem fs,
> Path path, LoadingCache<Path,Future<FileStatus>> statCache)
> throws IOException {
> Path current = path;
> while (current != null) {
> //the subdirs in the path should have execute permissions for others
> if (!checkPermissionOfOther(fs, current, FsAction.EXECUTE, statCache))
> { <-- here the path itself, which has not been created, is checked
> return false;
> }
> current = current.getParent();
> }
> return true;
> }
> {code}
> The check for permission on the {{basedir}} would cause file not found.
> h2. How to reproduce:
> Run test
> org.apache.hadoop.yarn.util.TestFSDownload#testDownloadPublicWithStatCache
> and observe the failure.
> For an easy reproduction, run the reproduce.sh in the attachment.
> h2. Stack trace:
> {code:java}
> java.io.FileNotFoundException: File file:
> /..../hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/target/TestFSDownload
> does not exist
> at
> org.apache.hadoop.fs.RawLocalFileSystem.deprecatedGetFileStatus(RawLocalFileSystem.java:779)
> at
> org.apache.hadoop.fs.RawLocalFileSystem.getFileLinkStatusInternal(RawLocalFileSystem.java:1100)
> at
> org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:769)
> at
> org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:462)
> at
> org.apache.hadoop.yarn.util.FSDownload.getFileStatus(FSDownload.java:236)
> at
> org.apache.hadoop.yarn.util.FSDownload.checkPermissionOfOther(FSDownload.java:218)
> at
> org.apache.hadoop.yarn.util.FSDownload.ancestorsHaveExecutePermissions(FSDownload.java:198)
> at
> org.apache.hadoop.yarn.util.TestFSDownload.testDownloadPublicWithStatCache(TestFSDownload.java:332)
> {code}
> You can use the reproduce.sh in the attachment to easily reproduce the bug.
> We are happy to provide a patch if this issue is confirmed.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]