[ 
https://issues.apache.org/jira/browse/YARN-11532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765276#comment-17765276
 ] 

ASF GitHub Bot commented on YARN-11532:
---------------------------------------

teamconfx opened a new pull request, #6074:
URL: https://github.com/apache/hadoop/pull/6074

   ### Description of PR
   https://issues.apache.org/jira/browse/YARN-11532
   This PR changes the code to check ancestor's execute permissions to actually 
match the functionality of the method.
   
   ### How was this patch tested?
   Run 
`org.apache.hadoop.yarn.util.TestFSDownload#testDownloadPublicWithStatCache` 
and the test passes.
   
   ### For code changes:
   
   - [x] Does the title or this PR starts 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?
   
   




> 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
>         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]

Reply via email to