Harmony
  1. Harmony
  2. HARMONY-6631

[jdktools][keytool] All interactive input is truncated by one character on linux

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0M3, 5.0M15
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux
    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Novice

      Description

      On linux, running the keytool so that it prompts for a password and entering a 6 character password will reprompt with the message "The password must be at least 6 characters". Similarly any other interactive input is truncated by a character.
      The problem is that is assumes the newline terminator is 2 characters, which it is on windows, but not on other platforms.

      The problem can be recreated by running:
      target/hdk/jdk/jre/bin/keytool -genkey

      Enter keystore password: 12345
      The password must be at least 6 characters

      Also this password length checking is not performed when running the tool non-interactively, e.g. running
      target/hdk/jdk/jre/bin/keytool -genkey -keypass 1234 -storepass 1234
      doesn't throw any password length errors

      1. 6631.patch
        4 kB
        Catherine Hope

        Activity

        Catherine Hope made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Catherine Hope added a comment -

        Verified

        Show
        Catherine Hope added a comment - Verified
        Hide
        Hudson added a comment -

        Integrated in Harmony-select-1.5-head-linux-x86_64 #100 (See https://hudson.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/100/)
        Commit slightly modified patch for HARMONY-6631 ([jdktools][keytool] All interactive input is truncated by one character on linux).

        Show
        Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #100 (See https://hudson.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/100/ ) Commit slightly modified patch for HARMONY-6631 ( [jdktools] [keytool] All interactive input is truncated by one character on linux).
        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #939 (See https://hudson.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/939/)
        Commit slightly modified patch for HARMONY-6631 ([jdktools][keytool] All interactive input is truncated by one character on linux).

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #939 (See https://hudson.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/939/ ) Commit slightly modified patch for HARMONY-6631 ( [jdktools] [keytool] All interactive input is truncated by one character on linux).
        Oliver Deakin made changes -
        Fix Version/s 5.0M15 [ 12315054 ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 6.0M3 [ 12315055 ]
        Hide
        Oliver Deakin added a comment -

        Thanks Cath - I applied the patch at repo revision r988045 with a couple of modifications:

        • I removed the usage of SystemUtils.getOS() and replaced it with a check on the File.separator char. I did this to avoid the need to add a new dependency on the misc module from jretools (File is already used). Please let me know if you are not happy with this change and we can discuss it.
        • I applied the fixes to ArgumentsParser in both the jretools and jdktools modules since the code is duplicated in both places at the moment. I thought it better to make sure they don't get out of sync.

        Please check that the patches were applied as expected, that the issue is fixed for you and that you agree with the above modifications.

        Show
        Oliver Deakin added a comment - Thanks Cath - I applied the patch at repo revision r988045 with a couple of modifications: I removed the usage of SystemUtils.getOS() and replaced it with a check on the File.separator char. I did this to avoid the need to add a new dependency on the misc module from jretools (File is already used). Please let me know if you are not happy with this change and we can discuss it. I applied the fixes to ArgumentsParser in both the jretools and jdktools modules since the code is duplicated in both places at the moment. I thought it better to make sure they don't get out of sync. Please check that the patches were applied as expected, that the issue is fixed for you and that you agree with the above modifications.
        Oliver Deakin made changes -
        Assignee Oliver Deakin [ odeakin ]
        Catherine Hope made changes -
        Field Original Value New Value
        Attachment 6631.patch [ 12452623 ]
        Hide
        Catherine Hope added a comment -

        Patch includes fix for linux interactive problem, but no testcase. The problem can be recreated (and checked that the patch works by running the following):
        target/hdk/jdk/jre/bin/keytool -genkey -keystore mystore -keyalg RSA
        >Enter keystore password: 123456

        This should fail without the patch
        With the patch, you should be able to enter the requested information and generated the keystore

        Patch also includes fix for password lengths check non-interactively and a testcase

        Show
        Catherine Hope added a comment - Patch includes fix for linux interactive problem, but no testcase. The problem can be recreated (and checked that the patch works by running the following): target/hdk/jdk/jre/bin/keytool -genkey -keystore mystore -keyalg RSA >Enter keystore password: 123456 This should fail without the patch With the patch, you should be able to enter the requested information and generated the keystore Patch also includes fix for password lengths check non-interactively and a testcase
        Catherine Hope created issue -

          People

          • Assignee:
            Oliver Deakin
            Reporter:
            Catherine Hope
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development