]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
gen-cdefs.sh: quote the output from gdb and read
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 19 Dec 2016 11:11:33 +0000 (12:11 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 19 Dec 2016 11:15:34 +0000 (12:15 +0100)
Just in case.

scripts/gen-cdefs.sh

index 4b4b47fbca1656386ad2a4645dd139c4fed9b775..4d7ed079d27e6c526894a640fe95e2fd9836720f 100755 (executable)
@@ -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