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

hudson.Util.noSymLink option not respected

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Won't Fix
    • core
    • None
    • OS: Centos 7 64-bit
      JRE: OpenJDK 1.8
      Container: Tomcat
      Jenkins version: 1.651.3 (and 2.53 according to code)
      Browser: Chrome

    Description

      Steps to reproduce:

      1. Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
      2. Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
      3. Start Jenkins
      4. Perform a build or a promotion with the Promotions plugin

      Observe:

       ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
       java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
       at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
       at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
       at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
       at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
       at java.nio.file.Files.createSymbolicLink(Files.java:1043)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at hudson.Util.createSymlinkJava7(Util.java:1237)
       at hudson.Util.createSymlink(Util.java:1153)
       at hudson.model.Run.createSymlink(Run.java:1840)
       at hudson.model.Run.updateSymlinks(Run.java:1821)
       at hudson.model.Run.execute(Run.java:1736)
       at hudson.model.Run.run(Run.java:1676)
       at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
       at hudson.model.ResourceController.execute(ResourceController.java:98)
       at hudson.model.Executor.run(Executor.java:410)
      

      The problem appears to be introduced in commit ed748d4b810ac1dd85e5da7857bc203f5773f329

      Jenkins tries to create the symlink using the Java 7+ approach. If it fails, it then checks hudson.Util.noSymLink before trying other methods to create the symlink.

      Recommended fix would be to test for NO_SYMLINK at the very beginning of createSymlink.

      Attachments

        Issue Links

          Activity

            alex_stone_filament Alex Stone created issue -
            alex_stone_filament Alex Stone made changes -
            Field Original Value New Value
            Description Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
            java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
            at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
            at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
            at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
            at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
            at java.nio.file.Files.createSymbolicLink(Files.java:1043)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at hudson.Util.createSymlinkJava7(Util.java:1237)
            at hudson.Util.createSymlink(Util.java:1153)
            at hudson.model.Run.createSymlink(Run.java:1840)
            at hudson.model.Run.updateSymlinks(Run.java:1821)
            at hudson.model.Run.execute(Run.java:1736)
            at hudson.model.Run.run(Run.java:1676)
            at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
            at hudson.model.ResourceController.execute(ResourceController.java:98)
            at hudson.model.Executor.run(Executor.java:410)
            Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:

            {code}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}
            alex_stone_filament Alex Stone made changes -
            Description Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:

            {code}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}
            Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
            # Set the
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            alex_stone_filament Alex Stone made changes -
            Description Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
            # Set the
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            alex_stone_filament Alex Stone made changes -
            Description Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            The problem appears to be introduced in commit [ed748d4b810ac1dd85e5da7857bc203f5773f329| https://github.com/jenkinsci/jenkins/commit/ed748d4b810ac1dd85e5da7857bc203f5773f329?diff=unified]

            Jenkins try to create the symlink. If it fails, it then checks

            alex_stone_filament Alex Stone made changes -
            Description Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            The problem appears to be introduced in commit [ed748d4b810ac1dd85e5da7857bc203f5773f329| https://github.com/jenkinsci/jenkins/commit/ed748d4b810ac1dd85e5da7857bc203f5773f329?diff=unified]

            Jenkins try to create the symlink. If it fails, it then checks

            Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            The problem appears to be introduced in commit [ed748d4b810ac1dd85e5da7857bc203f5773f329| https://github.com/jenkinsci/jenkins/commit/ed748d4b810ac1dd85e5da7857bc203f5773f329?diff=unified]

            Jenkins try to create the symlink using the Java 7+ approach. If it fails, it then checks hudson.Util.noSymLink before trying other methods to create the symlink.

            alex_stone_filament Alex Stone made changes -
            Description Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            The problem appears to be introduced in commit [ed748d4b810ac1dd85e5da7857bc203f5773f329| https://github.com/jenkinsci/jenkins/commit/ed748d4b810ac1dd85e5da7857bc203f5773f329?diff=unified]

            Jenkins try to create the symlink using the Java 7+ approach. If it fails, it then checks hudson.Util.noSymLink before trying other methods to create the symlink.

            Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            The problem appears to be introduced in commit [ed748d4b810ac1dd85e5da7857bc203f5773f329| https://github.com/jenkinsci/jenkins/commit/ed748d4b810ac1dd85e5da7857bc203f5773f329?diff=unified]

            Jenkins try to create the symlink using the Java 7+ approach. If it fails, it then checks hudson.Util.noSymLink before trying other methods to create the symlink.

            Recommended fix would be to test for NO_SYMLINK at the very beginning of createSymlink.
            alex_stone_filament Alex Stone made changes -
            Summary hudson.Util.noSymLink option not respected on JRE 1.7+ hudson.Util.noSymLink option not respected
            alex_stone_filament Alex Stone made changes -
            Description Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            The problem appears to be introduced in commit [ed748d4b810ac1dd85e5da7857bc203f5773f329| https://github.com/jenkinsci/jenkins/commit/ed748d4b810ac1dd85e5da7857bc203f5773f329?diff=unified]

            Jenkins try to create the symlink using the Java 7+ approach. If it fails, it then checks hudson.Util.noSymLink before trying other methods to create the symlink.

            Recommended fix would be to test for NO_SYMLINK at the very beginning of createSymlink.
            Steps to reproduce:
             # Copy Jenkins home directory to a filesystem that does not support symlinks (AWS Storage Gateway in my case)
             # Add -Dhudson.Util.noSymLink=true to java options in tomcat configuration
             # Start Jenkins
             # Perform a build or a promotion with the Promotions plugin

            Observe:
            {code:java}
             ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful failed
             java.nio.file.FileSystemException: /var/lib/jenkins/jobs/McRel Identity App/promotions/dev/lastSuccessful: Unknown error 524
             at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
             at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
             at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
             at java.nio.file.Files.createSymbolicLink(Files.java:1043)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at hudson.Util.createSymlinkJava7(Util.java:1237)
             at hudson.Util.createSymlink(Util.java:1153)
             at hudson.model.Run.createSymlink(Run.java:1840)
             at hudson.model.Run.updateSymlinks(Run.java:1821)
             at hudson.model.Run.execute(Run.java:1736)
             at hudson.model.Run.run(Run.java:1676)
             at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
             at hudson.model.ResourceController.execute(ResourceController.java:98)
             at hudson.model.Executor.run(Executor.java:410)
            {code}

            The problem appears to be introduced in commit [ed748d4b810ac1dd85e5da7857bc203f5773f329| https://github.com/jenkinsci/jenkins/commit/ed748d4b810ac1dd85e5da7857bc203f5773f329?diff=unified]

            Jenkins tries to create the symlink using the Java 7+ approach. If it fails, it then checks hudson.Util.noSymLink before trying other methods to create the symlink.

            Recommended fix would be to test for NO_SYMLINK at the very beginning of createSymlink.
            oleg_nenashev Oleg Nenashev added a comment - So the option is not being checked if Java is 1.7 or above: https://github.com/jenkinsci/jenkins/blob/bde09f70afaf10d5e1453c257058a56b07556e8e/core/src/main/java/hudson/Util.java#L1304-L1309 . According to https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties Java version should not matter, hence IMHO it is a valid bug
            floody Andor Herendi added a comment -

            Hello Guys!

            Is this still a thing? I've checked the codebase and they altered the behavior in this commit.

            For me, it seems the noSymLink and symlinkEscapeHatch environment variables are no longer in use or not making any difference for the code. By default, the code tries to create the links and if it isn't supported by the filesystem, then it catches the exception and logs its content into the log files.

            If my assumptions are correct and noSymLink and symlinkEscapeHatch doesn't alters the behavior elsewhere, then we should remove these two variables from this page, because these are no longer supported or used.

            I also planning to move Jenkins' home to such a filesystem (Azure Files) where the symlinks are not supported. Did you saw any side-effects while using Jenkins?

             

            floody Andor Herendi added a comment - Hello Guys! Is this still a thing? I've checked the codebase and they altered the behavior in this commit . For me, it seems the noSymLink and symlinkEscapeHatch environment variables are no longer in use or not making any difference for the code. By default, the code tries to create the links and if it isn't supported by the filesystem, then it catches the exception and logs its content into the log files. If my assumptions are correct and noSymLink and symlinkEscapeHatch doesn't alters the behavior elsewhere, then we should remove these two variables from this page , because these are no longer supported or used. I also planning to move Jenkins' home to such a filesystem (Azure Files) where the symlinks are not supported. Did you saw any side-effects while using Jenkins?  
            floody Andor Herendi made changes -
            Link This issue is related to JENKINS-43540 [ JENKINS-43540 ]
            jglick Jesse Glick added a comment -

            As of JENKINS-37862 Jenkins does not use build symlinks by default, so this should not be an issue.

            jglick Jesse Glick added a comment - As of JENKINS-37862 Jenkins does not use build symlinks by default, so this should not be an issue.
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-37862 [ JENKINS-37862 ]
            jglick Jesse Glick made changes -
            Resolution Won't Fix [ 2 ]
            Status Open [ 1 ] Resolved [ 5 ]

            People

              Unassigned Unassigned
              alex_stone_filament Alex Stone
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: