Github messages for voidlinux
 help / color / mirror / Atom feed
From: ahesford <ahesford@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: xbps-triggers:system-accounts: use grep to check for user/group existent
Date: Thu, 10 Sep 2020 15:48:34 +0200	[thread overview]
Message-ID: <20200910134834.DlQCWvHw879invoU5euU9PZ8gO-iXCpxn2V6WirIUYs@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-24754@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/24754#issuecomment-690300970

Comment:
The more I look at this, the more I see breakage when populating an alternate root. Won't `useradd`, `usermod` and `groupadd` always act on the system root? These commands provide a `--root` option that seems to redirect their actions in the way we want, but we aren't using that option now. It's also not clear from their man pages how well these commands get along with directory services.

Ignoring `system-accounts` unless `$ROOTDIR = /` like @ericonr suggests is a reasonable way to avoid the worst of these issues. If you go that route, the hook should at least print all of the users and groups that should exist (along with ID numbers, if provided) for the package to function as expected.

If we really want to do this the "right" way, it's not obvious to me that the existence tests add value. For groups, just `groupadd --root ...` and catch the return code to know the difference between a real failure and an attempt to create a group that already exists. For users, just `useradd --root ...` and, if the return code indicates that the username already exists, try `usermod --root ...` instead.

  parent reply	other threads:[~2020-09-10 13:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08  0:40 [PR PATCH] " sgn
2020-09-08  1:29 ` ericonr
2020-09-08 12:04 ` sgn
2020-09-09  1:07 ` [PR PATCH] [Updated] " sgn
2020-09-09 14:04 ` sgn
2020-09-10  0:37 ` ahesford
2020-09-10  0:57 ` sgn
2020-09-10  1:03 ` [PR PATCH] [Updated] " sgn
2020-09-10  1:17 ` ahesford
2020-09-10  6:54 ` the-maldridge
2020-09-10  7:04 ` ericonr
2020-09-10  7:09 ` ericonr
2020-09-10 13:06 ` sgn
2020-09-10 13:48 ` ahesford [this message]
2020-09-10 13:53 ` sgn
2020-09-10 13:57 ` ericonr
2020-09-10 14:01 ` sgn
2020-09-10 14:01 ` [PR PATCH] [Closed]: " sgn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200910134834.DlQCWvHw879invoU5euU9PZ8gO-iXCpxn2V6WirIUYs@z \
    --to=ahesford@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).