You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/11/24 09:01:35 UTC

[GitHub] [flink] XComp commented on a change in pull request #14171: [FLINK-20267][runtime] The JaasModule didn't support symbolic links.

XComp commented on a change in pull request #14171:
URL: https://github.com/apache/flink/pull/14171#discussion_r529310532



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/security/modules/JaasModule.java
##########
@@ -159,12 +159,20 @@ private static File generateDefaultConfigFile(String workingDir) {
 		checkArgument(workingDir != null, "working directory should not be null.");
 		final File jaasConfFile;
 		try {
-			Path path = Files.createDirectories(Paths.get(workingDir));
+			Path path = Paths.get(workingDir);
+			if (Files.notExists(Paths.get(workingDir))) {
+				// We intentionally favored Path.toRealPath over Files.readSymbolicLinks as the latter one might return a
+				// relative path if the symbolic link refers to it. Path.toRealPath resolves the relative path instead.
+				Path parent = path.getParent().toRealPath();
+				Path resolvedPath = Paths.get(parent.toString(), path.getFileName().toString());
+
+				path = Files.createDirectories(resolvedPath);

Review comment:
       Good catch 👍 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org