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

Decorated Launcher Does Not Maintain "isUnix" for RemoteLauncher

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • Reproducible with Windows master, Linux slaves

      RemoteLauncher's isUnix attribute is supplied on construction for slaves. However, when the RemoteLauncher is passed through decorateByEnv, because the anonymous class created in this method does not override isUnix, it delegates back to the base Launcher's File.pathSeparatorChar==':' check. The value for the slave passed into RemoteLauncher on construction is lost. A similar problem occurs with decorateByPrefix.

      This will cause a problem if any downstream logic depends on the Launcher's isUnix value for a process launched on a slave with a different isUnix value than the master. For example, with a Windows master and a Linux slave, the wrong file path separator is selected in a regex on the history output, and so the SCM polling does not accurately pick up changes.

          [JENKINS-18368] Decorated Launcher Does Not Maintain "isUnix" for RemoteLauncher

          Timothy Lantz added a comment -

          Similar to this issue, but specifically when the RemoteLauncher gets wrapped by a decorate* method, the isUnix value is "masked".

          Timothy Lantz added a comment - Similar to this issue, but specifically when the RemoteLauncher gets wrapped by a decorate* method, the isUnix value is "masked".

          Timothy Lantz added a comment -

          Seems to be the same issue as this, but in a different area of the code.

          Timothy Lantz added a comment - Seems to be the same issue as this, but in a different area of the code.

          Timothy Lantz added a comment -

          Looks to be the root cause of JENKINS-12911.

          Timothy Lantz added a comment - Looks to be the root cause of JENKINS-12911 .

          Timothy Lantz added a comment - - edited

          Some tests to reproduce the issue, will put together a pull request referencing the bug.

              @Bug(18368)
              public void testDecoratedByEnvMaintainsIsUnix() throws Exception {
                  ByteArrayOutputStream output = new ByteArrayOutputStream();
                  TaskListener listener = new StreamBuildListener(output);
                  Launcher remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, false);
                  Launcher decorated = remoteLauncher.decorateByEnv(new EnvVars());
                  assertEquals(false, decorated.isUnix());
                  remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, true);
                  decorated = remoteLauncher.decorateByEnv(new EnvVars());
                  assertEquals(true, decorated.isUnix());
              }
          
              @Bug(18368)
              public void testDecoratedByPrefixMaintainsIsUnix() throws Exception {
                  ByteArrayOutputStream output = new ByteArrayOutputStream();
                  TaskListener listener = new StreamBuildListener(output);
                  Launcher remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, false);
                  Launcher decorated = remoteLauncher.decorateByPrefix("test");
                  assertEquals(false, decorated.isUnix());
                  remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, true);
                  decorated = remoteLauncher.decorateByPrefix("test");
                  assertEquals(true, decorated.isUnix());
              }
          

          Timothy Lantz added a comment - - edited Some tests to reproduce the issue, will put together a pull request referencing the bug. @Bug(18368) public void testDecoratedByEnvMaintainsIsUnix() throws Exception { ByteArrayOutputStream output = new ByteArrayOutputStream(); TaskListener listener = new StreamBuildListener(output); Launcher remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, false ); Launcher decorated = remoteLauncher.decorateByEnv( new EnvVars()); assertEquals( false , decorated.isUnix()); remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, true ); decorated = remoteLauncher.decorateByEnv( new EnvVars()); assertEquals( true , decorated.isUnix()); } @Bug(18368) public void testDecoratedByPrefixMaintainsIsUnix() throws Exception { ByteArrayOutputStream output = new ByteArrayOutputStream(); TaskListener listener = new StreamBuildListener(output); Launcher remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, false ); Launcher decorated = remoteLauncher.decorateByPrefix( "test" ); assertEquals( false , decorated.isUnix()); remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, true ); decorated = remoteLauncher.decorateByPrefix( "test" ); assertEquals( true , decorated.isUnix()); }

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/c1c6475bbb1aa3d7ea14cfeeef8ed417b0e4ca1e
          Log:
          JENKINS-18368 Noting.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html http://jenkins-ci.org/commit/jenkins/c1c6475bbb1aa3d7ea14cfeeef8ed417b0e4ca1e Log: JENKINS-18368 Noting.

          Jesse Glick added a comment -

          Jesse Glick added a comment - https://github.com/jenkinsci/jenkins/commit/81f49bd5c5c8fb74ce7a8c5e0d005d2117c252ad

          Jesse Glick added a comment -

          BTW I think you confused the JIRA auto-notifier by using

          [FIXED JENKINS-18368]: message

          rather than the conventional

          [FIXED JENKINS-18368] message

          Jesse Glick added a comment - BTW I think you confused the JIRA auto-notifier by using [FIXED JENKINS-18368]: message rather than the conventional [FIXED JENKINS-18368] message

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2632
          JENKINS-18368 added isUnix override to launcher decorator classes so that isUnix is maintained for remote launcherswq (Revision 656738c020881e96e21511670a2dd4a6e8dad2ce)
          [FIXED JENKINS-18368]: modified testcase asserts (Revision d6ccf84eb451517c82fe6448fe0259c5a5c112f2)
          [FIXED JENKINS-18368]: added Bug attributes (Revision 7f67499141f325dff9fe1ea06331b2bcc0d03003)
          JENKINS-18368 Noting. (Revision c1c6475bbb1aa3d7ea14cfeeef8ed417b0e4ca1e)

          Result = UNSTABLE
          tlantz : 656738c020881e96e21511670a2dd4a6e8dad2ce
          Files :

          • core/src/test/java/hudson/LauncherTest.java
          • core/src/main/java/hudson/Launcher.java

          tlantz : d6ccf84eb451517c82fe6448fe0259c5a5c112f2
          Files :

          • core/src/test/java/hudson/LauncherTest.java

          tim.lantz : 7f67499141f325dff9fe1ea06331b2bcc0d03003
          Files :

          • core/src/test/java/hudson/LauncherTest.java

          Jesse Glick : c1c6475bbb1aa3d7ea14cfeeef8ed417b0e4ca1e
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #2632 JENKINS-18368 added isUnix override to launcher decorator classes so that isUnix is maintained for remote launcherswq (Revision 656738c020881e96e21511670a2dd4a6e8dad2ce) [FIXED JENKINS-18368] : modified testcase asserts (Revision d6ccf84eb451517c82fe6448fe0259c5a5c112f2) [FIXED JENKINS-18368] : added Bug attributes (Revision 7f67499141f325dff9fe1ea06331b2bcc0d03003) JENKINS-18368 Noting. (Revision c1c6475bbb1aa3d7ea14cfeeef8ed417b0e4ca1e) Result = UNSTABLE tlantz : 656738c020881e96e21511670a2dd4a6e8dad2ce Files : core/src/test/java/hudson/LauncherTest.java core/src/main/java/hudson/Launcher.java tlantz : d6ccf84eb451517c82fe6448fe0259c5a5c112f2 Files : core/src/test/java/hudson/LauncherTest.java tim.lantz : 7f67499141f325dff9fe1ea06331b2bcc0d03003 Files : core/src/test/java/hudson/LauncherTest.java Jesse Glick : c1c6475bbb1aa3d7ea14cfeeef8ed417b0e4ca1e Files : changelog.html

          Jesse Glick added a comment -

          https://github.com/jenkinsci/jenkins/commit/9429452bda21005d2ec6ca66fb1677f2b7971a98 in 1.489 seems to have introduced the regression in polling.

          Jesse Glick added a comment - https://github.com/jenkinsci/jenkins/commit/9429452bda21005d2ec6ca66fb1677f2b7971a98 in 1.489 seems to have introduced the regression in polling.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/plugins/clearcase/AbstractClearCaseScm.java
          src/main/java/hudson/plugins/clearcase/ClearToolExec.java
          src/main/java/hudson/plugins/clearcase/history/AbstractHistoryAction.java
          http://jenkins-ci.org/commit/clearcase-plugin/549b3287db17d06f27d057c1f3681b1a98347ffa
          Log:
          JENKINS-18368 Trying to work around core bug by correcting the Unix flag on the launcher when running polling.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/plugins/clearcase/AbstractClearCaseScm.java src/main/java/hudson/plugins/clearcase/ClearToolExec.java src/main/java/hudson/plugins/clearcase/history/AbstractHistoryAction.java http://jenkins-ci.org/commit/clearcase-plugin/549b3287db17d06f27d057c1f3681b1a98347ffa Log: JENKINS-18368 Trying to work around core bug by correcting the Unix flag on the launcher when running polling.

            tslantz Timothy Lantz
            tslantz Timothy Lantz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: