1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-07 17:17:44 +03:00
Commit Graph

60787 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
db62f51a9f basic/filesystems: fs_in_group() returns a boolean
is_{temporary,network}_fs() looked like they are incorrectly casting an error
to true, but actually the return type is misdeclared.
2022-11-08 18:21:10 +01:00
Zbigniew Jędrzejewski-Szmek
3ae6b3bf72 basic: rename util.h to logarithm.h
util.h is now about logarithms only, so we can rename it. Many files included
util.h for no apparent reason… Those includes are dropped.
2022-11-08 18:21:10 +01:00
Zbigniew Jędrzejewski-Szmek
ee617a4e5c basic: move a bunch of cmdline-related funcs to new argv-util.c+h
I wanted to move saved_arg[cv] to process-util.c+h, but this causes problems:
process-util.h includes format-util.h which includes net/if.h, which conflicts
with linux/if.h. So we can't include process-util.h in some files.

But process-util.c is very long anyway, so it seems nice to create a new file.
rename_process(), invoked_as(), invoked_by_systemd(), and argv_looks_like_help()
which lived in process-util.c refer to saved_argc and saved_argv, so it seems
reasonable to move them to the new file too.

util.c is now empty, so it is removed. util.h remains.
2022-11-08 18:21:10 +01:00
Zbigniew Jędrzejewski-Szmek
c47511da7e meson: add version.h as dependency to more targets
version.h can be generated after compilation starts, creating a race condition
between compilation of various .c files and creation of version.h. Let's add it
as a dependency to more build targets that require version.h or build.h.

So far we played whack'a'mole by adding versiondep whenever compilation failed.
In principle any target which includes compilation (i.e. any that has .c
sources directly), could require this. I don't understand why we didn't see
more failures… But it seems reasonable to just add the dependency more widely.
2022-11-08 18:18:34 +01:00
Zbigniew Jędrzejewski-Szmek
d6b4d1c7c4 basic: move version() to build.h+c 2022-11-08 13:41:14 +01:00
Zbigniew Jędrzejewski-Szmek
c8715007e0 basic,shared: move disable_coredumps() to coredump-util.[ch] 2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
3ec2ad35ba basic: move container_get_leader() to process-util.[ch]
basic/util.[ch] is a grab-bag of unrelated functions. Let's move a few
of the remaning functions to better locations.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
baa6a42d27 basic: create new basic/initrd-util.[ch] for initrd-related functions
I changed imports of util.h to initrd-util.h, or added an import of
initrd-util.h, to keep compilation working. It turns out that many files didn't
import util.h directly.

When viewing the patch, don't be confused by git rename detection logic:
a new .c file is added and two functions moved into it.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
b61b95ae9e tests: move tests for eqzero() to a new file
It's a bit silly to have a separate file that one short test, but this is the
last part of the test code that is misplaced, and here consistency beats
brevity.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
737f274e1e tests: move tests for PROTECT_ERRNO to the right file
Also, rename them to uppercase so that the test name matches what we're
actually testing.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
2ba6823716 tests: create test-raw-clone.c for raw-clone.h
The include for process-util.h is added for reset_cached_pid(). This
essentially fixes a pre-existing missing include.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
da603935d5 tests: create test-limits-util.c for limits-util funcs 2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
0e58dc999c sd-journal: make prot_from_flags() static and rename
The function had just one caller and a name that didn't explain much.
Let's make it static and rename for clarity.

While at it, the only caller was not doing error handling correctly
— the function would potentially return a negative error value which
wasn't handled. In practice this couldn't happen, but let's remove
this ambiguity.
2022-11-08 13:41:13 +01:00
Lennart Poettering
bcb639662e
Merge pull request #25266 from poettering/dissect-fsck-fix
dissect: fix fsck invocation
2022-11-07 12:24:53 +01:00
Luca Boccassi
f10ad99ab0
Merge pull request #25107 from lucab/ups/sysusers-gid-check-username
sysusers: cross-check user and group names too
2022-11-06 23:58:53 +01:00
Christian Göttsche
3e6b7d2626 loop-util: open lock fd read-only
flock(2) works with file descriptors opened with O_RDONLY.

This affects SELinux systems where access to block devices is quite
restricted to avoid bypasses on filesystem objects.
2022-11-05 19:19:56 +01:00
Christian Göttsche
c826b7ef32 core: update audit messages
Pass getuid() instead of literal `0` as auid, since user session
managers also issue audit messages on SELinux denials.
2022-11-05 19:19:28 +01:00
Lennart Poettering
cfb623b6e7 dissect: get rid of basename() use 2022-11-05 19:18:39 +01:00
Jan Macku
b6a23ad642 ci(dev-freeze): Use GitHub Action for PR comments
GitHub Action `devel-freezer` helps with development freeze notifications
during the RC phase. It will create comments using predefined messages on
newly created and updated PRs when the RC tag has been released.
Also, it will update comments once a new major version has been released.

