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

roryqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f23f3df [#585] fix: avoid unbound variable errors in 
start-shuffle-server.sh
4f23f3df is described below

commit 4f23f3dfebf3f7c1e3e374df2a534ced0af37ada
Author: Junfan Zhang <[email protected]>
AuthorDate: Thu Mar 9 11:57:37 2023 +0800

    [#585] fix: avoid unbound variable errors in start-shuffle-server.sh
    
    ### What changes were proposed in this pull request?
    
    If unset the var of `MAX_DIRECT_MEMORY_SIZE`, the error of `unbound 
variable` will be thrown when executing the start-shuffle-server.sh
    
    ### Why are the changes needed?
    
    Use the ${xxx:-} to check its existence. refer to : 
https://bnikolic.co.uk/blog/bash-unbound-variable
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Tested in production env
---
 bin/start-shuffle-server.sh | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/bin/start-shuffle-server.sh b/bin/start-shuffle-server.sh
index 829a20db..49206012 100644
--- a/bin/start-shuffle-server.sh
+++ b/bin/start-shuffle-server.sh
@@ -32,16 +32,14 @@ LOG_CONF_FILE="${RSS_CONF_DIR}/log4j.properties"
 LOG_PATH="${RSS_LOG_DIR}/shuffle_server.log"
 OUT_PATH="${RSS_LOG_DIR}/shuffle_server.out"
 
-set +o nounset
-if [ -z "$XMX_SIZE" ]; then
+if [ -z "${XMX_SIZE:-}" ]; then
   echo "No env XMX_SIZE."
   exit 1
 fi
 echo "Shuffle Server JVM XMX size: ${XMX_SIZE}"
-if [ -n "$RSS_IP" ]; then
+if [ -n "${RSS_IP:-}" ]; then
   echo "Shuffle Server RSS_IP: ${RSS_IP}"
 fi
-set -o nounset
 
 MAIN_CLASS="org.apache.uniffle.server.ShuffleServer"
 
@@ -67,7 +65,7 @@ JAVA_LIB_PATH="-Djava.library.path=$HADOOP_HOME/lib/native"
 echo "class path is $CLASSPATH"
 
 MAX_DIRECT_MEMORY_OPTS=""
-if [ -n "$MAX_DIRECT_MEMORY_SIZE" ]; then
+if [ -n "${MAX_DIRECT_MEMORY_SIZE:-}" ]; then
   MAX_DIRECT_MEMORY_OPTS="-XX:MaxDirectMemorySize=$MAX_DIRECT_MEMORY_SIZE"
 fi
 

Reply via email to