Bug#361956: [Pkg-nagios-devel] Bug#361956: nagios2-common: postinstall script uses unconditional chmod/chown, breaking any dpkg-statoverride

Marc Haber mh+debian-packages at zugschlus.de
Tue Apr 11 14:16:53 UTC 2006


On Tue, Apr 11, 2006 at 02:35:09PM +0200, Heiko Schlittermann wrote:
> As stated in the subject -- the postinstall uses unconditionally
> chmod/chown.  If the local admin tries to change permissions using
> dpkg-statoverride, these local changes are not respected.
> +# useful functions
> +setperm() {
> +    local user="$1"; shift
> +    local group="$1"; shift
> +    local mode="$1"; shift
> +    local file="$1"; shift
> +    dpkg-statoverride --list "$file" >/dev/null && return 0
> +    dpkg-statoverride --update --add "$user" "$group" "$mode" "$file"
> +}

The maintainer script adding the statoverride does not seem to be
policy compliant to me. We are not to touch the dpkg-statoverride
database.

For exim4, we have solved this with the following code:

        # honor dpkg-statoverride settings for files not managed with dpkg
        for pat in /var/\*/exim4 /var/\*/exim4/\*; do
                [ $EX4DEBUG ] && eval echo "evaluate statoverride $pat"
                eval dpkg-statoverride --list $pat | while read USER GROUP MODE FILE; do
                        [ $EX4DEBUG ] && echo "statoverride $USER $GROUP $MODE $FILE"
                        chown ${USER}:${GROUP} $FILE
                        chmod $MODE $FILE
                done
        done

I don't particularly like the way this is implemented, though. Comments?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835




More information about the Pkg-nagios-devel mailing list