libspec: quote '%' characters before passing strings to rpm --eval to avoid a segmentation fault error

This commit is contained in:
Silvan Calarco 2011-07-19 16:07:53 +02:00
parent bba8d55549
commit 55df4cbe08

View File

@ -564,7 +564,10 @@ $FUNCNAME: * blank unexpanded and undefined variables beginning by \`?'..."
# i.e. 'rpmvars.solve(%{__install_info} $specfile)' # i.e. 'rpmvars.solve(%{__install_info} $specfile)'
case "$output" in *%*) case "$output" in *%*)
notify.debug "$FUNCNAME: * expanding rpm variables, if any..." notify.debug "$FUNCNAME: * expanding rpm variables, if any..."
# FIXME: hack to prevent a rpm segfault when parsing '%' with --eval
output=$(echo $output | sed "s@\%@\\\%@g;")
output=$(rpm --eval "$output") output=$(rpm --eval "$output")
output=$(echo $output | sed "s@\\\%@%@g;")
notify.debug "$FUNCNAME: output = \`$output'" ;; notify.debug "$FUNCNAME: output = \`$output'" ;;
esac esac