build-info icon indicating copy to clipboard operation
build-info copied to clipboard

Fails on Windows with Guava 32.0.0

Open Bananeweizen opened this issue 2 years ago • 5 comments

Run Jenkins 2.407 with the Artifactory plugin containing this code, on a Windows machine. That leads to exceptions because some methods in Guava 32.0.0 simply don't work anymore on Windows. Older versions of Jenkins core contained Guava 31.x and therefore work fine.

Jenkins bug: https://issues.jenkins.io/browse/JENKINS-71375 Guava change describing the non-working behavior: https://github.com/google/guava/commit/3dfe3633eb84ec96ac88c764862b0f8d0c3546fc

The Jenkins core developers recommend removing Guava from Jenkins plugins. I support that opinion.

Bananeweizen avatar Jun 01 '23 19:06 Bananeweizen

Suggest the following patch:

diff --git a/build-info-extractor/src/main/java/org/jfrog/build/extractor/clientConfiguration/util/DependenciesDownloaderHelper.java b/build-info-extractor/src/main/java/org/jfrog/build/extractor/clientConfiguration/util/DependenciesDownloaderHelper.java
index f74280ba..a1210ac7 100644
--- a/build-info-extractor/src/main/java/org/jfrog/build/extractor/clientConfiguration/util/DependenciesDownloaderHelper.java
+++ b/build-info-extractor/src/main/java/org/jfrog/build/extractor/clientConfiguration/util/DependenciesDownloaderHelper.java
@@ -1,6 +1,6 @@
 package org.jfrog.build.extractor.clientConfiguration.util;
 
-import com.google.common.io.Files;
+import java.nio.file.Files;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.BooleanUtils;
@@ -245,7 +245,7 @@ public class DependenciesDownloaderHelper {
     protected Map<String, String> downloadFileConcurrently(final String uriWithParams, long fileSize, final String fileDestination, String filePath)
             throws Exception {
         String[] downloadedFilesPaths;
-        File tempDir = Files.createTempDir();
+        File tempDir = Files.createTempDirectory(null).toFile();
         String tempPath = tempDir.getPath() + File.separatorChar + filePath;
         try {
             downloadedFilesPaths = doConcurrentDownload(fileSize, uriWithParams, tempPath);

basil avatar Jun 06 '23 17:06 basil

As the Guava developer responsible for this, I apologize for the trouble. I endorse the patch above, and I am working to fix this in Guava for anyone who isn't in a position to make such changes.

cpovirk avatar Jun 07 '23 13:06 cpovirk

The Guava fix is released for anyone who needs it: https://github.com/google/guava/releases/tag/v32.0.1

cpovirk avatar Jun 09 '23 00:06 cpovirk

Even with the Guava fix in place, we got another report of trouble from a Jenkins user with a slightly unusual setup (specifically, running as a Windows service). There may still be something that we can do about it on the Guava side, but if JFrog can apply the patch above, that would definitely solve that part of the problem.

cpovirk avatar Jul 13 '23 12:07 cpovirk

Thanks for the information, @cpovirk. Are you interested in making a contribution by submitting a pull request to address this problem?

yahavi avatar Jul 13 '23 13:07 yahavi