From 413dc047d3a475dd59aeecee61702b67408207d4 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Fri, 10 Oct 2025 11:17:11 +0200 Subject: [PATCH 1/6] Add retry loop for FilePath#chmod --- core/src/main/java/hudson/FilePath.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 7422a86da4c6..170467cfa4ae 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -716,8 +716,19 @@ private static void unzip(File dir, File zipFile) throws IOException { try { FilePath target = new FilePath(f); int mode = e.getUnixMode(); - if (mode != 0) // Ant returns 0 if the archive doesn't record the access mode - target.chmod(mode); + if (mode != 0) { // Ant returns 0 if the archive doesn't record the access mode + for (int attempt = 1; ; attempt++) { + try { + target.chmod(mode); + break; + } catch (NoSuchFileException ex) { // https://issues.jenkins.io/browse/JENKINS-76192 + if (attempt == 3) { + throw ex; + } + Thread.sleep(420); + } + } + } } catch (InterruptedException ex) { LOGGER.log(Level.WARNING, "unable to set permissions", ex); } From c3335c4a75c7f92455f227440ec8a3090af492a3 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:22:44 +0200 Subject: [PATCH 2/6] Extend timeout --- core/src/main/java/hudson/FilePath.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 170467cfa4ae..7bd90b848761 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -722,10 +722,10 @@ private static void unzip(File dir, File zipFile) throws IOException { target.chmod(mode); break; } catch (NoSuchFileException ex) { // https://issues.jenkins.io/browse/JENKINS-76192 - if (attempt == 3) { + if (attempt == 5) { throw ex; } - Thread.sleep(420); + Thread.sleep(1000); } } } From ea74b28a52f906b16d4a9a88d330512da3b9b4ae Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Sat, 11 Oct 2025 19:40:54 +0200 Subject: [PATCH 3/6] Ignore NoSuchFileException --- core/src/main/java/hudson/FilePath.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 7bd90b848761..d05dffdef24a 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -716,20 +716,9 @@ private static void unzip(File dir, File zipFile) throws IOException { try { FilePath target = new FilePath(f); int mode = e.getUnixMode(); - if (mode != 0) { // Ant returns 0 if the archive doesn't record the access mode - for (int attempt = 1; ; attempt++) { - try { - target.chmod(mode); - break; - } catch (NoSuchFileException ex) { // https://issues.jenkins.io/browse/JENKINS-76192 - if (attempt == 5) { - throw ex; - } - Thread.sleep(1000); - } - } - } - } catch (InterruptedException ex) { + if (mode != 0) // Ant returns 0 if the archive doesn't record the access mode + target.chmod(mode); + } catch (InterruptedException | NoSuchFileException ex) { LOGGER.log(Level.WARNING, "unable to set permissions", ex); } Files.setLastModifiedTime(Util.fileToPath(f), e.getLastModifiedTime()); From eb18428cc0e550b95e9ef6cdd8263fb22dc7cddf Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Sat, 11 Oct 2025 21:49:45 +0200 Subject: [PATCH 4/6] Skip modified time as well --- core/src/main/java/hudson/FilePath.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index d05dffdef24a..b897e49cb8b8 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -721,7 +721,11 @@ private static void unzip(File dir, File zipFile) throws IOException { } catch (InterruptedException | NoSuchFileException ex) { LOGGER.log(Level.WARNING, "unable to set permissions", ex); } - Files.setLastModifiedTime(Util.fileToPath(f), e.getLastModifiedTime()); + try { + Files.setLastModifiedTime(Util.fileToPath(f), e.getLastModifiedTime()); + } catch (NoSuchFileException ex) { + LOGGER.log(Level.WARNING, "unable to set last modified time", ex); + } } } } From 6bb2172b1592d943a8ac3fc29b46697beae50593 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Sun, 12 Oct 2025 15:14:17 +0200 Subject: [PATCH 5/6] Trigger rebuild --- core/src/main/java/hudson/FilePath.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index b897e49cb8b8..8036b6813ab7 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -716,7 +716,7 @@ private static void unzip(File dir, File zipFile) throws IOException { try { FilePath target = new FilePath(f); int mode = e.getUnixMode(); - if (mode != 0) // Ant returns 0 if the archive doesn't record the access mode + if (mode != 0) // Ant returns 0 if the archive doesn't record the access mode target.chmod(mode); } catch (InterruptedException | NoSuchFileException ex) { LOGGER.log(Level.WARNING, "unable to set permissions", ex); From 9f18659d1f2fd1d5566b3c217230bd2655cf2b30 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Sun, 12 Oct 2025 20:21:35 +0200 Subject: [PATCH 6/6] Trigger build --- core/src/main/java/hudson/FilePath.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 8036b6813ab7..ca35c97aed9a 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -716,7 +716,7 @@ private static void unzip(File dir, File zipFile) throws IOException { try { FilePath target = new FilePath(f); int mode = e.getUnixMode(); - if (mode != 0) // Ant returns 0 if the archive doesn't record the access mode + if (mode != 0) // Ant returns 0 if the archive doesn't record the access mode target.chmod(mode); } catch (InterruptedException | NoSuchFileException ex) { LOGGER.log(Level.WARNING, "unable to set permissions", ex);