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

ASF GitHub Bot commented on HADOOP-19488:
-----------------------------------------

sjlee commented on code in PR #7511:
URL: https://github.com/apache/hadoop/pull/7511#discussion_r2003550262


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java:
##########
@@ -333,6 +336,55 @@ public void run() {
     }
   }
 
+  static File createWorkDirectory() throws IOException {
+    File tmpDir = new File(System.getProperty("java.io.tmpdir"));
+    ensureDirectory(tmpDir);
+
+    File workDir = Files.createTempDirectory(tmpDir.toPath(), "hadoop-unjar",
+        directoryPermissions()).toFile();
+    ensureDirectory(workDir);
+    return workDir;
+  }
+
+  private static FileAttribute<?> directoryPermissions() throws IOException {
+    Set<String> views = FileSystems.getDefault().supportedFileAttributeViews();
+    if (views.contains("posix")) {
+      return PosixFilePermissions
+          .asFileAttribute(PosixFilePermissions.fromString("rwx------"));
+    } else if (views.contains("acl")) {
+      return userOnly();
+    } else {

Review Comment:
   One can also check that is the case at least from the OpenJDK source.





> RunJar throws UnsupportedOperationException on Windows
> ------------------------------------------------------
>
>                 Key: HADOOP-19488
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19488
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: hadoop-common
>    Affects Versions: 3.4.1
>         Environment: Windows
>            Reporter: Sangjin Lee
>            Assignee: Sangjin Lee
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.5.0
>
>         Attachments: windows-successful-test-run.txt, 
> windows-test-failures-run.txt
>
>
> On Windows, run {{hadoop jar}} (with any jar). One immediately gets the 
> following exception:
> {code}
> Exception in thread "main" java.lang.UnsupportedOperationException: 
> 'posix:permissions' not supported as initial attribute
>     at 
> java.base/sun.nio.fs.WindowsSecurityDescriptor.fromAttribute(WindowsSecurityDescriptor.java:358)
>     at 
> java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:497)
>     at java.base/java.nio.file.Files.createDirectory(Files.java:690)
>     at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:135)
>     at 
> java.base/java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:172)
>     at java.base/java.nio.file.Files.createTempDirectory(Files.java:966)
>     at org.apache.hadoop.util.RunJar.run(RunJar.java:296)
>     at org.apache.hadoop.util.RunJar.main(RunJar.java:245)
> {code}
> I'm running Windows 11 with OpenJDK 11.0.26.
> This bug does not exist in 3.3.6.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to