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

SecretRewriter.rewriteRecursive fails to resolve symbolic links on Windows

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None
    • Jenkins 1.611
      JDK 1.7.0_45
      Windows 8 (64 bits)

      SecretRewriter.rewriteRecursive fails to detect cyclic paths on Windows as File#getCanonicalPath doesn't resolve symbolic links. Resolving symbolic links are performed only on *nix systems.
      http://docs.oracle.com/javase/6/docs/api/java/io/File.html#getCanonicalPath%28%29

      More worse, SecretRewriterTest#recursionDetection doesn't finish on Windows like this:

      Running hudson.util.SecretRewriterTest
      Scanning C:\workspace\jenkins\core\target\junit4449490825533171592\t\a\foo.xml
      Copied C:\workspace\jenkins\core\target\junit4449490825533171592\t\a\foo.xml to C:\workspace\jenkins\core\target\junit4449490825533171592\backup\a\foo.xml as a backup
      Rewritten C:\workspace\jenkins\core\target\junit4449490825533171592\t\a\foo.xml
      Copied C:\workspace\jenkins\core\target\junit4449490825533171592\t\a\symlink\foo.xml to C:\workspace\jenkins\core\target\junit4449490825533171592\backup\a\symlink\foo.xml as a backup
      Rewritten C:\workspace\jenkins\core\target\junit4449490825533171592\t\a\symlink\foo.xml
      Copied C:\workspace\jenkins\core\target\junit4449490825533171592\t\b\foo.xml to C:\workspace\jenkins\core\target\junit4449490825533171592\backup\b\foo.xml as a backup
      Rewritten C:\workspace\jenkins\core\target\junit4449490825533171592\t\b\foo.xml
      Copied C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\d\e\foo.xml to C:\workspace\jenkins\core\target\junit4449490825533171592\backup\c\d\e\foo.xml as a backup
      Rewritten C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\d\e\foo.xml
      Copied C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\d\foo.xml to C:\workspace\jenkins\core\target\junit4449490825533171592\backup\c\d\foo.xml as a backup
      Rewritten C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\d\foo.xml
      Copied C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\foo.xml to C:\workspace\jenkins\core\target\junit4449490825533171592\backup\c\foo.xml as a backup
      Rewritten C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\foo.xml
      Scanning C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\symlink\b\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\foo.xml
      Scanning C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\symlink\c\symlink\c\foo.xml
      Scanning C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\symlink\c\symlink\c\symlink\c\symlink\b\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\symlink\foo.xml
      Scanning C:\workspace\jenkins\core\target\junit4449490825533171592\t\c\symlink\c\symlink\c\symlink\c\symlink\c\symlink\c\symlink\b\symlink\symlink\symlink\symlink\symlink\foo.xml
      ...
      

      I found a related report on Eclipse's Bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=363463

          [JENKINS-28192] SecretRewriter.rewriteRecursive fails to resolve symbolic links on Windows

          ikedam added a comment -

          ikedam added a comment - https://github.com/jenkinsci/jenkins/pull/1685

          ikedam added a comment -

          The same problem in VirtualFile#isIllegalSymlink, which results a failure of VirtualFileTest#outsideSymlinks on Windows.

          ikedam added a comment - The same problem in VirtualFile#isIllegalSymlink , which results a failure of VirtualFileTest#outsideSymlinks on Windows.

          ikedam added a comment -

          I'll create a pull request after Jenkins 1.614 (which targets Java 1.7) is released.

          ikedam added a comment - I'll create a pull request after Jenkins 1.614 (which targets Java 1.7) is released.

          ikedam added a comment -

          ikedam added a comment - https://github.com/jenkinsci/jenkins/pull/1731

          Code changed in jenkins
          User: ikedam
          Path:
          core/src/main/java/hudson/util/SecretRewriter.java
          core/src/main/java/jenkins/util/VirtualFile.java
          http://jenkins-ci.org/commit/jenkins/16883377dff9ad3f48e9fe6404af1e9cf2c9dbbf
          Log:
          [FIXED JENKINS-28192] Uses java.nio.file.Path#toRealPath instead of File#getCanonicalPath, which resolves symbolic links also on Windows.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: ikedam Path: core/src/main/java/hudson/util/SecretRewriter.java core/src/main/java/jenkins/util/VirtualFile.java http://jenkins-ci.org/commit/jenkins/16883377dff9ad3f48e9fe6404af1e9cf2c9dbbf Log: [FIXED JENKINS-28192] Uses java.nio.file.Path#toRealPath instead of File#getCanonicalPath, which resolves symbolic links also on Windows.

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/util/SecretRewriter.java
          core/src/main/java/jenkins/util/VirtualFile.java
          http://jenkins-ci.org/commit/jenkins/80f88d7654f2fad9b3995bc4474fb048cd6282ca
          Log:
          Merge pull request #1731 from ikedam/feature/JENKINS-28192_ResolveSymlinkOnWindows

          JENKINS-28192 SecretRewriter.rewriteRecursive fails to resolve symbolic links on Windows

          Compare: https://github.com/jenkinsci/jenkins/compare/bc254648870c...80f88d7654f2

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/util/SecretRewriter.java core/src/main/java/jenkins/util/VirtualFile.java http://jenkins-ci.org/commit/jenkins/80f88d7654f2fad9b3995bc4474fb048cd6282ca Log: Merge pull request #1731 from ikedam/feature/ JENKINS-28192 _ResolveSymlinkOnWindows JENKINS-28192 SecretRewriter.rewriteRecursive fails to resolve symbolic links on Windows Compare: https://github.com/jenkinsci/jenkins/compare/bc254648870c...80f88d7654f2

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: changelog.html http://jenkins-ci.org/commit/jenkins/37f641733fd0186f30607f19100a6c19e0a6210f Log: Noting JENKINS-28192 from https://github.com/jenkinsci/jenkins/pull/1731

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4329
          [FIXED JENKINS-28192] Uses java.nio.file.Path#toRealPath instead of File#getCanonicalPath, which resolves symbolic links also on Windows. (Revision 16883377dff9ad3f48e9fe6404af1e9cf2c9dbbf)
          Noting JENKINS-28192 from https://github.com/jenkinsci/jenkins/pull/1731 (Revision 37f641733fd0186f30607f19100a6c19e0a6210f)

          Result = SUCCESS
          devld : 16883377dff9ad3f48e9fe6404af1e9cf2c9dbbf
          Files :

          • core/src/main/java/hudson/util/SecretRewriter.java
          • core/src/main/java/jenkins/util/VirtualFile.java

          o.v.nenashev : 37f641733fd0186f30607f19100a6c19e0a6210f
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #4329 [FIXED JENKINS-28192] Uses java.nio.file.Path#toRealPath instead of File#getCanonicalPath, which resolves symbolic links also on Windows. (Revision 16883377dff9ad3f48e9fe6404af1e9cf2c9dbbf) Noting JENKINS-28192 from https://github.com/jenkinsci/jenkins/pull/1731 (Revision 37f641733fd0186f30607f19100a6c19e0a6210f) Result = SUCCESS devld : 16883377dff9ad3f48e9fe6404af1e9cf2c9dbbf Files : core/src/main/java/hudson/util/SecretRewriter.java core/src/main/java/jenkins/util/VirtualFile.java o.v.nenashev : 37f641733fd0186f30607f19100a6c19e0a6210f Files : changelog.html

            ikedam ikedam
            ikedam ikedam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: