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

xshell returns mixture of unix/mac and Windows path

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • xshell-plugin
    • None
    • Controller: Windows 2016 server
      Agent MAC
      Jenkins 2.382
      xshell 129.v99c1dcfa_d3d2 (upgraded from xshell-v10)

      Executing a script result in a mixture of Windows and mac path and an IOException is raised.

      Running as SYSTEM
      [EnvInject] - Loading node environment variables.
      Building remotely on macbs04 (mac) in workspace /Users/jenkins/jenkins/workspace/TEST-JOB-MAC-STRANGE-WS-PATH
      [TEST-JOB-MAC-STRANGE-WS-PATH] $ echo "Hello World"
      FATAL: Command execution failed.
      java.io.IOException: Process working directory '/Users/jenkins/jenkins/\Users\jenkins\jenkins\workspace\TEST-JOB-MAC-STRANGE-WS-PATH' doesn't exist!
          at hudson.Proc$LocalProc.<init>(Proc.java:252)
          at hudson.Proc$LocalProc.<init>(Proc.java:223)
          at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
          at hudson.Launcher$ProcStarter.start(Launcher.java:509)
          at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1398)
          at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1340)
          at hudson.remoting.UserRequest.perform(UserRequest.java:211)
          at hudson.remoting.UserRequest.perform(UserRequest.java:54)
          at hudson.remoting.Request$2.run(Request.java:376)
          at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)

      DEBUGGING INFO
      dec. 21, 2022 8:14:23 FM FINE hudson.plugins.xshell.XShellBuilder
      Command line: echo "Hello World"
      dec. 21, 2022 8:14:23 FM FINE hudson.plugins.xshell.XShellBuilder
      Working directory: /Users/jenkins/jenkins/workspace/TEST-JOB-MAC-STRANGE-WS-PATH/
      dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
      Unmodified command line: echo "Hello World"
      dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
      Regex to kill:
      dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
      Time allocated before kill:
      dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
      File separators sanitized: echo "Hello World"
      dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
      Expanded build environment vars: echo "Hello World"
      dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
      Environment variables sanitized: echo "Hello World"
      dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
      Execute from working directory: echo "Hello World"
      dec. 21, 2022 8:15:07 FM FINEST hudson.plugins.xshell.XShellBuilder

       

      Omitting env vars

      ...

      dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
      Command line: echo "Hello World"
      dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
      Working directory: /Users/Jenkins/jenkins/workspace/TEST-JOB-MAC-STRANGE-WS-PATH

          [JENKINS-70323] xshell returns mixture of unix/mac and Windows path

          Mark Waite added a comment -

          It looks like the xshell plugin on a Windows controller does not support non-Windows agents. I don't have macOS. The closest approximation I have is FreeBSD. The FreeBSD failure mode looks very close to the macOS failure mode.

          Works on Linux controller

          The steps I took that worked as expected were:

          1. Create a freestyle project on my Linux controller and limit it to only run on a FreeBSD agent
          2. Add an XShell build step that performs the command echo "Hello World"
          3. Run the freestyle project and confirm that "Hello World" is output as expected

          Fails on Windows controller

          The steps I took that failed were:

          1. Create a freestyle project on a Windows controller with a FreeBSD agent and limit the job to only run on a FreeBSD agent
          2. Add an XShell build step that performs the command echo "Hello World"
          3. Run the freestyle project and confirm that the job fails. The job output is:
            Started by user Mark Waite
            Running as SYSTEM
            Building remotely on freebsd-13-c (FreeBSD) in workspace /tmp/agent-a/workspace/JENKINS-70323-xshell-bad-path
            [JENKINS-70323-xshell-bad-path] $ echo "Hello World"
            FATAL: Command execution failed.
            java.io.IOException: Process working directory '/usr/home/mwaite/tmp/\tmp\agent-a\workspace\JENKINS-70323-xshell-bad-path' doesn't exist!
            	at hudson.Proc$LocalProc.<init>(Proc.java:252)
            	at hudson.Proc$LocalProc.<init>(Proc.java:223)
            	at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
            	at hudson.Launcher$ProcStarter.start(Launcher.java:509)
            	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1398)
            	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1340)
            	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
            	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
            	at hudson.remoting.Request$2.run(Request.java:376)
            	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
            	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
            	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
            	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
            	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:125)
            	at java.base/java.lang.Thread.run(Thread.java:829)
            	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to freebsd-13-c
            		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784)
            		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
            		at hudson.remoting.Channel.call(Channel.java:1000)
            		at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1124)
            		at hudson.Launcher$ProcStarter.start(Launcher.java:509)
            		at hudson.plugins.xshell.XShellBuilder.perform(XShellBuilder.java:162)
            		at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
            		at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:816)
            		at hudson.model.Build$BuildExecution.build(Build.java:199)
            		at hudson.model.Build$BuildExecution.doRun(Build.java:164)
            		at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
            		at hudson.model.Run.execute(Run.java:1899)
            		at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
            		at hudson.model.ResourceController.execute(ResourceController.java:107)
            		at hudson.model.Executor.run(Executor.java:449)
            Build step 'Invoke XShell command' marked build as failure
            Finished: FAILURE
            

          I don't plan to work on this issue. Other issues are higher priority for me. You can work around the issue by using a conditional build step to run a shell step when the agent is non-Windows and a bat step when the agent is Windows. You can work around the issue by using a non-Windows controller (Linux, macOS, FreeBSD, etc.).

          Mark Waite added a comment - It looks like the xshell plugin on a Windows controller does not support non-Windows agents. I don't have macOS. The closest approximation I have is FreeBSD. The FreeBSD failure mode looks very close to the macOS failure mode. Works on Linux controller The steps I took that worked as expected were: Create a freestyle project on my Linux controller and limit it to only run on a FreeBSD agent Add an XShell build step that performs the command echo "Hello World" Run the freestyle project and confirm that "Hello World" is output as expected Fails on Windows controller The steps I took that failed were: Create a freestyle project on a Windows controller with a FreeBSD agent and limit the job to only run on a FreeBSD agent Add an XShell build step that performs the command echo "Hello World" Run the freestyle project and confirm that the job fails. The job output is: Started by user Mark Waite Running as SYSTEM Building remotely on freebsd-13-c (FreeBSD) in workspace /tmp/agent-a/workspace/JENKINS-70323-xshell-bad-path [JENKINS-70323-xshell-bad-path] $ echo "Hello World" FATAL: Command execution failed. java.io.IOException: Process working directory '/usr/home/mwaite/tmp/\tmp\agent-a\workspace\JENKINS-70323-xshell-bad-path' doesn't exist! at hudson.Proc$LocalProc.<init>(Proc.java:252) at hudson.Proc$LocalProc.<init>(Proc.java:223) at hudson.Launcher$LocalLauncher.launch(Launcher.java:997) at hudson.Launcher$ProcStarter.start(Launcher.java:509) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1398) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1340) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:376) at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:125) at java.base/java.lang.Thread.run(Thread.java:829) Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to freebsd-13-c at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356) at hudson.remoting.Channel.call(Channel.java:1000) at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1124) at hudson.Launcher$ProcStarter.start(Launcher.java:509) at hudson.plugins.xshell.XShellBuilder.perform(XShellBuilder.java:162) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:816) at hudson.model.Build$BuildExecution.build(Build.java:199) at hudson.model.Build$BuildExecution.doRun(Build.java:164) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524) at hudson.model.Run.execute(Run.java:1899) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) at hudson.model.ResourceController.execute(ResourceController.java:107) at hudson.model.Executor.run(Executor.java:449) Build step 'Invoke XShell command' marked build as failure Finished: FAILURE I don't plan to work on this issue. Other issues are higher priority for me. You can work around the issue by using a conditional build step to run a shell step when the agent is non-Windows and a bat step when the agent is Windows. You can work around the issue by using a non-Windows controller (Linux, macOS, FreeBSD, etc.).

            Unassigned Unassigned
            kengra1 Kent Granström
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: