This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 909d5878 Fix SCRIPT EXISTS arity (#1567)
909d5878 is described below

commit 909d58788fb8194ae35e4d3a7defeed6add47486
Author: Binbin <[email protected]>
AuthorDate: Mon Jul 10 17:07:57 2023 +0800

    Fix SCRIPT EXISTS arity (#1567)
    
    This is a minor fix, SCRIPT EXISTS requires at least
    three arguments.
    
    Before the change, we can do this:
    
    ```
    127.0.0.1:6666> script exists
    (empty array)
    ```
    
    After: we will return the wrong number of arguments error.
---
 src/commands/cmd_script.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/commands/cmd_script.cc b/src/commands/cmd_script.cc
index 54f115db..a076e2c2 100644
--- a/src/commands/cmd_script.cc
+++ b/src/commands/cmd_script.cc
@@ -79,7 +79,7 @@ class CommandScript : public Commander {
         return s;
       }
       *output = redis::SimpleString("OK");
-    } else if (args_.size() >= 2 && subcommand_ == "exists") {
+    } else if (args_.size() >= 3 && subcommand_ == "exists") {
       *output = redis::MultiLen(args_.size() - 2);
       for (size_t j = 2; j < args_.size(); j++) {
         if (svr->ScriptExists(args_[j]).IsOK()) {

Reply via email to