adoroszlai commented on code in PR #5379:
URL: https://github.com/apache/ozone/pull/5379#discussion_r1345392157
##########
hadoop-ozone/dist/src/main/compose/ozone/run.sh:
##########
@@ -21,7 +21,7 @@ ORIG_DATANODES="${OZONE_DATANODES:-}"
ORIG_REPLICATION_FACTOR="${OZONE_REPLICATION_FACTOR:-}"
# only support replication factor of 1 or 3
-if [[ -v OZONE_REPLICATION_FACTOR ]] && [[ ${OZONE_REPLICATION_FACTOR} -ne 1
]] && [[ ${OZONE_REPLICATION_FACTOR} -ne 3 ]]; then
+if [[ -n OZONE_REPLICATION_FACTOR ]] && [[ ${OZONE_REPLICATION_FACTOR} -ne 1
]] && [[ ${OZONE_REPLICATION_FACTOR} -ne 3 ]]; then
Review Comment:
```
-n string
True if the length of string is non-zero.
-v varname
True if the shell variable varname is set (has been assigned a
value).
```
https://www.gnu.org/software/bash/manual/bash.html#Bash-Conditional-Expressions
So `-v` applies to a variable name, but `-n` expects a value.
`-n OZONE_REPLICATION_FACTOR` is always true, since this is a non-empty
string. We should check `-n ${OZONE_REPLICATION_FACTOR:-}`, which is the value
of the variable, or "" if the variable is not defined.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]