smengcl commented on code in PR #11636:
URL: https://github.com/apache/ozone/pull/11636#discussion_r4345415093


##########
hadoop-hdds/rocks-native/src/main/java/org/apache/hadoop/hdds/utils/NativeLibraryLoader.java:
##########
@@ -165,13 +164,13 @@ private Pair<Optional<File>, List<File>> 
copyResourceFromJarToTemp(final String
         return Pair.of(Optional.empty(), null);
       }
 
-      final String nativeLibDir =
-          Objects.nonNull(getSystemProperty(NATIVE_LIB_TMP_DIR)) ?
-              getSystemProperty(NATIVE_LIB_TMP_DIR) : "";
-      final File dir = new File(nativeLibDir).getAbsoluteFile();
+      final String nativeLibDir = getSystemProperty(NATIVE_LIB_TMP_DIR);
 
-      // create a temporary dir to copy the library to
-      final Path tempPath = Files.createTempDirectory(dir.toPath(), 
libraryName);
+      // create a temporary dir to copy the library to, under java.io.tmpdir 
unless NATIVE_LIB_TMP_DIR is set,
+      // since the working directory may not be writable.
+      final Path tempPath = nativeLibDir == null || nativeLibDir.isEmpty()
+          ? Files.createTempDirectory(libraryName)
+          : Files.createTempDirectory(new 
File(nativeLibDir).getAbsoluteFile().toPath(), libraryName);

Review Comment:
   > hardening policy of mounting /tmp with noexec
   
   good point. changed tmp as fallback



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

Reply via email to