Emacs users thank you for working on this.  To repro, try emacs -q, M-x
shell and run your manual test in there.  You'll see stty -a reports -echo.

This is trickier than I expected, since you have to manage saving/restoring
around each call to readPassword AND have an exit hook to restore in case
the user never gets around to responding to the prompt.

I see in the old code echo returns a boolean that you would think could be
used to restore.  You want to save/restore around each readPassword AND
around the entire java program.  It still seems right to restore after
every readpassword, using the returned value from echo (which the suggested
fix ignores!).  But also, the very first time readPassword is called, you
create an exit hook to restore the value known at that time.  So you need
echo0 as well ... or do you ... maybe you just need to keep track of a
single state variable for you to do first-time setup.

+    return tio.c_lflag & ECHO;

Pedantically, functions returning jboolean should return only JNI_TRUE and
JNI_FALSE.  I would do:

return (tio.c_lflag & ECHO) != 0;

although there's the even more pedantic

return ((tio.c_lflag & ECHO) != 0) ? JNI_TRUE : JNI_FALSE;

typo: chosole




On Fri, Apr 13, 2018 at 2:10 PM, Xueming Shen <xueming.s...@oracle.com>
wrote:

> Hi,
>
> Please help review the change for JDK-8194750.
>
> issue: https://bugs.openjdk.java.net/browse/JDK-8194750
> webrev: http://cr.openjdk.java.net/~sherman/8194750/webrev
>
> *fix has been manually verified. No new auto-regression test added.
>
> Thanks,
> Sherman
>

Reply via email to