The test failed:
+ cd etc
+ bash /builddir/build/SOURCES/uidgidlint ./uidgid
grep: ./uidgid: No such file or directory
grep: ./uidgid: No such file or directory
but because pipefail wasn't set, the script iterated over empty input
and didn't actually test anything.
Set -o eu,pipefail to catch similar errors in the future and fix the
invocation so that the test passes.
[skip changelog]
This is a partial revert of 7ced36d60b
and a follow-up. I was in the middle of reworking the commit and
pushed the not-ready version to the upstream repo by mistake.
The passwd and group files that are now generated are dropped.
[skip changelog]
This inverts the order of operations: previously, the passwd and group
files were the original source of information, and shadow and gpasswd
were created using sed, and sysusers fragments were generated using a
shell script.
There are a few problems with the previous approach:
- We had two sysusers files, one for groups and one for users. This
split makes things more complicated. By default sysusers will create
a group with the same name and number, if a user is defined without
an explicit group override. This is what we want to do, to make the
config shorter and easier to read.
- The rpm sysusers generator created two sets of 'Provides:group(…)'
attributes.
In the new approach, we use the sysusers file as the "source of truth",
and run systemd-sysusers to generate passwd, group, shadow, and gshadow
files.
This has the following advantages:
- No code to maintain here.
- The config is easier to read.
- Toes a lint of the data. If a uid conflict was present, we'd
get a warning.
- With the support for sysusers in rpm, when we install this package on
a system, because of the Provides, rpm will create the users and groups
using systemd-sysusers anyway. So by doing the same during the build,
we match what rpm would do anyway, so we get a file that is closer to
what will actually appear in the system.
- Since we now have a file generated by systemd-sysusers in the payload,
we can see how things will actually look on the installed system.
This allowed me to notice a bug in systemd packaging.
Some packages within the same transaction (e.g. during system-upgrades) may
rely on having the pre-allocated system users and/or system groups provided
by the setup package already to be present when the dependee package gets
installed; waiting for the %%transfiletriggerin to run `systemd-sysusers`
will be too late in such cases.
The above statement also applies for the temporary files from this package
to be created by running `systemd-tmpfiles`.
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
This implements https://pagure.io/setup/issue/51.
The "upstream" is only used to build the package in our dist-git, so we can reduce the
total amount of work by moving files downstream and maintaining them there.
The package after the rebuild is identical, except for intentional changes
(removal of Group, updating of Url, bumping of the Version):
$ rpmdiff -iT noarch/setup-2.14.5-2.fc41.noarch.rpm noarch/setup-2.15.0-1.fc41.noarch.rpm
S.5..... GROUP
S.5..... URL
removed REQUIRES config(setup) = 2.14.5-2.fc41
added REQUIRES config(setup) = 2.15.0-1.fc41
removed PROVIDES config(setup) = 2.14.5-2.fc41
removed PROVIDES setup = 2.14.5-2.fc41
added PROVIDES config(setup) = 2.15.0-1.fc41
added PROVIDES setup = 2.15.0-1.fc41
bashrc: switch PROMPT_COMMAND to be an array (rhbz#2097525)
profile: don't overwrite the HISTSIZE environment variable
hosts: use "example.org" as example domain (rhbz#2246220)
csh.login: source csh.local (RHEL-17226)
sysusers.d: add script and generate configuration fragment for users
Add fallback to hostname determination for csh.login (rhbz#2079768)
Remove ancient Conflicts
files: mark /run/motd as an ephemeral ghost entry
sysusers.d: add script and configuration fragments for groups
passwd: align 'nologin' shell path with systemd defaults
uidgid: assign GID 101 for 'ssh_keys' group
uidgid: assign UID/GID 114 for 'polkitd'
passwd: update GECOS field for 'root' user
services: remove commas from aliases for ircu-3
setup.spec: throw away newaliases output again
bashrc sets hardcoded umask (#1902166)
bashrc: clean up unused references to VTE
uidgid: simplify table format and other format enhancements
uidgid: fix news and lock entries, move basic groups to systemd
os.execute uses /bin/sh, which to a large extent defeats the purpose of having
the scriptlet in lua ;)
$ strace -qq -ff -eexecve rpm -E "%{lua:os.execute('true')}"
execve("/usr/bin/rpm", ["rpm", "-E", "%{lua:os.execute('true')}"], 0x7ffd180ce638 /* 60 vars */) = 0
[pid 849466] execve("/bin/sh", ["sh", "-c", "true"], 0x7fff73cfc9d8 /* 60 vars */) = 0
Let's use posix.exec(). rpm.execute() would be nice, but it does not
support suppressing of stderr.
Move /var/log/lastlog ownership to systemd (#1798685)
tcsh sets variable p to /usr/sbin from /etc/csh.login (#2019874)
'history -a' doesn't belong in /etc/bashrc (#1871744)
localhost.localdomain in wrong order /etc/hosts (#1724539)
aliases: add pcp user (#1744091)
lang.csh: fix several variable substitution bugs and typos (#1746749)
don't set LANG as a per-shell variable
fix lang.csh script so it doesn't break tcsh -e scripts II (#1620004)
use full path for non-builtins in csh.cshrc, csh.login, lang.csh, lang.sh and profile (#1747493)