• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • cygpath-plugin
    • None
    • OS: Windows 2003 Server 64-bit

      Similar to a previous bug, the plug in is looking in the wrong location on a 64 bit machine. In the registry, the information is stored under

      HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Cygnus Solutions/Cygwin/mounts v2/

      and not under

      HKEY_LOCAL_MACHINE/SOFTWARE/Cygnus Solutions/Cygwin/mounts v2/

          [JENKINS-7303] Could not find "cygpath" on Win64 machine

          anilarora created issue -
          anilarora made changes -
          Description Original: Started by user anonymous
          Building remotely on asqe-xeon-4.sfbay.sun.com
          Allocating TCP port 8080
          TCP port allocation complete
          FATAL: command execution failed
          java.io.IOException: Cannot run program "cygpath": CreateProcess error=2, The
          system cannot find the file specified
          at java.lang.ProcessBuilder.start(Unknown Source)
          at hudson.Proc$LocalProc.<init>(Proc.java:145)
          at hudson.Proc$LocalProc.<init>(Proc.java:118)
          at hudson.Launcher$LocalLauncher.launch(Launcher.java:633)
          at hudson.Launcher$ProcStarter.start(Launcher.java:268)
          at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:773)
          at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:751)
          at hudson.remoting.UserRequest.perform(UserRequest.java:103)
          at hudson.remoting.UserRequest.perform(UserRequest.java:47)
          at hudson.remoting.Request$2.run(Request.java:236)
          at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
          at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
          at java.util.concurrent.FutureTask.run(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at hudson.remoting.Engine$1$1.run(Engine.java:54)
          at java.lang.Thread.run(Unknown Source)
          Caused by: java.io.IOException: CreateProcess error=2, The system cannot find
          the file specified
          at java.lang.ProcessImpl.create(Native Method)
          at java.lang.ProcessImpl.<init>(Unknown Source)
          at java.lang.ProcessImpl.start(Unknown Source)
          ... 17 more
          Archiving artifacts
          Collecting JWSDP SQE reports
          New: Similar to a previous bug, the plug in is looking in the wrong location on a 64 bit machine. In the registry, the information is stored under

          HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Cygnus Solutions/Cygwin/mounts v2/

          and not under

          HKEY_LOCAL_MACHINE/SOFTWARE/Cygnus Solutions/Cygwin/mounts v2/
          Environment Original: Platform: All, OS: All New: OS: Windows 2003 Server 64-bit

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          src/main/java/hudson/plugins/cygpath/CygpathLauncherDecorator.java
          http://jenkins-ci.org/commit/cygpath-plugin/f2d22f019b9184a98dff79dccb3972a5d3a283fd
          Log:
          [FIXED JENKINS-7303] made to work on 64bit Windows

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: src/main/java/hudson/plugins/cygpath/CygpathLauncherDecorator.java http://jenkins-ci.org/commit/cygpath-plugin/f2d22f019b9184a98dff79dccb3972a5d3a283fd Log: [FIXED JENKINS-7303] made to work on 64bit Windows
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Neeme Praks added a comment - - edited

          I added a comment under JENKINS-20364, but it is somewhat relevant also for this issue, so I'm copying parts of it here.

          I'm not sure the change made in JENKINS-7303 actually fixes anything (did someone test this?). The "Wow6432Node" subkey seems to be implementation detail of Windows registry and the application code should not care about it. Instead, it should use the relevant access bit (as described above). Also, my tests have shown that with current code, 64bit JVM running on 64bit Windows can access "HKEY..WARE\Cygwin\setup".

          The problem is with 32bit JVM running on 64bit Windows: it looks up "HKEY..WARE\Cygwin\setup" but Windows translates that into "HKEY..WARE\Wow6432Node\Cygwin\setup" (which is missing). And, when it tries to access "HKEY..WARE\Wow6432Node\Cygwin\setup", Windows probably translates that into "HKEY..WARE\Wow6432Node\Wow6432Node\Cygwin\setup" which is also missing. So 32bit JVM running on 64bit Windows has no access to "HKEY..WARE\Cygwin\setup" unless it specifies the special KEY_WOW64_64KEY flag.

          I'm not sure if the other scenario of 64bit JVM running on 64bit Windows trying to look up "HKEY..WARE\Wow6432Node\Cygwin\setup" works or KEY_WOW64_32KEY flag should be used instead (covering the case when "HKEY..WARE\Cygwin\setup" is missing but "HKEY..WARE\Wow6432Node\Cygwin\setup" exists). Should probably test that.

          Assuming that the fix made here actually works (otherwise it would have been re-opened long ago), my second comment can be ignored – 64bit JVM running on 64bit Windows looking up "HKEY..WARE\Wow6432Node\Cygwin\setup" probably works. The problem is that this fix does not work for 32bit JVM running on 64bit Windows (see my comment on JENKINS-20364 for details).

          Useful reading:
          http://windowsitpro.com/systems-management/whats-wow6432node-under-hkeylocalmachinesoftware-registry-subkey
          http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx

          Neeme Praks added a comment - - edited I added a comment under JENKINS-20364 , but it is somewhat relevant also for this issue, so I'm copying parts of it here. I'm not sure the change made in JENKINS-7303 actually fixes anything (did someone test this?). The "Wow6432Node" subkey seems to be implementation detail of Windows registry and the application code should not care about it. Instead, it should use the relevant access bit (as described above). Also, my tests have shown that with current code, 64bit JVM running on 64bit Windows can access "HKEY..WARE\Cygwin\setup". The problem is with 32bit JVM running on 64bit Windows: it looks up "HKEY..WARE\Cygwin\setup" but Windows translates that into "HKEY..WARE\Wow6432Node\Cygwin\setup" (which is missing). And, when it tries to access "HKEY..WARE\Wow6432Node\Cygwin\setup", Windows probably translates that into "HKEY..WARE\Wow6432Node\Wow6432Node\Cygwin\setup" which is also missing. So 32bit JVM running on 64bit Windows has no access to "HKEY..WARE\Cygwin\setup" unless it specifies the special KEY_WOW64_64KEY flag. I'm not sure if the other scenario of 64bit JVM running on 64bit Windows trying to look up "HKEY..WARE\Wow6432Node\Cygwin\setup" works or KEY_WOW64_32KEY flag should be used instead (covering the case when "HKEY..WARE\Cygwin\setup" is missing but "HKEY..WARE\Wow6432Node\Cygwin\setup" exists). Should probably test that. Assuming that the fix made here actually works (otherwise it would have been re-opened long ago), my second comment can be ignored – 64bit JVM running on 64bit Windows looking up "HKEY..WARE\Wow6432Node\Cygwin\setup" probably works. The problem is that this fix does not work for 32bit JVM running on 64bit Windows (see my comment on JENKINS-20364 for details). Useful reading: http://windowsitpro.com/systems-management/whats-wow6432node-under-hkeylocalmachinesoftware-registry-subkey http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx

          Neeme Praks added a comment -

          Reopening as the solution does not work for 32bit JVM running on 64bit Windows. I'm not sure if this should be solved here or under JENKINS-20364. Feel free to resolve if JENKINS-20364 seems more appropriate.

          Neeme Praks added a comment - Reopening as the solution does not work for 32bit JVM running on 64bit Windows. I'm not sure if this should be solved here or under JENKINS-20364 . Feel free to resolve if JENKINS-20364 seems more appropriate.
          Neeme Praks made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Oleg Nenashev made changes -
          Component/s New: cygpath [ 15987 ]
          Component/s Original: plugin [ 15491 ]

          Jan Krag added a comment -

          It seems, from the above, and reading the provided links, that the current implementation of directly looking up in the SOFTWARE\Wow6432Node\ is not actually a recommended way of doing it, as \Wow6432Node is an implementation detail, and may break compatibility in the future (or past?).

          Also, in our investigation, we have found that the whole Wow64 registry translation seems extremely fragile, and gives rise to al sorts of confusion, and the mapping is not even the same on different versions of windows.

          We are currently investigating a situation where two machines seem to behave differently. Both are running 64 bit java (as reported by java -version in Execute shell), and both have only a 64bit Cygwin installed, and referenced in Software\Cygwin\setup[rootdir]. One of them finds cygpath just fine, the other doesn't, and the main difference between these machines is that one is running Win 7, the other Win Server 2012.

          On both machines we have tried running
          reg query HKLM\Software\Cygwin\setup /v rootdir /reg:32
          — ERROR: The system was unable to find ....

          reg query HKLM\Software\Cygwin\setup /v rootdir /reg:64
          — rootdir REG_SZ c:\cygwin64

          If we run
          reg query HKLM\Software\Cygwin\setup /v rootdir
          without the view specifier, we get the positive answer, but if we run it in a 32bit command prompt, we get the error.

          Our temporary conclusion is that the current code seems to work on a 2012 Server, but not on a Win 7 box.

          I am not an experienced plugin dev, so I might be missing the obvious, but couldn't the plugin start
          with:

          • checking for a CYGWIN_HOME environment variable before it starts messing around in the registry?
          • just trying the path, as it might actually be set up just fine?

          This Env var might not be set by default by the cygwin installation, but it is easy to set and control, either directly on the slave machine or through Jenkins and would also make it much easier to force the use of a specific installed cygwin. (e.g. if you have both cygwin and cygwin64 on the slave).

          Any comments?

          Jan Krag added a comment - It seems, from the above, and reading the provided links, that the current implementation of directly looking up in the SOFTWARE\Wow6432Node\ is not actually a recommended way of doing it, as \Wow6432Node is an implementation detail, and may break compatibility in the future (or past?). Also, in our investigation, we have found that the whole Wow64 registry translation seems extremely fragile, and gives rise to al sorts of confusion, and the mapping is not even the same on different versions of windows. We are currently investigating a situation where two machines seem to behave differently. Both are running 64 bit java (as reported by java -version in Execute shell), and both have only a 64bit Cygwin installed, and referenced in Software\Cygwin\setup [rootdir] . One of them finds cygpath just fine, the other doesn't, and the main difference between these machines is that one is running Win 7, the other Win Server 2012. On both machines we have tried running reg query HKLM\Software\Cygwin\setup /v rootdir /reg:32 — ERROR: The system was unable to find .... reg query HKLM\Software\Cygwin\setup /v rootdir /reg:64 — rootdir REG_SZ c:\cygwin64 If we run reg query HKLM\Software\Cygwin\setup /v rootdir without the view specifier, we get the positive answer, but if we run it in a 32bit command prompt, we get the error. Our temporary conclusion is that the current code seems to work on a 2012 Server, but not on a Win 7 box. I am not an experienced plugin dev, so I might be missing the obvious, but couldn't the plugin start with: checking for a CYGWIN_HOME environment variable before it starts messing around in the registry? just trying the path, as it might actually be set up just fine? This Env var might not be set by default by the cygwin installation, but it is easy to set and control, either directly on the slave machine or through Jenkins and would also make it much easier to force the use of a specific installed cygwin. (e.g. if you have both cygwin and cygwin64 on the slave). Any comments?
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 137402 ] New: JNJira + In-Review [ 185968 ]

            Unassigned Unassigned
            anilarora anilarora
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: