Package: icinga-common
Version: 1.7.1-4
Severity: serious
Tags: patch

icinga-common's postinst has the following construct:

| cp -a -f "$conffile" "$conffile".tmp
| sed -e ... < "$conffile" > "$conffile.tmp"

In my case, $conffile is a symlink:
} lrwxrwxrwx 1 root root 26 Nov  1 15:11 /etc/icinga/icinga.cfg -> 
from-git/static/icinga.cfg

so the postinst does effectively sed < $file > $file, and we all know
that this doesn't work and results in $file being empty at the end.

I propose to use sed's -i instead:

(untested)
--- ./icinga-common.postinst    2012-10-01 06:20:10.000000000 +0000
+++ /root/icinga-common.postinst        2013-01-14 10:57:43.751049610 +0000
@@ -65,25 +65,20 @@
 
                false)
                        check_external_commands=0
                        ;;
        esac
 
-       cp -a -f "$conffile" "$conffile".tmp
-
        # If the admin deleted or commented some variables but then set
        # them via debconf, (re-)add them to the config file.
 
        test -z "$check_external_commands" || \
        grep -Eq '^ *check_external_commands=' "$conffile" || \
        echo "check_external_commands=" >> "$conffile"
 
-       sed -e "s|^ 
*check_external_commands=.*|check_external_commands=$check_external_commands|" \
-       < "$conffile" > "$conffile.tmp"
-
-       mv -f "$conffile".tmp "$conffile"
+       sed -i -e "s|^ 
*check_external_commands=.*|check_external_commands=$check_external_commands|" 
"$conffile"
 
        # Stop a not already stopped icinga instance,
        # debhelper will start it again automatically at the bottom
        status="$(/etc/init.d/icinga status >/dev/null 2>&1; echo $?)"
 
        if [ "$status" -ne 3 ]; then

Cheers,
weasel


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to