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

LastSuccessful and LastStable symlinks are invalid under Windows

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • Windows Server 2008, NTFS, Jenkins runs as Windows Service

      The lastStable and LastSuccessful links are created as invalid symlinks with no destination under Windows. These Files cause the backup to fail, since they are not valid and cause all sorts of zip archivers to fail.

          [JENKINS-17681] LastSuccessful and LastStable symlinks are invalid under Windows

          Fabian Tietz created issue -

          Mark Waite added a comment - - edited

          This problem is also visible in Jenkins 1.509.1 LTS release candidate. It appears as a stack trace

          WARNING: Failed to update hudson.model.FreeStyleProject@1b7e8eff[jenkins-demo] l
          astSuccessfulBuild permalink for jenkins-demo #24
          java.nio.file.NoSuchFileException: C:\Users\Mark\.jenkins\jobs\jenkins-demo\builds\lastSuccessfulBuild.tmp
                  at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
                  at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
                  at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
                  at sun.nio.fs.WindowsLinkSupport.readLink(WindowsLinkSupport.java:56)
                  at sun.nio.fs.WindowsFileSystemProvider.readSymbolicLink(WindowsFileSystemProvider.java:636)
                  at java.nio.file.Files.readSymbolicLink(Files.java:1382)
                  at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:601)
                  at hudson.Util.resolveSymlink(Util.java:1188)
                  at jenkins.model.PeepholePermalink.updateCache(PeepholePermalink.java:146)
                  at jenkins.model.PeepholePermalink.resolve(PeepholePermalink.java:118)
                  at hudson.model.Job.getLastSuccessfulBuild(Job.java:802)
                  at sun.reflect.GeneratedMethodAccessor213.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:601)
                  at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288)
                  at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:203)
                  at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
                  at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677)
                  at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
                  at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241)
                  at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
                  at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677)
                  at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
                  at org.kohsuke.stapler.Stapler.invoke(Stapler.java:583)
                  at org.kohsuke.stapler.Stapler.service(Stapler.java:214)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
                  at winstone.ServletConfiguration.execute(ServletConfiguration.java:248)
                  at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
                  at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:376)
                  at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
                  at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
                  at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
                  at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
                  at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
                  at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
                  at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
                  at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
                  at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
                  at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
                  at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
                  at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
                  at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:50)
                  at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
                  at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
                  at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
                  at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
                  at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
                  at winstone.RequestDispatcher.forward(RequestDispatcher.java:331)
                  at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:227)
                  at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
                  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
                  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
          

          Mark Waite added a comment - - edited This problem is also visible in Jenkins 1.509.1 LTS release candidate. It appears as a stack trace WARNING: Failed to update hudson.model.FreeStyleProject@1b7e8eff[jenkins-demo] l astSuccessfulBuild permalink for jenkins-demo #24 java.nio.file.NoSuchFileException: C:\Users\Mark\.jenkins\jobs\jenkins-demo\builds\lastSuccessfulBuild.tmp at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) at sun.nio.fs.WindowsLinkSupport.readLink(WindowsLinkSupport.java:56) at sun.nio.fs.WindowsFileSystemProvider.readSymbolicLink(WindowsFileSystemProvider.java:636) at java.nio.file.Files.readSymbolicLink(Files.java:1382) at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at hudson.Util.resolveSymlink(Util.java:1188) at jenkins.model.PeepholePermalink.updateCache(PeepholePermalink.java:146) at jenkins.model.PeepholePermalink.resolve(PeepholePermalink.java:118) at hudson.model.Job.getLastSuccessfulBuild(Job.java:802) at sun.reflect.GeneratedMethodAccessor213.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288) at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:203) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:583) at org.kohsuke.stapler.Stapler.service(Stapler.java:214) at javax.servlet.http.HttpServlet.service(HttpServlet.java:45) at winstone.ServletConfiguration.execute(ServletConfiguration.java:248) at winstone.RequestDispatcher.forward(RequestDispatcher.java:333) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:376) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87) at winstone.FilterConfiguration.execute(FilterConfiguration.java:194) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48) at winstone.FilterConfiguration.execute(FilterConfiguration.java:194) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164) at winstone.FilterConfiguration.execute(FilterConfiguration.java:194) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:50) at winstone.FilterConfiguration.execute(FilterConfiguration.java:194) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) at winstone.FilterConfiguration.execute(FilterConfiguration.java:194) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366) at winstone.RequestDispatcher.forward(RequestDispatcher.java:331) at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:227) at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166)
          Jesse Glick made changes -
          Labels New: lts-candidate

          Jesse Glick added a comment -

          Just checked in a Jenkins dev build on 2008 R2 SP1 x64 using JDK 7u11 and the symlinks seemed to be fine from what I could see from Explorer and running dir. Send to » Compressed (zipped) folder did not work (the error message was generic). Jenkins did not report any error, either after the builds or after a restart.

          Jesse Glick added a comment - Just checked in a Jenkins dev build on 2008 R2 SP1 x64 using JDK 7u11 and the symlinks seemed to be fine from what I could see from Explorer and running dir . Send to » Compressed (zipped) folder did not work (the error message was generic). Jenkins did not report any error, either after the builds or after a restart.

          Mark Waite added a comment -

          Is it possible that you're running with UAC disabled? I'm using JDK 7u21 and I consistently see that stack on multiple machines, though they all run with user account control enabled.

          Mark Waite added a comment - Is it possible that you're running with UAC disabled? I'm using JDK 7u21 and I consistently see that stack on multiple machines, though they all run with user account control enabled.

          Mark Waite added a comment -

          http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7 seems to suggest that creating symlinks as a normal user is not allowed.

          Mark Waite added a comment - http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7 seems to suggest that creating symlinks as a normal user is not allowed.

          Jesse Glick added a comment -

          I do not really know if I am running with UAC enabled or disabled, it is just a test installation. I know creating symlinks is only allowed under conditions on versions of Windows which support it, which is why PeepholePermalink.updateCache calls createSymlink and then checks resolveSymlink to see if it worked or not. The latter method is supposed to return null if the file is not a symlink, but it is assumed the file at least exists, and PeepholePermalink fails to check this.

          Jesse Glick added a comment - I do not really know if I am running with UAC enabled or disabled, it is just a test installation. I know creating symlinks is only allowed under conditions on versions of Windows which support it, which is why PeepholePermalink.updateCache calls createSymlink and then checks resolveSymlink to see if it worked or not. The latter method is supposed to return null if the file is not a symlink, but it is assumed the file at least exists, and PeepholePermalink fails to check this.
          Jesse Glick made changes -
          Assignee New: Jesse Glick [ jglick ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Mark Waite added a comment -

          I just checked on a Windows 8 machine and confirmed that the command program "mklink.exe" requires administrator privileges to create a file symlink.

          The command "mklink x.jar classworlds.jar" fails with the message:

          You do not have sufficient privilege to perform this operation.

          If I run that same command from a window that was started with Administrator privileges, then the link is created as expected.

          http://technet.microsoft.com/library/cc766301.aspx gives the explanation that creating symlinks may expose security bugs in programs not designed to handle symlinks.

          Mark Waite added a comment - I just checked on a Windows 8 machine and confirmed that the command program "mklink.exe" requires administrator privileges to create a file symlink. The command "mklink x.jar classworlds.jar" fails with the message: You do not have sufficient privilege to perform this operation. If I run that same command from a window that was started with Administrator privileges, then the link is created as expected. http://technet.microsoft.com/library/cc766301.aspx gives the explanation that creating symlinks may expose security bugs in programs not designed to handle symlinks.

            jglick Jesse Glick
            fabian_tietz Fabian Tietz
            Votes:
            0 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved: