Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6363043

Console will not return to original state when the process is killed with Ctrl+C (sol)

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b75
    • CPU:
      sparc
    • OS:
      solaris
    • Verification:
      Verified

      Description

      Console continueous to be in invisible mode if we kill the process by pressing Ctrl C, when Console.readPassword() prompts for reading password. This bug is solaris specific, it can not be reproduced in Linux and Windows platforms.

      Tested In SunOS RELEASE: 5.10
      Steps To Reproduce:
        1) Execute the following program
        2) Press Ctrl+C when the program prompts for Password:
        3) Now if you type any character it will not be displayed on the console.
       
      <version>
      bash-3.00$ java -version
      java version "1.6.0-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b63)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b63, mixed mode)
      </version>

      <code>
      import java.io.Console;
      class TestConsole {
         public static void main(String ... args){
            Console con = System.console();
            if (con != null)
              con.printf(new String(con.readPassword("%s","Password:")));
        }
      }
      </code>

      <Result>
      Password:(Press Ctrl+C To reproduce this bug.)
      </Result>
      ----------------------------------------------
      This is another scenario in Linux platform, which prints the characters typed in echo off mode if the process
      (which is waiting to receive password) is killed. Please follow the steps to reproduce.

      Steps To Reproduce:
         1) Execute the TestConsole program(which is given above as part of code) in Linux.
         2) Type some characters "abcdef" ,when it prompts for password, and dont press Enter key.
         3) Open another terminal, and kill the process which is executing the TestConsole.
         4) Now we can see the characters "abcedf" which are entered in echo off mode are printed on command line.

      <Result>
      [rg157576@jlab203 ~/Rajendra]$ echo $zava
      /net/sqindia/export/disk09/jdk/1.6.0/latest/binaries/linux-i586/bin/java
      [rg157576@jlab203 ~/Rajendra]$ $zava TestConsole
      Password:(typed 'abcdef' here)

      opened other terminal
      [rg157576@jlab203 ~/Rajendra]$ ps -al
      F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
      0 S 158576 27052 32118 0 80 0 - 45780 schedu pts/12 00:00:00 java
      0 R 158576 27067 24500 0 81 0 - 854 - pts/13 00:00:00 ps
      [rg157576@jlab203 ~/Rajendra]$ kill -9 27052

      The result in previous terminal.
      Password:Killed
      [rg157576@jlab203 ~/Rajendra]$ abcdef

      Here the characters 'abcdef' which are typed in echo off mode are printed on command line.
      </Result>

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sherman Xueming Shen
              Reporter:
              rgutupalsunw Rajendra Gutupalli (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: