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

Workspace Cleanup plugin seems to be following symlinks and deleting files outside its workspace

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      It seems like the workspace cleanup plugin is following symlinks, which creates weird behavior. For example, I have a job that sets up the build environment, and my other test running jobs reference this build environment directory with symlinks. When the jobs that are using the workspace cleanup plugin don't delete the symlinks prior to finishing the job, when the workspace is cleaned up, files in the symlinked directory get removed.

      I resolved the issue by having my ant clean task run after the build, which removes the symlinks, but every now and again if the build fails...the clean task doesn't run and the error resurfaces the next time the job runs when it cleans up and those symlinks exist.

        Attachments

          Activity

          Hide
          thomas_herrlin Thomas Herrlin added a comment -

          Created a pull request with my purposed fix: https://github.com/jenkinsci/ws-cleanup-plugin/pull/15

          I have only done basic testing and my gut feeling is that it may need more testing. I may look into writing unittests for this plugin if the jenkins/maven framework for that is not too complicated.

          Show
          thomas_herrlin Thomas Herrlin added a comment - Created a pull request with my purposed fix: https://github.com/jenkinsci/ws-cleanup-plugin/pull/15 I have only done basic testing and my gut feeling is that it may need more testing. I may look into writing unittests for this plugin if the jenkins/maven framework for that is not too complicated.
          Hide
          thomas_herrlin Thomas Herrlin added a comment -

          Tried writing testcase(s), but I am having problems with hudson.util.jna.GNUCLibrary not able to load/link glibc for some reason when starting the tests. I am following https://wiki.jenkins-ci.org/display/JENKINS/Unit+Test

          Show
          thomas_herrlin Thomas Herrlin added a comment - Tried writing testcase(s), but I am having problems with hudson.util.jna.GNUCLibrary not able to load/link glibc for some reason when starting the tests. I am following https://wiki.jenkins-ci.org/display/JENKINS/Unit+Test
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Thomas Herrlin
          Path:
          src/main/java/hudson/plugins/ws_cleanup/Cleanup.java
          http://jenkins-ci.org/commit/ws-cleanup-plugin/bc6d13e41fe78f72979367fdc9e098ac4d79bf7b
          Log:
          JENKINS-13444 Do not follow symlinks with ant pattern

          Do not follow symlinks when ant patterns are used. To make it the same
          behaviour as without ant patterns.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Thomas Herrlin Path: src/main/java/hudson/plugins/ws_cleanup/Cleanup.java http://jenkins-ci.org/commit/ws-cleanup-plugin/bc6d13e41fe78f72979367fdc9e098ac4d79bf7b Log: JENKINS-13444 Do not follow symlinks with ant pattern Do not follow symlinks when ant patterns are used. To make it the same behaviour as without ant patterns.
          Hide
          vjuranek vjuranek added a comment -

          Should be fixed by PR #15

          Show
          vjuranek vjuranek added a comment - Should be fixed by PR #15
          Hide
          thomas_herrlin Thomas Herrlin added a comment -

          I have confirmed integration of fix between 0.20 and 0.21 with a simple testcase:

          Execute shell:
          	mkdir -p a
          	touch a/a.file
          	ln -s a b
          
          
          Delete workspace when build is done:
          	Apply pattern also on directories: False
          	Exclude: a/a.file
          

          Version 0.20: a and b are preserved. a/a.file deleted (via symlink b).

          Version 0.21: a and a/a.file are preserved. b deleted (b treated as a file).

          Show
          thomas_herrlin Thomas Herrlin added a comment - I have confirmed integration of fix between 0.20 and 0.21 with a simple testcase: Execute shell: mkdir -p a touch a/a.file ln -s a b Delete workspace when build is done: Apply pattern also on directories: False Exclude: a/a.file Version 0.20: a and b are preserved. a/a.file deleted (via symlink b). Version 0.21: a and a/a.file are preserved. b deleted (b treated as a file).

            People

            • Assignee:
              lvotypkova Lucie Votypkova
              Reporter:
              g01 Gary Yund
            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: