[GitHub] [maven-surefire] cpfeiffer commented on a diff in pull request #554: [SUREFIRE-2109] Add suffix derived from current user to Surefire temp directory name and make directory writable for all
cpfeiffer commented on code in PR #554: URL: https://github.com/apache/maven-surefire/pull/554#discussion_r1059640012 ## surefire-api/src/main/java/org/apache/maven/surefire/api/util/TempFileManager.java: ## @@ -180,6 +180,8 @@ public synchronized File createTempFile( String prefix, String suffix ) throw new UncheckedIOException( new IOException( "Unable to create temporary directory " + tempDir.getAbsolutePath() ) ); } +// try to make temp file directory writable for all +tempDir.setWritable( true, false ); Review Comment: If you only want to avoid clashes between multiple users, [Files.createTempDirectory("surefire-")](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createTempDirectory-java.lang.String-java.nio.file.attribute.FileAttribute...-) would create the unique, collision-free directory for you. -- 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: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [maven-surefire] cpfeiffer commented on a diff in pull request #554: [SUREFIRE-2109] Add suffix derived from current user to Surefire temp directory name and make directory writable for all
cpfeiffer commented on code in PR #554: URL: https://github.com/apache/maven-surefire/pull/554#discussion_r1059640012 ## surefire-api/src/main/java/org/apache/maven/surefire/api/util/TempFileManager.java: ## @@ -180,6 +180,8 @@ public synchronized File createTempFile( String prefix, String suffix ) throw new UncheckedIOException( new IOException( "Unable to create temporary directory " + tempDir.getAbsolutePath() ) ); } +// try to make temp file directory writable for all +tempDir.setWritable( true, false ); Review Comment: If you only want to avoid clashes between multiple users, using [Files.createTempDirectory("surefire-")](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createTempDirectory-java.lang.String-java.nio.file.attribute.FileAttribute...-) would create the unique, collision-free directory for you. -- 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: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [maven-surefire] cpfeiffer commented on a diff in pull request #554: [SUREFIRE-2109] Add suffix derived from current user to Surefire temp directory name and make directory writable for all
cpfeiffer commented on code in PR #554: URL: https://github.com/apache/maven-surefire/pull/554#discussion_r1050900556 ## surefire-api/src/main/java/org/apache/maven/surefire/api/util/TempFileManager.java: ## @@ -180,6 +180,8 @@ public synchronized File createTempFile( String prefix, String suffix ) throw new UncheckedIOException( new IOException( "Unable to create temporary directory " + tempDir.getAbsolutePath() ) ); } +// try to make temp file directory writable for all +tempDir.setWritable( true, false ); Review Comment: Security-wise, I don't think it's a good idea to have a shared directory with other users. Why would you need this? Also, why not use `java.nio.file.Files.createTempDirectory()` and specify 'surefire-' + the username as prefix? -- 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: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org