A stderr warning was recently added to redis-cli.c to send out a warning when the password is being used on the command line. See - https://github.com/antirez/redis/commit/c082221aefbb2a472c7193dbdbb90900256ce1a2 & https://github.com/antirez/redis/commit/ef931ef93e909b4f504e8c6fbed350ed70c1c67c

Redis, historically never wrote to stderr unless in the case of actual errors and this warning is breaking any command line scripts that relied on this behavior.

While it can be argued that adding a warning message to stderr is still correct, this forces people to write workarounds this error message - one will have to parse this error message - either ignore it or percolate it up, in case of genuine errors.

There should be a way to either shut this message up OR a mechanism to provide a password in a script when using redis-cli non-interactively. OR at least don't keep changing the error message string so that folks can hard code to look for this error in their scripts.

Comment From: oranagra

i'd suggest to look up an environment variable.

         } else if (!strcmp(argv[i],"-n") && !lastarg) {
             config.dbnum = atoi(argv[++i]);
         } else if (!strcmp(argv[i],"-a") && !lastarg) {
-            fputs("Warning: Using a password with '-a' option on the command line interface may not be safe.\n", stderr);
+            if (!getenv("NO_AUTH_WARNING"))
+                fputs("Warning: Using a password with '-a' option on the command line interface may not be safe.\n", stderr);
             config.auth = argv[++i];
         } else if (!strcmp(argv[i],"-u") && !lastarg) {
             parseRedisUri(argv[++i]);

Comment From: vaibhaw-

Yeah, an env variable or a new redi-cli switch or an option to provide a password file. Whatever folks think works best in the Redis context.

Aside - Don't think the env variables are really used for Redis configuration today - might be a philosophical thing.

Comment From: 0xtonyxia

@vaibhaw- Sorry, I didn't think of this affect. I have submitted a PR #5076 to fix this.

@oranagra I think using a redis-cli switch is better. Because you don't need to read the code or look for some documentation(if exists) to know how to disable the warning message, just use redis-cli -h, which is a more common operation when people have usage problems.

Comment From: antirez

Thanks @0xtonyxia. Just commented on a commit, waiting for the reply then merging.

Comment From: 0xtonyxia

@antirez Thanks for the comment. A new fix commit was pushed, plz check.

Comment From: 0xtonyxia

@vaibhaw- PR was merged. You can test the new option --no-auth-warning now on unstable branch. If you have any problem, plz ping me. Thanks.

Comment From: vaibhaw-

@0xtonyxia Certainly! Thank you! 💯

Comment From: yoav-steinberg

Resolved in #5076. Closing.