Menu

#2703 opensaf_scale_out script could not handle \n as argument

5.18.02
fixed
None
defect
base
samples
minor
False
2018-02-02
2017-11-24
No

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

Related

Wiki: ChangeLog-5.18.02

Discussion

  • Per Rodenvall

    Per Rodenvall - 2017-11-24
    • summary: opensaf_scale_out script could not handle /n as argument --> opensaf_scale_out script could not handle \n as argument
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,5 +1,5 @@
     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.
    +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"
    
    @@ -12,7 +12,7 @@
    
     Modified code:
    
    -# Temporary remove non-printable characters from input argument
    +//# 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)
    
     
  • Hans Nordebäck

    Hans Nordebäck - 2017-11-27
    • status: unassigned --> accepted
    • assigned_to: Hans Nordebäck
     
  • Hans Nordebäck

    Hans Nordebäck - 2017-11-27
    • status: accepted --> review
     
  • Hans Nordebäck

    Hans Nordebäck - 2017-11-28

    the RS regular expression is perhaps clearer if:

    node_name=$(echo "$node" | awk -F "$CLM_IFS" 'BEGIN{RS="^$"} {print $2}')

     
  • Hans Nordebäck

    Hans Nordebäck - 2017-11-29
    • status: review --> fixed
     
  • Hans Nordebäck

    Hans Nordebäck - 2017-11-29

    commit 3c660eef1ad1ca264e1b143151b33378c8f677d2
    Author: Hans Nordeback hans.nordeback@ericsson.com
    Date: Wed Nov 29 14:44:30 2017 +0100

    base: Fix opensaf_scale_out script to handle binary arguments [#2703]
    

    commit 3d753c5847af88107a9321601263fb03cff6170f
    Author: Hans Nordeback hans.nordeback@ericsson.com
    Date: Wed Nov 29 14:44:30 2017 +0100

    base: Fix opensaf_scale_out script to handle binary arguments [#2703]
    
     

Log in to post a comment.