Scala Programming Language
  1. Scala Programming Language
  2. SI-4703

jline on Windows does not check that %TEMP%\jansi.dll is correct for JVM bit model

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.0
    • Fix Version/s: Scala 2.9.3-RC1
    • Component/s: Repl / Interpreter
    • Labels:
    • Environment:

      Windows 7, 64 bits OS.
      32 bits JVM is: Java HotSpot(TM) Client VM, Java 1.6.0_18
      64 bits JVM is: Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_21

      Cywin is:
      $ uname -r -o -s
      CYGWIN_NT-6.1-WOW64 1.7.7(0.230/5/3) Cygwin

      Description

      There are two jansi.dll bundled in jline.jar, one for 32 bits and one for 64 bits. The one being picked up is chosen based on the value of sun.arch.data.model system property (32 or 64). Once unpacked the dll does not get refreshed. The only check that is performed is based on timestamp of jline.jar and jansi.dll. Running first the 32 bits version unpacks the 32 bits dll. When starting the 64 bits JVM, jansi.dll is then incompatible. (or vice versa if starting with 64 bits).

      The bug is really in the hawtjni dependent library used by jline.

      Here is a cygwin session demonstrating the issue:

      $ rm /cygdrive/c/Users/jlh/AppData/Local/Temp/jansi.dll
      
      $ scala
      Welcome to Scala version 2.9.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_21).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala>:quit
      
      $ md5sum /cygdrive/c/Users/jlh/AppData/Local/Temp/jansi.dll
      d47102e00a05c357e91988d56ca7a635 */cygdrive/c/Users/jlh/AppData/Local/Temp/jansi.dll
      
      $ scala32
      Failed to created JLineReader: java.lang.NoClassDefFoundError: Could not initialize class org.fusesource.jansi.internal.Kernel32
      Falling back to SimpleReader.
      Welcome to Scala version 2.9.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_18).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> :quit
      
      $ md5sum /cygdrive/c/Users/jlh/AppData/Local/Temp/jansi.dll
      d47102e00a05c357e91988d56ca7a635 */cygdrive/c/Users/jlh/AppData/Local/Temp/jansi.dll
      
      $ rm /cygdrive/c/Users/jlh/AppData/Local/Temp/jansi.dll
      
      $ scala32
      Welcome to Scala version 2.9.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_18).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> :quit
      
      $ md5sum /cygdrive/c/Users/jlh/AppData/Local/Temp/jansi.dll
      2452a4f2c62c0447948444cfb0f9f428 */cygdrive/c/Users/jlh/AppData/Local/Temp/jansi.dll
      

      For the end user, the work around is to delete the dll del %TEMP%\jansi.dll.

        Activity

        Hide
        huynhjl added a comment -

        I also added an issue in the jansi github project.

        Show
        huynhjl added a comment - I also added an issue in the jansi github project.
        Hide
        Paul Phillips added a comment -

        I can't imagine how long this might have gone undiagnosed without this ticket. Nice job.

        Show
        Paul Phillips added a comment - I can't imagine how long this might have gone undiagnosed without this ticket. Nice job.
        Hide
        Hiram Chirino added a comment -

        Jansi 1.6 has just been released /w the fix.

        Show
        Hiram Chirino added a comment - Jansi 1.6 has just been released /w the fix.
        Hide
        huynhjl added a comment -

        Thank you Hiram.

        Show
        huynhjl added a comment - Thank you Hiram.
        Hide
        Paul Phillips added a comment -

        Can someone tell me if this is fixed since r25109?

        Show
        Paul Phillips added a comment - Can someone tell me if this is fixed since r25109?
        Hide
        huynhjl added a comment -

        Yes, I pulled from github, compiled and tested with build/pack/bin/scala and it's fixed (checked that the dll have the bit model in it and started a few alternate 32/64 bit sessions).

        Show
        huynhjl added a comment - Yes, I pulled from github, compiled and tested with build/pack/bin/scala and it's fixed (checked that the dll have the bit model in it and started a few alternate 32/64 bit sessions).
        Hide
        Paul Phillips added a comment -

        Then, I declare fixed.

        Show
        Paul Phillips added a comment - Then, I declare fixed.
        Hide
        Henning Hoefer added a comment -

        Was r25109 before 2.9.1.final?

        I'm asking, since this doesn't seem to be fixed in 2.9.1.final – if I switch between a 32- and a 64-bit-JDK I always get the "Failed to created JLineReader"...

        Show
        Henning Hoefer added a comment - Was r25109 before 2.9.1.final? I'm asking, since this doesn't seem to be fixed in 2.9.1.final – if I switch between a 32- and a 64-bit-JDK I always get the "Failed to created JLineReader"...
        Hide
        huynhjl added a comment - - edited

        The fix did not make it into 2.9.1. But I do see it in the latest nightly build. I based that on doing dir %TEMP%\jan*. With the fix it creates jansi-32.dll, without it just creates jansi.dll. As a workaround, may be you can add a del %TEMP%\jansi.dll to your scala.bat?

        Show
        huynhjl added a comment - - edited The fix did not make it into 2.9.1. But I do see it in the latest nightly build. I based that on doing dir %TEMP%\jan* . With the fix it creates jansi-32.dll , without it just creates jansi.dll . As a workaround, may be you can add a del %TEMP%\jansi.dll to your scala.bat ?

          People

          • Assignee:
            Paul Phillips
            Reporter:
            huynhjl
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development