From: Vladimír Čunát Date: Mon, 19 Dec 2016 11:11:33 +0000 (+0100) Subject: gen-cdefs.sh: quote the output from gdb and read X-Git-Tag: v1.2.0-rc1~52^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=110359ccc04a1afc8014b977e92a903bd65762cb;p=thirdparty%2Fknot-resolver.git gen-cdefs.sh: quote the output from gdb and read Just in case. --- diff --git a/scripts/gen-cdefs.sh b/scripts/gen-cdefs.sh index 4b4b47fbc..4d7ed079d 100755 --- a/scripts/gen-cdefs.sh +++ b/scripts/gen-cdefs.sh @@ -35,19 +35,19 @@ fi GDB="gdb -n -quiet -batch -symbols=$library" -grep -v '^#\|^$' | while read ident; do +grep -v '^#\|^$' | while read -r ident; do if [ "$2" = functions ]; then - output=$($GDB -iex "set width unlimited" --ex "info functions ^$ident\$" \ - | sed '0,/^All functions/ d; /^File .*:$/ d') + output="$($GDB -iex "set width unlimited" --ex "info functions ^$ident\$" \ + | sed '0,/^All functions/ d; /^File .*:$/ d')" else # types case "$ident" in struct\ *|union\ *|enum\ *) - output=$($GDB -iex "set width unlimited" --ex "ptype $ident" \ - | sed '0,/^type = /s/^type = /\n/; $ s/$/;/') + output="$($GDB -iex "set width unlimited" --ex "ptype $ident" \ + | sed '0,/^type = /s/^type = /\n/; $ s/$/;/')" ;; *) - output=$($GDB -iex "set width unlimited" --ex "info types ^$ident\$" \ - | sed -e '0,/^File .*:$/ d' -e '/^File .*:$/,$ d') + output="$($GDB -iex "set width unlimited" --ex "info types ^$ident\$" \ + | sed -e '0,/^File .*:$/ d' -e '/^File .*:$/,$ d')" # we need to stop early to remove ^^ multiple matches ;; esac