• Bug#1100030: why adduser in preinst?

    From Marc Haber@21:1/5 to All on Mon Mar 10 14:40:01 2025
    Package: jabberd2
    Version: 2.7.0-7
    Severity: minor

    Hi,

    I am the main maintainer of adduser and am always interested in usage
    patterns of my software. jabberd2 is one of the _very_ few (<5) packages
    in Debian that use adduser in their preinst.

    Since this might interfere with adduser's development (preinst might and probably will run with an un-updated adduser during upgrades), I would
    like to know why it was decided in jabberd2 to create the user in
    preinst.

    If there is no real reason, I'd love the usage of adduser being moved
    too postinst like hundreds of other packages do it.

    In addition, in trixie, the scaffolding you're using around your adduser
    calls is no longer necessary.

    A single call of
    adduser --system --group --home=/var/lib/jabberd2 --no-create-home jabber
    will already do it.

    Greetings
    Marc

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Josefsson@21:1/5 to Marc Haber on Tue Mar 11 08:40:02 2025
    Marc Haber <mh+debian-packages@zugschlus.de> writes:

    Package: jabberd2
    Version: 2.7.0-7
    Severity: minor

    Hi,

    I am the main maintainer of adduser and am always interested in usage patterns of my software. jabberd2 is one of the _very_ few (<5) packages
    in Debian that use adduser in their preinst.

    Since this might interfere with adduser's development (preinst might and probably will run with an un-updated adduser during upgrades), I would
    like to know why it was decided in jabberd2 to create the user in
    preinst.

    If there is no real reason, I'd love the usage of adduser being moved
    too postinst like hundreds of other packages do it.

    In addition, in trixie, the scaffolding you're using around your adduser calls is no longer necessary.

    A single call of
    adduser --system --group --home=/var/lib/jabberd2 --no-create-home jabber will already do it.

    Thanks -- I suspect the actual reason may be lost in time. What is the
    exact patch you are thinking of, is it the one below? I'm happy to
    apply it and see of Salsa is happy and then upload and see if we get any reports.

    /Simon

    diff --git a/debian/postinst b/debian/postinst
    index aa845ab..4ed42c5 100644
    --- a/debian/postinst
    +++ b/debian/postinst
    @@ -21,6 +21,17 @@ case "$1" in
    ;;
    esac

    +if ! getent group | grep -q "^jabber:"
    +then
    + addgroup --system jabber
    +fi
    +
    +if ! getent passwd | grep -q "^jabber:"
    +then
    + adduser --system --home /var/lib/jabberd2 --no-create-home \
    + --quiet --disabled-password --ingroup jabber jabber
    +fi
    +
    #DEBHELPER#

    exit 0
    diff --git a/debian/preinst b/debian/preinst
    index abc46e1..4843a2d 100644
    --- a/debian/preinst
    +++ b/debian/preinst
    @@ -35,17 +35,6 @@ case "$1" in
    ;;
    esac

    -if ! getent group | grep -q "^jabber:"
    -then
    - addgroup --system jabber
    -fi
    -
    -if ! getent passwd | grep -q "^jabber:"
    -then
    - adduser --system --home /var/lib/jabberd2 --no-create-home \
    - --quiet --disabled-password --ingroup jabber jabber
    -fi
    -
    #DEBHELPER#

    exit 0

    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iQNoBAEWCAMQFiEEo8ychwudMQq61M8vUXIrCP5HRaIFAmfP55YUHHNpbW9uQGp
  • From Marc Haber@21:1/5 to Simon Josefsson on Tue Mar 11 12:20:01 2025
    Hi Simon,

    On Tue, Mar 11, 2025 at 08:34:46AM +0100, Simon Josefsson wrote:
    A single call of
    adduser --system --group --home=/var/lib/jabberd2 --no-create-home jabber
    will already do it.

    Thanks -- I suspect the actual reason may be lost in time. What is the
    exact patch you are thinking of, is it the one below? I'm happy to
    apply it and see of Salsa is happy and then upload and see if we get any >reports.

    Actually, just doing
    adduser --system --group --home=/var/lib/jabberd2 --no-create-home jabber
    in postinst without any scaffolding SHOULD give you what you want. If it doesn't, it's a bug in adduser which I would ask you to report.

    If you apply this for trixie, you might need a versioned dependency on
    adduser >= 3.145 or test with bookworm's adduser as well (it might be non-silent on the console but should yield the same results).

    Greetings
    Marc

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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)