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

etcdctl v3 txn value does not honor %q formatting #6315

Closed
chajath opened this issue Aug 31, 2016 · 4 comments
Closed

etcdctl v3 txn value does not honor %q formatting #6315

chajath opened this issue Aug 31, 2016 · 4 comments
Labels
Milestone

Comments

@chajath
Copy link

chajath commented Aug 31, 2016

etcdctl txn key and value specs are given as:

<KEY> ::= (%q formatted string)
<VALUE> ::= (%q formatted string)

To me, it is not clear what (%q formatted string) exactly mean here. Running the very example given, i.e.

./etcdctl txn <<<'mod("key1") > "0"

put key1 "overwrote-key1"

put key1 "created-key1"
put key2 "some extra key"

'
FAILURE

OK

OK

When I do etcdctl get key1 afterwards I get "created-key1" as a value with quotes intact. Shouldn't the value be created-key1 without the enclosing quotes? Also, it does not seem to honor other standard %q formatting such as \ space escaping.

@heyitsanthony
Copy link
Contributor

The %q formatted strings are only for the <CMP>* part of the txn. Get/Put/Del are derived from the etcdctl get/put/delete command syntax. This is given in the grammar given from the etcdctl documentation: <OP> ::= ((see put, get, del etcdctl command syntax)) "\n".

@chajath
Copy link
Author

chajath commented Aug 31, 2016

Ok I might have misunderstood the spec. But it looks like there is no easy way of escaping special characters or including whitespaces without putting quotes around, and when I do put the quotes around the quotes themselves are saved verbatim. Any recommendation around putting values that has spaces in it without putting quotes around?

@heyitsanthony
Copy link
Contributor

Tried it out and even the plain quote handling seems broken. It should probably behave like %q if quotes are given. Will fix and add better testing around it. Thanks for reporting this!

@heyitsanthony heyitsanthony added this to the v3.1.0 milestone Aug 31, 2016
@heyitsanthony heyitsanthony self-assigned this Aug 31, 2016
@chajath
Copy link
Author

chajath commented Aug 31, 2016

Thanks for looking into this. The only workaround I can think of is to enter stdin mode and supply ^D at the end of the value. So I'd very much like the %q string support, please :)

heyitsanthony pushed a commit to heyitsanthony/etcd that referenced this issue Sep 1, 2016
heyitsanthony pushed a commit to heyitsanthony/etcd that referenced this issue Sep 1, 2016
heyitsanthony pushed a commit to heyitsanthony/etcd that referenced this issue Sep 2, 2016
gyuho pushed a commit that referenced this issue Sep 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants