Jdesk / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

Increment treats leading spaces as 0 #221

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use the command (second line has a leading space):
set key 0 0 4
 abc

2. use the command:
incr key 10

What is the expected output? What do you see instead?
I expect to see:
CLIENT_ERROR cannot increment or decrement non-numeric value

Instead I see success:
10

What version of the product are you using? On what operating system?
Memcached 1.4.5 on Ubuntu 11.04 x64

Please provide any additional information below.
This problem exists in the binary protocol as well.

Original issue reported on code.google.com by step...@uci.edu on 3 Sep 2011 at 1:48

GoogleCodeExporter commented 9 years ago
set foo 0 0 4
abcd
STORED

ERROR
get foo
VALUE foo 0 4
abcd
END
incr foo 10
CLIENT_ERROR cannot increment or decrement non-numeric value
version
VERSION 1.4.7

sorry, fixed that a while back.

Original comment by dorma...@rydia.net on 3 Sep 2011 at 1:53

GoogleCodeExporter commented 9 years ago
No, I mean you set the value to " abc" where there's a leading space, instead 
of just "abcd". 

Another example:

version
VERSION 1.4.7
set key 0 0 10
         a
STORED
get key
VALUE key 0 10
         a
END
incr key 25    
25
get key
VALUE key 0 10
25        
END

I expect it to fail at incr since "         a" doesn't have any numbers in it. 

Original comment by step...@uci.edu on 3 Sep 2011 at 2:25

GoogleCodeExporter commented 9 years ago
https://github.com/memcached/memcached/commit/51c8f31fc709d06c479de88bdc5e14e757
faabc5

Original comment by trond.no...@gmail.com on 3 Sep 2011 at 3:35