Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
> There's also the missing case for the `root` user, as the default shell for > UID 0 is defined to be `/bin/sh` and homedir `/root`. Not sure if we need / want a special case for root here. In my head it is the responsibility of the distribution to create the root user (and all other default system users) with the right settings. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#issuecomment-1655214931 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@ffesti commented on this pull request. > + +hasgroup() { + grep "^${1}:" "$ROOT"/etc/group >/dev/null +} + +user() { + local user="$1" + local uid="$2" + local desc="$3" + local group="$4" + local home="$5" + local shell="$6" + + [ "$desc" = '-' ] && desc= + { [ "$home" = '-' ] || [ "$home" = '' ]; } && home=/ + { [ "$shell" = '-' ] || [ "$shell" = '' ]; } && shell=/usr/sbin/nologin Fix in 077afb85925d04067ebd38bfa520cec0e36f5bbf -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#discussion_r1277226676 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
There's also the missing case for the `root` user, as the default shell for UID 0 is defined to be `/bin/sh`. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#issuecomment-1651811249 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@Conan-Kudo commented on this pull request. > + +hasgroup() { + grep "^${1}:" "$ROOT"/etc/group >/dev/null +} + +user() { + local user="$1" + local uid="$2" + local desc="$3" + local group="$4" + local home="$5" + local shell="$6" + + [ "$desc" = '-' ] && desc= + { [ "$home" = '-' ] || [ "$home" = '' ]; } && home=/ + { [ "$shell" = '-' ] || [ "$shell" = '' ]; } && shell=/usr/sbin/nologin This needs to be `/sbin/login`. We cannot assume it's in `/usr`. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#pullrequestreview-1547737657 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
Merged #2573 into master. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#event-9922341090 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@ffesti pushed 1 commit. cd750adc7f7d4be4e1ac173631c07fdb2e5f9757 Replace systemd-sysusers by new sysusers.sh script -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573/files/47a20f64e82eacdf91679a356de038208d487b86..cd750adc7f7d4be4e1ac173631c07fdb2e5f9757 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@dmnks approved this pull request. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#pullrequestreview-1547356492 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
Other than the above, the PR looks sane, nice work! -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#issuecomment-1651444355 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
Now that the script has the `bash` shebang, shouldn't we make use of `local` and declare the function-local variables as such? Currently, they are all redefined on entry and not used outside of the functions, but if we change something in the script in the future and forget about it... -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#issuecomment-1651392225 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@ffesti pushed 1 commit. 36cbc08980d643614e646eb39542aeacf1afdb5e Add --help and description -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573/files/c69b996901e5d62f8d49d72b46dc651115c581a8..36cbc08980d643614e646eb39542aeacf1afdb5e You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
Ok, all shellcheck warnings gone and test suite is passing. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#issuecomment-1651159358 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@ffesti pushed 1 commit. c69b996901e5d62f8d49d72b46dc651115c581a8 Replace eval with mapfile and xargs -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573/files/df7df2c046d6a26c2494b12bea89bb9b5d7916b3..c69b996901e5d62f8d49d72b46dc651115c581a8 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
OK, there is only one warning left caused by the `eval` line. Let me see if we can get rid of that, too. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#issuecomment-1651069702 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@ffesti pushed 6 commits. d99cfdbc10ed5b56eaac54704a3b91631086061d Add sysusers.sh script 05328c5d35b79f24016fd945e4b264badc16caf4 Replace getent with grep d020c8b082b29d02d9abd4e9fdd1176ed9e8c700 Implement --replace 16690d145b086e197c44d2c95c3b3d3c295d9527 Add test case for skipping user creation 85d90c9de078fcaa115275e1b3882507fea6069f Fix shellcheck warnings df7df2c046d6a26c2494b12bea89bb9b5d7916b3 Fix indentation -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573/files/7b1600e2449421bbce1f1fdb76857c5d5d2d7dd9..df7df2c046d6a26c2494b12bea89bb9b5d7916b3 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
FYI, the test-suite PR #2559 has been merged so you can rebase now. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#issuecomment-1650300905 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@ffesti commented on this pull request. > @@ -0,0 +1,150 @@ +#!/bin/sh OK, there are just too many bash'isms to run this as a `/bin/sh` script. Changing the interpreter fixes most of that. Will push a patch for everything else soon. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#discussion_r1273511968 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@ffesti commented on this pull request. > +[ -e "$ROOT"/etc/passwd ] || touch "$ROOT"/etc/passwd +[ -e "$ROOT"/etc/shadow ] || touch "$ROOT"/etc/shadow +[ -e "$ROOT"/etc/group ] || touch "$ROOT"/etc/group While I agree `useradd` and `groupadd` just won't work. And we want rpm -q --root to just work without needing to populate the chroot beforehand. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#discussion_r1273510258 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@keszybz commented on this pull request. > + if [ "-" = "$fn" ]; then + parse <&0 + else + [ -r "$fn" ] || continue + parse <"$fn" Indentation is strange, also in other places. > +[ -e "$ROOT"/etc/passwd ] || touch "$ROOT"/etc/passwd +[ -e "$ROOT"/etc/shadow ] || touch "$ROOT"/etc/shadow +[ -e "$ROOT"/etc/group ] || touch "$ROOT"/etc/group Why? Shouldn't things work even if those files are missing? > @@ -0,0 +1,150 @@ +#!/bin/sh Shellcheck says: In sysusers.sh line 57: hasuser "$user" || \\ ^-- SC2288 (warning): This is interpreted as a command name ending with '\'. Double check syntax. In sysusers.sh line 92: { [ "${line:0:1}" = '#' ] || [ "${line:0:1}" = ';' ]; } && continue ^-^ SC3057 (warning): In POSIX sh, string indexing is undefined. ^-^ SC3057 (warning): In POSIX sh, string indexing is undefined. In sysusers.sh line 96: case "${arr[0]}" in ^---^ SC2154 (warning): arr is referenced but not assigned. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. In sysusers.sh line 98: if [[ "${arr[2]}" == *":"* ]]; then ^^ SC3010 (warning): In POSIX sh, [[ ]] is undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. In sysusers.sh line 99: user "${arr[1]}" "${arr[2]%:*}" "${arr[3]}" "${arr[2]#*:}" "${arr[4]}" "${arr[5]}" ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. In sysusers.sh line 101: group "${arr[1]}" "${arr[2]}" ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. In sysusers.sh line 102: user "${arr[1]}" "${arr[2]}" "${arr[3]}" "${arr[1]}" "${arr[4]}" "${arr[5]}" ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. In sysusers.sh line 106: group "${arr[1]}" "${arr[2]}" ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. In sysusers.sh line 109: group "${arr[2]}" "-" ^---^ SC3054 (warning): In POSIX sh, array references are undefined. In sysusers.sh line 110: user "${arr[1]}" "-" "" "${arr[1]}" "" "" ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. In sysusers.sh line 111: usermod "${arr[1]}" "${arr[2]}" ^---^ SC3054 (warning): In POSIX sh, array references are undefined. ^---^ SC3054 (warning): In POSIX sh, array references are undefined. In sysusers.sh line 127:
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
@ffesti pushed 4 commits. 0dd67944506a2cf62db7df74d8ff0471128930f9 Add sysusers.sh script d173792ee2cddafa6ca729e02f41172970324989 Replace getent with grep 8424b3a0351181302163334064e6d8ed084277e9 Implement --replace 7b1600e2449421bbce1f1fdb76857c5d5d2d7dd9 Add test case for skipping user creation -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573/files/31f6e4e2bd5e879ab0f76c3df41d7121e0352860..7b1600e2449421bbce1f1fdb76857c5d5d2d7dd9 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
This branch is missing the patch for adding groupadd and useradd to the test suite but even with that `groupadd` fails due to not being able to access some security/SElinux stuff like `/proc/thread-self/attr/fscreate` and `/sys/fs/selinux/enforce`. Nothing we want to fix in a test suite that's gone in a few days. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573#issuecomment-1635981492 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
[Rpm-maint] [rpm-software-management/rpm] Add sysusers.sh script to replace systemd-sysusers (PR #2573)
for user and group generation. This is currently failing in the test suite but works fine when rebased onto #2559 Still needs --replace to be implemented You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/2573 -- Commit Summary -- * Add sysusers.sh script * Replace getent with grep -- File Changes -- M macros.in (3) M scripts/CMakeLists.txt (1) A scripts/sysusers.sh (129) -- Patch Links -- https://github.com/rpm-software-management/rpm/pull/2573.patch https://github.com/rpm-software-management/rpm/pull/2573.diff -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2573 You are receiving this because you are subscribed to this thread. Message ID: rpm-software-management/rpm/pull/2...@github.com ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint