You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "sjlee (via GitHub)" <gi...@apache.org> on 2025/03/16 05:12:02 UTC
[PR] HADOOP-19488 fix the temporary direction creation on Windows [hadoop]
sjlee opened a new pull request, #7511:
URL: https://github.com/apache/hadoop/pull/7511
Use ACL-based permissions for Windows instead of POSIX permissions.
<!--
Thanks for sending a pull request!
1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
2. Make sure your PR title starts with JIRA issue id, e.g., 'HADOOP-17799. Your PR title ...'.
-->
### Description of PR
Fix Hadoop RunJar for Windows. The Windows filesystem does not recognize the POSIX permissions, and it was causing the directory creation failure. If the filesystem does not support POSIX permissions, switch to using the user-based, ACL-based permissions that work on Windows.
### How was this patch tested?
I added a test to TestRunJar and ran it first to reproduce the bug on Windows. After I changed RunJar.java, I ran TestRunJar on Windows and confirmed it runs successfully.
### 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?
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HADOOP-19488 fix the temporary directory creation on Windows [hadoop]
Posted by "sjlee (via GitHub)" <gi...@apache.org>.
sjlee commented on code in PR #7511:
URL: https://github.com/apache/hadoop/pull/7511#discussion_r2002388538
##########
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:
Although I don't have the authoritative source code that confirms it, it appears that for all the ones I tested, the views appear to be in lowercase.
- Windows: owner dos acl basic user
- Linux (Ubuntu): owner dos basic posix user unix
- macOS: owner basic posix unix
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HADOOP-19488 fix the temporary directory creation on Windows [hadoop]
Posted by "sjlee (via GitHub)" <gi...@apache.org>.
sjlee commented on PR #7511:
URL: https://github.com/apache/hadoop/pull/7511#issuecomment-2743905283
Any additional feedback or comments? Thanks.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HADOOP-19488 fix the temporary directory creation on Windows [hadoop]
Posted by "GauthamBanasandra (via GitHub)" <gi...@apache.org>.
GauthamBanasandra commented on PR #7511:
URL: https://github.com/apache/hadoop/pull/7511#issuecomment-2745085923
The Jenkins CI run looks good -

Logs - [archive.zip](https://github.com/user-attachments/files/19401272/archive.zip)
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HADOOP-19488 fix the temporary direction creation on Windows [hadoop]
Posted by "hadoop-yetus (via GitHub)" <gi...@apache.org>.
hadoop-yetus commented on PR #7511:
URL: https://github.com/apache/hadoop/pull/7511#issuecomment-2727273891
:confetti_ball: **+1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 17m 41s | | Docker mode activated. |
|||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | | No case conflicting files found. |
| +0 :ok: | codespell | 0m 0s | | codespell was not available. |
| +0 :ok: | detsecrets | 0m 0s | | detect-secrets was not available. |
| +1 :green_heart: | @author | 0m 0s | | The patch does not contain any @author tags. |
| +1 :green_heart: | test4tests | 0m 0s | | The patch appears to include 1 new or modified test files. |
|||| _ trunk Compile Tests _ |
| +1 :green_heart: | mvninstall | 35m 35s | | trunk passed |
| +1 :green_heart: | compile | 15m 49s | | trunk passed with JDK Ubuntu-11.0.26+4-post-Ubuntu-1ubuntu120.04 |
| +1 :green_heart: | compile | 13m 57s | | trunk passed with JDK Private Build-1.8.0_442-8u442-b06~us1-0ubuntu1~20.04-b06 |
| +1 :green_heart: | checkstyle | 1m 16s | | trunk passed |
| +1 :green_heart: | mvnsite | 1m 38s | | trunk passed |
| +1 :green_heart: | javadoc | 1m 14s | | trunk passed with JDK Ubuntu-11.0.26+4-post-Ubuntu-1ubuntu120.04 |
| +1 :green_heart: | javadoc | 0m 52s | | trunk passed with JDK Private Build-1.8.0_442-8u442-b06~us1-0ubuntu1~20.04-b06 |
| +1 :green_heart: | spotbugs | 2m 34s | | trunk passed |
| +1 :green_heart: | shadedclient | 36m 22s | | branch has no errors when building and testing our client artifacts. |
|||| _ Patch Compile Tests _ |
| +1 :green_heart: | mvninstall | 0m 55s | | the patch passed |
| +1 :green_heart: | compile | 15m 8s | | the patch passed with JDK Ubuntu-11.0.26+4-post-Ubuntu-1ubuntu120.04 |
| +1 :green_heart: | javac | 15m 8s | | the patch passed |
| +1 :green_heart: | compile | 13m 57s | | the patch passed with JDK Private Build-1.8.0_442-8u442-b06~us1-0ubuntu1~20.04-b06 |
| +1 :green_heart: | javac | 13m 57s | | the patch passed |
| +1 :green_heart: | blanks | 0m 0s | | The patch has no blanks issues. |
| +1 :green_heart: | checkstyle | 1m 14s | | the patch passed |
| +1 :green_heart: | mvnsite | 1m 36s | | the patch passed |
| +1 :green_heart: | javadoc | 1m 11s | | the patch passed with JDK Ubuntu-11.0.26+4-post-Ubuntu-1ubuntu120.04 |
| +1 :green_heart: | javadoc | 0m 54s | | the patch passed with JDK Private Build-1.8.0_442-8u442-b06~us1-0ubuntu1~20.04-b06 |
| +1 :green_heart: | spotbugs | 2m 40s | | the patch passed |
| +1 :green_heart: | shadedclient | 38m 9s | | patch has no errors when building and testing our client artifacts. |
|||| _ Other Tests _ |
| +1 :green_heart: | unit | 16m 9s | | hadoop-common in the patch passed. |
| +1 :green_heart: | asflicense | 0m 59s | | The patch does not generate ASF License warnings. |
| | | 220m 49s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.48 ServerAPI=1.48 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7511/1/artifact/out/Dockerfile |
| GITHUB PR | https://github.com/apache/hadoop/pull/7511 |
| Optional Tests | dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets |
| uname | Linux 0c598f5bd0ea 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/bin/hadoop.sh |
| git revision | trunk / c70b276a33c6a4cbc7ab7951b005cadd0353aa52 |
| Default Java | Private Build-1.8.0_442-8u442-b06~us1-0ubuntu1~20.04-b06 |
| Multi-JDK versions | /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.26+4-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_442-8u442-b06~us1-0ubuntu1~20.04-b06 |
| Test Results | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7511/1/testReport/ |
| Max. process+thread count | 2151 (vs. ulimit of 5500) |
| modules | C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common |
| Console output | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7511/1/console |
| versions | git=2.25.1 maven=3.6.3 spotbugs=4.2.2 |
| Powered by | Apache Yetus 0.14.0 https://yetus.apache.org |
This message was automatically generated.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HADOOP-19488 fix the temporary directory creation on Windows [hadoop]
Posted by "GauthamBanasandra (via GitHub)" <gi...@apache.org>.
GauthamBanasandra merged PR #7511:
URL: https://github.com/apache/hadoop/pull/7511
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HADOOP-19488 fix the temporary directory creation on Windows [hadoop]
Posted by "sjlee (via GitHub)" <gi...@apache.org>.
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.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HADOOP-19488 fix the temporary directory creation on Windows [hadoop]
Posted by "GauthamBanasandra (via GitHub)" <gi...@apache.org>.
GauthamBanasandra commented on code in PR #7511:
URL: https://github.com/apache/hadoop/pull/7511#discussion_r2001881017
##########
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:
Are we sure about the casing here? It's always `posix` and not `POSIX`?
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HADOOP-19488 fix the temporary directory creation on Windows [hadoop]
Posted by "slfan1989 (via GitHub)" <gi...@apache.org>.
slfan1989 commented on PR #7511:
URL: https://github.com/apache/hadoop/pull/7511#issuecomment-2745142414
@sjlee @GauthamBanasandra Thanks for your contribution! Can we backport this pr to branch-3.4?
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org