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

[core] “Execute Windows batch command” incorrectly switches to workspace with UNC path


    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • core
    • None
    • Windows slaves, UNC path to workspace at slave


      We have several Win7 nodes, which use workspaces at unmapped shared directories (we use UNC path at slave configuration). For those nodes, “Execute Windows batch command” build step incorrectly changes working directory before execution of script (see log below). Unfortunately, cmd only prints warning to console and then executes script in Windows directory.

      It would be great to add UNC path check before script executtion(even if it fails the build). For example, in case of admin rights flushing of working directory from “Execute Windows batch command” could cause… unexpected results

      I propose to add check of working directory path at hudson::tasks::BatchFile::getContents(). If working directory has UNC format, it is possible to extend script content by pushd/popd wrapper (see http://superuser.com/questions/282963/can-you-browse-a-unc-path-using-a-command-line-environment-without-mapping-it-to).


      Started by user Oleg Nenashev
      [EnvInject] - Loading node environment variables.
      Building remotely on ${MY_NODE} in workspace
      [Test_BatchOnSharedWorkspace] $ cmd /c call C:\Users\${MY_USER} \AppData \Local\Temp\hudson1138943559754710435.bat
      CMD.EXE was started with the above path as the current directory.
      UNC paths are not supported. Defaulting to Windows directory.

      Volume in drive C is System
      Volume Serial Number is ${MY_SN}

      Directory of C:\Windows

            Unassigned Unassigned
            oleg_nenashev Oleg Nenashev
            1 Vote for this issue
            2 Start watching this issue