- **status**: accepted --> review


---

** [tickets:#2703] opensaf_scale_out script could not handle \n as argument**

**Status:** review
**Milestone:** 5.18.01
**Created:** Fri Nov 24, 2017 11:46 AM UTC by Per Rodenvall
**Last Updated:** Mon Nov 27, 2017 10:52 AM UTC
**Owner:** Hans Nordebäck


The problem is the fourth script argument that is the optional user data field.
That field could contain a 254-long string that could include none printable 
characters as \n.

In the sample code below the script is just interested in the node name that is 
the second argument. That could not contain any non-printable characters. 
Therefore none printable characters could be removed for this loop with "tr"

Original code:

for node in "$@"; do
    node_name=$(echo "$node" | cut -d"$CLM_IFS" -f2)
    echo "$node_name" >> "$nodes_cfg_tmp"
done

Modified code:

//# Temporary remove non-printable characters from input argument
arg_without_newline=$(printf "%s" "$@" | tr -cd '[:print:]')
for node in "$arg_without_newline"; do
        node_name=$(echo "$node" | cut -d"$CLM_IFS" -f2)
        echo "$node_name" >> "$nodes_cfg_tmp" 
done


---

Sent from sourceforge.net because opensaf-tickets@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-tickets mailing list
Opensaf-tickets@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to