Skip to content

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

Open

Description

@jenkins-infra-bot

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).


Originally reported by zbynek, imported from: Archiving artifacts fails if jenkins is not owner of builds dir
  • assignee: jvz
  • status: Reopened
  • priority: Minor
  • component(s): core
  • label(s): archive, artifact, regression
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-11-24
Raw content of original issue

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).

Activity

  1. jenkins-infra-bot commented on Jul 2, 2018

    @jenkins-infra-bot
    Author
    • Remote link associated with this issue:

  2. jenkins-infra-bot commented on Jul 13, 2018

    @jenkins-infra-bot
    Author
    jvz:

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

    #3537

  3. jenkins-infra-bot commented on May 25, 2019

    @jenkins-infra-bot
    Author
    patrick_t80:
    • Original comment link
    • Raw content of original comment:

      Sorry to reopen this bug, but this problem is still present in LTS branch.

      I've installed the last LTS version (2.164.3) on a virtualized Ubuntu (18.04.2) machine hosted on a Windows 10 machine. But when parent job has finished successfully, and the copy artifact plugin execute its work, the builded artifact is copied correctly but the console output the error.

    Sorry to reopen this bug, but this problem is still present in LTS branch.

    I've installed the last LTS version (2.164.3) on a virtualized Ubuntu (18.04.2) machine hosted on a Windows 10 machine. But when parent job has finished successfully, and the copy artifact plugin execute its work, the builded artifact is copied correctly but the console output the error.

  4. jenkins-infra-bot commented on May 25, 2019

    @jenkins-infra-bot
    Author
    jvz:
    • Original comment link
    • Raw content of original comment:

      Can you submit a unit test that reproduces the issue?

    Can you submit a unit test that reproduces the issue?

  5. jenkins-infra-bot commented on May 26, 2019

    @jenkins-infra-bot
    Author
    patrick_t80:
    • Original comment link
    • Raw content of original comment:

      jvz, sincerely i don't know how to create a unit test that reproduce this bug, if you want i can attach the output console stacktrace, and the configured shared folder between host and guest.

    jvz, sincerely i don't know how to create a unit test that reproduce this bug, if you want i can attach the output console stacktrace, and the configured shared folder between host and guest.

  6. jenkins-infra-bot commented on Nov 24, 2025

    @jenkins-infra-bot
    Author

    [Original relates_to from Jira: JENKINS-13128]

  7. removed
    bugFor changelog: Minor bug. Will be listed after features
    on Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions