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 with space in non-interactive mode #305

Closed
vvysotskyi opened this issue May 30, 2019 · 7 comments
Closed

Unable to submit password with space in non-interactive mode #305

vvysotskyi opened this issue May 30, 2019 · 7 comments

Comments

@vvysotskyi
Copy link
Contributor

There is no way for specifying a password which contains space in non-interactive mode.
For example, without escaping, it is expected that it wouldn't work:

sqlline -u "jdbc:drill:zk=localhost:5181" -n user1 -p se cret

but it would be good to add a way for escaping the password:

sqlline -u "jdbc:drill:zk=localhost:5181" -n user1 -p "se cret"
sqlline -u "jdbc:drill:zk=localhost:5181" -n user1 -p 'se cret'

Please note that password may be specified using env variable, so this use case may be more common.

As a side note, tools like sshpass allow these both variants of quoting the password.

@snuyanzin
Copy link
Collaborator

I think it relates not only to password but also user names, nicknames (for connections) and perhaps filenames for -log

@vvysotskyi
Copy link
Contributor Author

vvysotskyi commented May 31, 2019

@snuyanzin, thanks for looking into this issue. Except quoting, is it possible to allow escaping some symbols, for example, allow also such cases: se\ cret, se\'cret, se\"cret, se\'\"cret?

@snuyanzin
Copy link
Collaborator

snuyanzin commented May 31, 2019

Current PR allows escaping of spaces like se\ cret but not quotes.
So sqlline can handle lines like

sqlline -u "jdbc:drill:zk=localhost:5181" -n user1 -p se\ cret
sqlline -u "jdbc:drill:zk=localhost:5181" -n user1 -p 'se cret'

In case there should be quote the other quotes could be used e.g.

sqlline -u "jdbc:drill:zk=localhost:5181" -n user1 -p 'se"cret'
sqlline -u "jdbc:drill:zk=localhost:5181" -n user1 -p "se'cret"

The only issue could be if there is a need to have different types of quotes in a word.
Need to have a closer look if it's possible to support different quotes in a word

@julianhyde
Copy link
Owner

As we support more kinds of quoting people will be confused as to the semantics. I think it's time to state for the record that our goal is to be compatible with posix bash. (Single quotes, double quotes, back-slashes. Not back-quotes, braces, dollars etc.)

@snuyanzin
Copy link
Collaborator

snuyanzin commented Jun 4, 2019

Agree about posix for double quotes, back-slashes.
However do not understand what you mean for posix for single quotes.
As far as I know it is not allowed to have single quotes inside between single quotes even following backslash.
Do you mean something like this

'sec"'\''ret'

which should be equivalent to

"sec\"'ret"

?

@snuyanzin
Copy link
Collaborator

Currently added posix compatibility for double quotes and back-slashes

@vvysotskyi
Copy link
Contributor Author

Fixed in cc37485. Thanks for working on this!

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

Successfully merging a pull request may close this issue.

3 participants