Hi all,

It's entirely possible I'm doing something wrong, but it appears that redis-cli's --pipe option doesn't respect empty strings.

Running the command HSET keyname fieldname "" in redis-cli as well as any other client lib that I'm aware properly sets that field to an empty string.

However if you put that command into a file and cat file.txt | redis-cli --pipe it yields ERR wrong number of arguments for 'hset' command.

This was reproduced using "redis:latest" docker image (redis version 3.2.8).

Comment From: straticsryan

Just to confirm, I also reproduced this issue outside of docker with 3.2.8 as well.

Comment From: badboy

It works if you create the proper binary-safe protocol for Redis. See the "Generating Redis Protocol" section in https://redis.io/topics/mass-insert

Comment From: straticsryan

Okay, thanks. It looks like I may have to resort to that.

What does your finding do to the status of this issue? Do you still consider this a bug? Or is this deemed not a bug because it works using the binary-safe protocol?

Comment From: straticsryan

fyi, running redis-cli HSET keyname filename "" works as well. It appears to only be an issue with pipe-mode.

Comment From: badboy

The intention is to use --pipe with the binary-safe protocol. redis-cli HSET keyname filename "" works, because it is transformed by redis-cli into the proper protocol. When having the bare plain text HSET keyname filename "" passed to redis-cli --pipe, it will be sent as is to the server and the server treats it as the old plaintext inline protocol, where empty quoted parts are treated as non-existent.

Comment From: straticsryan

If --pipe was solely intended to be used with the binary protocol, then I'd recommend not suggesting and giving an example of cat data.txt | redis-cli --pipe in the "Use the protocol, Luke" section just above the "Generating Redis Protocol" section you mentioned.

Comment From: badboy

It does work with the inline protocol, with all the limitations the inline protocol has.

Comment From: momotaro98

Hi, I'm getting same issue with redis version 5.0.7 like followings.

$ echo 'HSET 002 name ""' > data.txt
$ cat data.txt | redis-cli --pipe
All data transferred. Waiting for the last reply...
ERR wrong number of arguments for 'hset' command
Last reply received from server.
errors: 1, replies: 1

Comment From: itamarhaber

Hello @momotaro98

This issue has been in Redis since forever. It had been fixed via 0f28ea1 and should be in the next versions.

Similarly: https://github.com/antirez/redis/issues/6881