with the SORT param, the SORT command usually output an integer, indicating the number of items in the stored set, but when output is null, for example, the key to be sorted does not exist (or is empty), the output of SORT with STORE is empty set, not a number anymore! I think it shall be consistent, i.e. without STORE, bulk output (or empty), with STORE, integer output (including 0).
Verified, definitely a bug. There is an additional one I discovered just now looking at the code:
redis 127.0.0.1:6379> flushall
redis 127.0.0.1:6379> lpush foo bar
redis 127.0.0.1:6379> sort foo limit 10 10 store zap
redis 127.0.0.1:6379> keys *
redis 127.0.0.1:6379> llen za
A key with an empty list was just created, that is not coherent with the Redis behavior of deleting keys without elements.
Fixing both, thanks for reporting.
Fixed SORT bugs (issue #224) with regression tests.
Fixed both into unstable and 2.4, thanks.