[pkg-fetchmail-maint] Bug in postinst

Loïc Minier lool+alioth at via.ecp.fr
Mon Nov 14 16:01:27 UTC 2005


On Mon, Nov 14, 2005, Héctor García wrote:
> While building next release and testing it I found a bug on
> fetchmail.postinst

 Thanks for spotting this.  The fetchmail maintainers did a BAD job at
 merging the patch I proposed in Debian bug #321272.

 I disagree with your fix, it makes things overly complicated, the code
 I proposed was:
    if ! getent passwd fetchmail >/dev/null; then
            adduser --quiet --system --no-create-home --home /var/run/fetchmail fetchmail
    fi
    if ! [ -d /var/run/fetchmail ]; then
        mkdir -p /var/run/fetchmail
        chmod 700 /var/run/fetchmail
        chown -h -R fetchmail:nogroup /var/run/fetchmail
    fi

 The code actually in SVN is:
    # Create fetchmail user and its homedir if we may need it
    if ! getent passwd fetchmail >/dev/null; then
            adduser --system --ingroup nogroup --home /var/run/fetchmail \
            --shell /bin/sh --disabled-password fetchmail
    fi
    # work around possible adduser bug, see #119366
    [ -d /var/run/fetchmail ] || mkdir -p /var/run/fetchmail
    if ! [ -d /var/run/fetchmail ]; then
            chmod 700 /var/run/fetchmail
            chown -h -R fetchmail:nogroup /var/run/fetchmail
    fi

 1/ for new installations, the home dir creation has been moved back to
 adduser, and hence the "if ! [ -d /var/run/fetchmail ]" part will never
 run in the SVN version of the postinst

 2/ for the same reason, "[ -d /var/run/fetchmail ] || " is a no-op for
 new installations

 3/ even for systems where "fetchmail" already is an user, the "[ -d
 /var/run/fetchmail ] || mkdir -p /var/run/fetchmail" snipset will
 ALWAYS create a directory and "if ! [ -d /var/run/fetchmail ];" will
 ALWAYS fail.


 That sucks, not only did I spend an infinite amount of time to
 understand the borkeness of the various versions of your postinsts, but
 my patch was taken and completely corrupted.


 Please take patches seriously and test your scripts.

 Now *please*, keep the adduser part as it is and replace this part:
    # work around possible adduser bug, see #119366
    [ -d /var/run/fetchmail ] || mkdir -p /var/run/fetchmail
    if ! [ -d /var/run/fetchmail ]; then
            chmod 700 /var/run/fetchmail
            chown -h -R fetchmail:nogroup /var/run/fetchmail
    fi

 with:
    if ! [ -d /var/run/fetchmail ]; then
        mkdir -p /var/run/fetchmail
    fi
    chmod 700 /var/run/fetchmail
    chown -h -R fetchmail:nogroup /var/run/fetchmail

-- 
Loïc Minier <lool at dooz.org>
"What do we want? BRAINS!    When do we want it? BRAINS!"



More information about the pkg-fetchmail-maint mailing list