Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52325

Archiving artifacts fails if jenkins is not owner of builds dir

      In our setup the builds dir is a symlink to a network filesystem, hence Jenkins user has write permissions but is not owner of that directory.  When trying to archive artifacts following error occurs:

      java.nio.file.FileSystemException: /var/lib/jenkins/jobs/GeoGebra-autotest/builds/17371/archive/desktop/build/install/desktop/lib/impl.jar: Operation not permitted
      13:29:38 	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
      13:29:38 	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
      13:29:38 	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
      13:29:38 	at sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:283)
      13:29:38 	at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:581)
      13:29:38 	at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
      13:29:38 	at java.nio.file.Files.copy(Files.java:1274)
      13:29:38 	at hudson.FilePath$31$1.visit(FilePath.java:2301)
      13:29:38 	at hudson.util.DirScanner.scanSingle(DirScanner.java:44)
      13:29:38 	at hudson.FilePath$ExplicitlySpecifiedDirScanner.scan(FilePath.java:2996)
      13:29:38 	at hudson.FilePath$31.invoke(FilePath.java:2295)
      13:29:38 	at hudson.FilePath$31.invoke(FilePath.java:2288)
      13:29:38 	at hudson.FilePath.act(FilePath.java:1047)
      13:29:38 	at hudson.FilePath.act(FilePath.java:1025) 

      This is a regression between 2.107.3 and 2.121. Problem is that FilePath.copyRecursiveTo (https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/FilePath.java ) is now using 

      Files.copy(fileToPath(f), fileToPath(writing(target)),                                StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); 

      and the COPY_ATTRIBUTES flag does triggers the "operation not permitted" error (timestamp can't be changed in directory not owned by jenkins).

          [JENKINS-52325] Archiving artifacts fails if jenkins is not owner of builds dir

          Zbynek Konecny created issue -
          Zbynek Konecny made changes -
          Link New: This issue is related to JENKINS-13128 [ JENKINS-13128 ]
          Matt Sicker made changes -
          Remote Link New: This issue links to "PR-3537 (Web Link)" [ 21143 ]
          Oleg Nenashev made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Oleg Nenashev made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Oleg Nenashev made changes -
          Labels Original: archive artifact New: archive artifact regression
          Matt Sicker made changes -
          Assignee New: Matt Sicker [ jvz ]

          Matt Sicker added a comment -

          Fix has been merged to master and will be in the next weekly release.

          https://github.com/jenkinsci/jenkins/pull/3537

          Matt Sicker added a comment - Fix has been merged to master and will be in the next weekly release. https://github.com/jenkinsci/jenkins/pull/3537
          Matt Sicker made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]
          Zbynek Konecny made changes -
          Remote Link New: This issue links to "Fixed in GitHub PR #3923 (Web Link)" [ 22469 ]

            jvz Matt Sicker
            zbynek Zbynek Konecny
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: