Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Using strings of different lengths with tr is unspecified.
[simgrid.git] / src / smpi / smpirun.in
index 805bfb3..2f38ee6 100755 (executable)
@@ -52,6 +52,7 @@ fi
 
 EXTOPT=""
 WRAPPER=""
+HOSTFILE=""
 
 while true; do
   case "$1" in
@@ -273,14 +274,14 @@ APPLICATIONHEAD
 
 ##---- cache hostnames of hostfile---------------
 if [ -n "${HOSTFILE}" ] && [ -f ${HOSTFILE} ]; then
-  hostnames=$(cat ${HOSTFILE} | tr \\\n " ")
+  hostnames=$(cat ${HOSTFILE} | tr '\n\r' '  ')
   NUMHOSTS=$(cat ${HOSTFILE} | wc -l)
 fi
 
 if [ "${EXTOPT}" = "smpi_replay" ]; then
   APP_TRACES=$PROC_ARGS
   if [ -n "${APP_TRACES}" ] && [ -f "${APP_TRACES}" ]; then
-     hosttraces=$(cat ${APP_TRACES} | tr \\\n " ")
+     hosttraces=$(cat ${APP_TRACES} | tr '\n\r' '  ' )
      NUMTRACES=$(cat ${APP_TRACES} | wc -l)
   else
      printf "File not found: %s\n", "${APP_TRACES:-\${APP_TRACES\}}" >&2