From fa9b236d17e0be4391209a5cdc8a340e35eb7db7 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 24 Sep 2011 18:43:02 +0200 Subject: [PATCH] libspec: provide a better workaround for rpm segfaults when evaluating urls with '%' characters --- lib/libspec.lib.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/libspec.lib.in b/lib/libspec.lib.in index 5eb1eb4..c2b8e94 100644 --- a/lib/libspec.lib.in +++ b/lib/libspec.lib.in @@ -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