Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to submit password if it wasn't specified in connection string #276

Closed
vvysotskyi opened this issue Mar 20, 2019 · 7 comments
Closed

Comments

@vvysotskyi
Copy link
Contributor

vvysotskyi commented Mar 20, 2019

For the case when only URL and username are specified in the connection string, it is impossible to submit a password in the next line:

sqlline> !connect jdbc:drill:zk=localhost user1
Enter password for jdbc:drill:zk=localhost: ***********************

When the password is entered, Enter/Return key gets appended to the password.
Stack trace after terminating:

Enter password for jdbc:drill:zk=localhost: ***********************
org.jline.reader.UserInterruptException
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:617)
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:443)
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:416)
        at sqlline.Commands.connect(Commands.java:1239)
        at sqlline.Commands.connect(Commands.java:1139)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
        at sqlline.SqlLine.dispatch(SqlLine.java:722)
        at sqlline.SqlLine.begin(SqlLine.java:540)
        at sqlline.SqlLine.start(SqlLine.java:264)
        at sqlline.SqlLine.main(SqlLine.java:195)

This issue is reproduced on Linux, not sure about other OS.

Also, Home’ key on Windows does not move the cursor to the beginning of the line in sqlline session. I guess somehow the key mapping is missing or wrong. Not only the ‘Return/Enter' key and the ‘Home’ key.

@masayuki038
Copy link
Contributor

Same on Windows.

@arina-ielchiieva
Copy link
Collaborator

arina-ielchiieva commented Mar 21, 2019

@snuyanzin do you think this is jline related?

@snuyanzin
Copy link
Collaborator

It could be solved on any side.
The issue is that jline3 uses org.jline.reader.impl.SimpleMaskingCallback which transforms any symbols to mask symbol (including end of line). I do not know if it is correct behavior or not from jline3's side.
At the same time it is possible to specify a custom MaskingCallback.
There is my draft version https://github.com/snuyanzin/sqlline/tree/SQLLINE_276_DRAFT.
I checked manually the case above and it looks working.
Unfortunately I do not have time for junit tests and beautifing the solution... may be by the end of the week or the month.
Anyway feel free to continue if you have time.

@arina-ielchiieva
Copy link
Collaborator

I think it's better to implement on SqlLine side since making change in JLine might take long.
One thing that I would really hope that this fix is included into release.
@julianhyde hope @snuyanzin timeline for the fix is acceptable.

@julianhyde
Copy link
Owner

@snuyanzin Your draft looks good - I'll fix it up a little and commit. I'd like to start a release vote today or tomorrow.

Can you please create a PR, so we have your permission to contribute.

And, thank you for moving so fast on this. I know it is hard to fine time to work on open source when there are $dayjob commitments.

@snuyanzin
Copy link
Collaborator

Thanks for merging!
I added a PR with a test

@julianhyde
Copy link
Owner

Fixed as 714544e, with test case d79e942 (PR #280). Thanks, @snuyanzin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants