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

Symlink target update fails when "noclobber" set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • p4-plugin
    • P4-Plugin 1.10.3
      Jenkins 1.176.3

      If the contents of the target of a symlink is updated and noclobber is set on the workspace the next sync fails. For example:

      P4 Task: syncing files at change: 1980... p4 sync /var/lib/jenkins/workspace/Symlinks/...@1980
      P4 Task: attempt: 1
      ERROR: P4: Task Exception: com.perforce.p4java.exception.P4JavaException: com.perforce.p4java.exception.P4JavaException: hudson.AbortException: P4JAVA: Error(s):
      Can't clobber writable file /var/lib/jenkins/workspace/Symlinks/aLinux/target/F1
      

      The permission on the target is OK. P4-Plugin does set the symlink permission to be 'w':

      lrwxrwxrwx 1 jenkins jenkins   12 Oct  1 14:13 ./aLinux/links/F1_link -> ../target/F1
      -r--r--r-- 1 jenkins jenkins   89 Oct  1 14:13 ./aLinux/target/F1
      

      P4 command line would set the same permissions but will correctly sync the files with the same permission. For example:

      $ ls -ld $(find .)
      drwxr-xr-x 4 kwirth kwirth 4096 Jul  2 11:16 .
      drwxr-xr-x 2 kwirth kwirth 4096 Oct  1 15:33 ./links
      lrwxrwxrwx 1 kwirth kwirth   12 Oct  1 15:33 ./links/F1_link -> ../target/F1
      drwxr-xr-x 3 kwirth kwirth 4096 Oct  1 15:34 ./target
      -r--r--r-- 1 kwirth kwirth  134 Oct  1 15:34 ./target/F1
      
      $ p4 sync ...
      //depot/symlink/aLinux/target/F1#3 - updating /ws/symlink/aLinux/target/F1

      Reproduction Steps:

      1. Add a target and symlink to Perforce from your Linux Perforce workspace.
      2. Create a freestyle job to sync the path containing the symlink.
      3. Before saving the job untick 'clobber'.
      4. Set the job to only build on one Linux node and set the populate option to 'Auto Cleanup And Sync'.
      5. Save the job.
      6. Run the job.
      7. Make an edit to the symlink to point to a new target and submit it from your Linux workspace.
      8. Run the job.

      Result:

       The "Can't clobber writable file" error is seen.

      Expected Result:

         Target is synced without error.

            cbopardikar Charusheela Bopardikar
            p4karl Karl Wirth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: