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 created issue -

          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 made changes -
          Link New: This issue is related to JENKINS-3496 [ JENKINS-3496 ]

          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 made changes -
          Link New: This issue is related to JENKINS-13285 [ JENKINS-13285 ]

          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 made changes -
          Link New: This issue is related to JENKINS-12911 [ 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()); }
          Timothy Lantz made changes -
          Assignee New: Timothy Lantz [ tslantz ]

          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.

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

              Created:
              Updated:
              Resolved: