libspec: provide a better workaround for rpm segfaults when evaluating urls with '%' characters

This commit is contained in:
Silvan Calarco 2011-09-24 18:43:02 +02:00
parent 55df4cbe08
commit fa9b236d17

View File

@ -564,10 +564,12 @@ $FUNCNAME: * blank unexpanded and undefined variables beginning by \`?'..."
# i.e. 'rpmvars.solve(%{__install_info} $specfile)'
case "$output" in *%*)
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=$(echo $output | sed "s@\\\%@%@g;")
# hack to prevent a rpm segfault when evaluating urls containing '%' (e.g. python-pyslsk)
output_prefix=`echo ${output} | sed "s|\(^[a-z]://\)|\1|"`
output_suffix=${output/$output_prefix}
notify.debug "$FUNCNAME: rpm --eval \"${output_suffix}\""
output=$(rpm --eval "${output_suffix}")
output="${output_prefix}${output}"
notify.debug "$FUNCNAME: output = \`$output'" ;;
esac