[JIRA] (JENKINS-17267) Git clean or wipeout workspace follows symlink on Windows slaves

70 views
Skip to first unread message

laurenternes@hotmail.com (JIRA)

unread,
Mar 19, 2013, 6:40:53 AM3/19/13
to jenkinsc...@googlegroups.com
Issue Type: Bug Bug
Affects Versions: current
Assignee: Nicolas De Loof
Components: core, git
Created: 19/Mar/13 10:39 AM
Description:

While configuring a job with Git SCM, using either "clean after checkout" or "wipe out workspace before build" a workspace containing directory junction (on Windows slave), the symlink (junction) is followed, and delete files in the directory referenced by this symlink. This is a problem since other job are using these files... Note that it only affects Windows slaves; when run on a Linux slave, it does not follow symlinks.

Project: Jenkins
Priority: Major Major
Reporter: Laurent ERNES
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

laurenternes@hotmail.com (JIRA)

unread,
Mar 21, 2013, 12:05:52 PM3/21/13
to jenkinsc...@googlegroups.com
Change By: Laurent ERNES (21/Mar/13 4:05 PM)
Description: While configuring a A  job  is configured  with Git SCM,  using  and  either "clean after checkout" or "wipe out workspace before build"  a  option is enabled.
If the
 workspace  containing  contains a '  directory junction '  ( on  Windows slave)  then , the  "clean"/"wipeout" will follow the  symlink (junction)  is followed , and  will  delete files in the directory referenced by this symlink , and not just the symlink .
 This is a problem since other  job  jobs  are using these files...  Note that
NOTE:
 it only affects Windows slaves; when  a similar job is  run on a Linux slave, it does not follow symlinks.

vincent.kessler@quantec-networks.de (JIRA)

unread,
Dec 21, 2013, 11:50:37 AM12/21/13
to jenkinsc...@googlegroups.com

I have the exact same issue.
The "Workspace Cleanup Plugin" works ok - not following symlinks - at version 0.16 though.

daniel@beckweb.net (JIRA)

unread,
Oct 12, 2014, 6:27:18 AM10/12/14
to jenkinsc...@googlegroups.com
Daniel Beck commented on Bug JENKINS-17267

Same issue occurs when using 'Wipe Out Workspace' so more of a core issue than git I think.

Workaround is to use directory symbolic links (mklink /d) rather than junction points (mklink /j).

daniel@beckweb.net (JIRA)

unread,
Oct 12, 2014, 6:47:18 AM10/12/14
to jenkinsc...@googlegroups.com
Daniel Beck commented on Bug JENKINS-17267

It doesn't help that the Java runtime (maybe assisted by Windows) claims that junction points are a directory.

Create a new freestyle project named JENKINS-17267, add a Windows Batch build step:

mklink /d s c:\existingTargetFolder
mklink /j j c:\existingTargetFolder
md d

Build once. Then open Script Console and run the following script:

def s = new File(Jenkins.instance.getItemByFullName('JENKINS-17267').someWorkspace.child('s').getRemote())
def j = new File(Jenkins.instance.getItemByFullName('JENKINS-17267').someWorkspace.child('j').getRemote())
def d = new File(Jenkins.instance.getItemByFullName('JENKINS-17267').someWorkspace.child('d').getRemote())
[s, j, d].each {
  println java.nio.file.Files.isDirectory(it.toPath())
  println java.nio.file.Files.isDirectory(it.toPath(), java.nio.file.LinkOption.NOFOLLOW_LINKS)
  println java.nio.file.Files.isSymbolicLink(it.toPath())
  println ""
}
return

Output:

true
false
true

true
true
false

true
true
false

In other words, a pure Java program has no chance to distinguish between a junction and an actual folder.

jglick@cloudbees.com (JIRA)

unread,
Apr 20, 2015, 7:27:05 AM4/20/15
to jenkinsc...@googlegroups.com
Change By: Jesse Glick (20/Apr/15 11:26 AM)
Summary: Git clean or wipeout workspace follows  symlink  junction  on Windows slaves
Assignee: Nicolas De Loof

jglick@cloudbees.com (JIRA)

unread,
Apr 20, 2015, 7:29:06 AM4/20/15
to jenkinsc...@googlegroups.com
Jesse Glick resolved Bug JENKINS-17267 as Won't Fix

I think there is nothing to be done beyond advising people to not use junctions.

Change By: Jesse Glick (20/Apr/15 11:27 AM)
Status: Open Resolved
Resolution: Won't Fix
Reply all
Reply to author
Forward
0 new messages