Documentation available at: https://github.com/redhat-plumbers-in-action/devel-freezer
2022-11-05 14:10:01 +01:00
Christian Göttsche
a45efc9e4b test: fstab-generator: adjust PATH for fsck
fsck(8) is located in /usr/sib/ on Debian sid:

    stdout:
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-01-dev-nfs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-02-dhcp.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-03-dhcp6.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-04-nfs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-05-nfs4.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-06-ipv4.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-07-ipv6.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-08-implicit-nfs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-09-cifs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-10-iscsi.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-11-live.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-12-dev-sdx.input
    --- /dev/fd/63  2022-11-04 15:39:13.131532174 +0100
    +++ /dev/fd/62  2022-11-04 15:39:13.131532174 +0100
    @@ -6,3 +6,4 @@
     initrd-usr-fs.target.requires
     initrd-usr-fs.target.requires/sysroot.mount
     sysroot.mount
    +systemd-fsck-root.service
    **** Unexpected output for /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-12-dev-sdx.input
    stderr:
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on CIFS was requested.
    Skipping root directory handling, as root on iSCSI was requested.
    Skipping root directory handling, as root on live image was requested.
    Found entry what=/dev/sdx1 where=/sysroot type=n/a opts=ro
    Checking was requested for /dev/sdx1, but the fsck command does not exist.
2022-11-04 23:40:50 +01:00
Lennart Poettering
f8ab781223 dissect: fix fsck
Since f7725647bb when dissecting a disk
image we operate with fds to the device nodes in question wherever we
can. This includes when we fork off fsck, where we pass a /proc/self/fd/
path as argument. This only works if we keep that fd open however and
disable O_CLOEXEC on the fd. Hence do so, and fix fsck this way.

(Without this, all fsck will fail, since the fd path is invalid)
2022-11-04 18:53:36 +01:00
Lennart Poettering
981cfbe046 process-util: add new FORK_CLOEXEC_OFF flag for disabling O_CLOEXEC on remaining fds
Often the fds that shall stay around in the child shall be passed
to a process over execve(), hence add an option to explicitly disable
O_CLOEXEC on them in the child.
2022-11-04 18:53:36 +01:00
Lennart Poettering
ed18c22c98 fd-util: add new fd_cloexec_many() helper 2022-11-04 18:46:42 +01:00
Lennart Poettering
d11c14a981 fd-util: make fd_in_set() (and thus close_all_fds()) handle invalidated fds in the array
let's handle gracefully if fds in the specified array are already
invalidated (i.e. negative). This is handy when putting together arrays
on the fly.
2022-11-04 18:45:32 +01:00
Luca Boccassi
6e14e70599
Merge pull request #25257 from fbuihuu/fix-test-execute-on-opensuse
Fix test execute on opensuse
2022-11-04 18:29:51 +01:00
Antonio Alvarez Feijoo
981502c5cc kernel-install/90-loaderentry: do not add multiple systemd.machine_id options
Do not unconditionally add a new systemd.machine_id command line option, first
check if it already exists with the expected value.

Fixes #25203
2022-11-04 16:53:40 +01:00
Luca Boccassi
e0fc9be37e tmpfiles.d: do not fail if provision.conf fails
On a read-only filesystem creating /root/.ssh might fail, but that's ok.
Do not fail the run, as this is only needed to add the credential, which
is a separate step.
2022-11-04 15:42:16 +01:00
김인수
cb9c37b349 po: Translated using Weblate (Korean)
Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: 김인수 <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main
2022-11-04 12:27:53 +00:00
Franck Bui
09415aef94 tests: minor simplification in test-execute
No functional change.
2022-11-04 12:53:17 +01:00
Franck Bui
d723b0467d tests: make test-execute pass on openSUSE
In my understanding user group "3" (aka "sys") is kept for historical reasons
but not really useful these days. That's probably explained why this group
isn't defined on openSUSE.

Hence let's drop reference to this user group, this shouldn't lessen the
revelance of the test since SupplementaryGroups= is still tested with 2 other
groups.
2022-11-04 12:39:56 +01:00
Yu Watanabe
e31540196b resolve: enable per-link mDNS setting by default
Otherwise, if the link is not managed by systemd-networkd, mDNS cannot
be enabled without calling `resolvectl` explicitly.

Fixes #25252.
2022-11-04 12:31:00 +01:00
Luca Boccassi
441c62f769
Merge pull request #25244 from yuwata/reboot-util-follow-ups
reboot-util: several cleanups
2022-11-04 12:13:01 +01:00
Luca Boccassi
93a142701b
Merge pull request #25246 from yuwata/udev-serial-by-id-symlinks
udev: fix by-id symlinks
2022-11-04 10:18:08 +01:00
Yu Watanabe
072adf2693
Merge pull request #25250 from mrc0mmand/coverage
test: provide coverage for auxiliary utilities
2022-11-04 15:53:03 +09:00
Luca Boccassi
4c4a73ce06 firstboot: fix segfault when --locale-messages= is passed without --locale=
\#0  __strcmp_evex () at ../sysdeps/x86_64/multiarch/strcmp-evex.S:295
No locals.
\#1  0x0000557444eb172b in process_locale () at ../src/firstboot/firstboot.c:342
        etc_localeconf = 0x7ffd40217b80 "/root/root/etc/locale.conf"
        locales = {0x0, 0x0, 0x0}
        i = 0
        r = <optimized out>
        __PRETTY_FUNCTION__ = "process_locale"
        __func__ = "process_locale"
\#2  0x0000557444eaff93 in run (argv=0x7ffd40217d98, argc=3) at ../src/firstboot/firstboot.c:1401
        loop_device = 0x0
        unlink_dir = 0x0
        r = <optimized out>
        loop_device = <optimized out>
        unlink_dir = <optimized out>
        r = <optimized out>
        __func__ = <optimized out>
        __PRETTY_FUNCTION__ = <optimized out>
        enabled = <optimized out>
        _error = <optimized out>
        _level = <optimized out>
        _e = <optimized out>
        _level = <optimized out>
        _e = <optimized out>
\#3  main (argc=3, argv=0x7ffd40217d98) at ../src/firstboot/firstboot.c:1432
        r = <optimized out>
        __PRETTY_FUNCTION__ = "main"

Fixes https://github.com/systemd/systemd/issues/25249
2022-11-04 15:51:49 +09:00
Yu Watanabe
6564918c6c reboot-util: drop unnecessary cast
Follow-up for ede5a78f50.
2022-11-04 11:32:34 +09:00
Yu Watanabe
3f33bfddeb reboot-util: drop redundant headers
Follow-up for ede5a78f50.
2022-11-04 11:32:34 +09:00
Yu Watanabe
a2ea44b7db meson: sort libraries
Except for 'threads'.

Follow-up for ede5a78f50.
2022-11-04 11:32:22 +09:00
Frantisek Sumsal
d1020334fd test: introduce sanity coverage for auxiliary utils 2022-11-03 23:08:58 +01:00
Luca BRUNO
76ad8ef68d
test-sysusers: check group creation with matching user entry 2022-11-03 15:12:15 +00:00
Luca BRUNO
4ae3e8c9db
sysusers: cross-check user and group names too
This adds an additional name check when cross-matching new group
entries against existing users, which allows coalescing entries
matching both ID and name.
It provides a small idempotence enhancement when creating groups
in cases where matching user entries are in place. By fine-tuning
the conflict detection logic, this avoids picking up new random
IDs and correctly prefers configuration values instead.
2022-11-03 15:11:00 +00:00
Frantisek Sumsal
8b1879bcd0 test: cover a couple of previously missed analyze code paths 2022-11-03 11:33:13 +01:00
Frantisek Sumsal
926d95cd4c test: cover legacy/deprecated systemd-analyze verbs
They're no longer documented since 26e1e97345 but still work.
2022-11-03 11:26:08 +01:00
Yu Watanabe
5286da064c udev: add safe guard for setting by-id symlink
The ID_BUS property is necessary for creating by-id symlinks.
2022-11-03 09:59:54 +09:00
Yu Watanabe
b2e53f5a0f udev: drop redundant call of usb_id and assignment of ID_USB_INTERFACE_NUM
The usb_id builtin command is already called in the above, and the
command sets the ID_USB_INTERFACE_NUM property.
2022-11-03 09:59:35 +09:00
Yu Watanabe
01e704eba9 udev: first set properties based on usb subsystem
After 479da1107a, the usb_id builtin
command does not set ID_SERIAL if ID_BUS is already set.
Before the commit, all properties set based on pci bus were overwritten
by the usb_id, hence now it is sufficient setting them only when ID_BUS is
not set yet.

Fixes #25238.
2022-11-03 09:53:19 +09:00
Frantisek Sumsal
6c83054c01 test: add a sanity coverage for systemd-analyze verbs 2022-11-03 06:25:51 +09:00
Samuel Thibault
ede5a78f50 shutdown: Add Xen kexec support
In the Xen case, it's the hypervisor which manages kexec. We thus
have to ask it whether a kernel is loaded, instead of relying on
/sys/kernel/kexec_loaded.
2022-11-02 20:47:41 +01:00
Frantisek Sumsal
23f3a6f5ff test: further extend systemctl's sanity coverage
Also, fix a race condition introduced by d16684fe13:
```
[   16.904218] H testsuite-26.sh[394]: + systemd-run --unit failed.service /bin/false
[   16.964783] H systemd[845]: failed.service: Executing: /bin/false
[   16.965062] H systemd[1]: Started failed.service.
[   16.965462] H testsuite-26.sh[844]: Running as unit: failed.service
[   16.966390] H testsuite-26.sh[394]: + systemctl is-failed failed.service
[   16.977970] H testsuite-26.sh[846]: active
[   16.978403] H systemd[1]: failed.service: Main process exited, code=exited, status=1/FAILURE
[   16.978478] H systemd[1]: failed.service: Failed with result 'exit-code'.
```
2022-11-02 18:26:27 +01:00
Frantisek Sumsal
1ca1bb03de man: use the correct 'Markers' property name for marking units
Follow-up to c9615f7352 and 70666e28a1.
2022-11-02 14:36:51 +01:00