]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agoman: document fs types known to makefs 21275/head
Zbigniew Jędrzejewski-Szmek [Sat, 13 Nov 2021 15:47:40 +0000 (16:47 +0100)] 
man: document fs types known to makefs

4 years agomakefs: add "support" for f2fs
Zbigniew Jędrzejewski-Szmek [Sat, 13 Nov 2021 15:40:46 +0000 (16:40 +0100)] 
makefs: add "support" for f2fs

The man page doesn't quite match what --help says, and I needed to use "-f" to
write a wiped partition. This all feels a bit experimental, but the fs has some
adherents, and we should make it easy to use.

(Also, an empty 256MB device formatted and mounted shows up as
  Filesystem      Size  Used Avail Use% Mounted on
  /dev/loop0      254M   85M  170M  34% /var/tmp/mount
which also seems a bit over the top…)

Requested in https://github.com/systemd/systemd/pull/21275#issuecomment-967928690.

4 years agomakefs: fix too-long swap labels
Zbigniew Jędrzejewski-Szmek [Fri, 12 Nov 2021 14:56:56 +0000 (15:56 +0100)] 
makefs: fix too-long swap labels

Apparently mkswap has it's own limit, and it seems to be one lower than the one
for ext2/3/4.

$ for i in ext2 ext3 ext4 btrfs xfs vfat swap minix; do
  echo $i && wipefs -q -a '/var/tmp/głąbźśńćąśððð.img'
  build/systemd-makefs $i '/var/tmp/głąbźśńćąśððð.img'
done

ext2
/var/tmp/głąbźśńćąśððð.img successfully formatted as ext2 (label "głąbźśńćą", uuid 7626bc5c-8ac4-43cf-87b7-1b2761272dd3)
ext3
/var/tmp/głąbźśńćąśððð.img successfully formatted as ext3 (label "głąbźśńćą", uuid 0da22cad-0dbf-4a7a-962d-12cd39d006b5)
ext4
/var/tmp/głąbźśńćąśððð.img successfully formatted as ext4 (label "głąbźśńćą", uuid dded267b-8955-4d19-82a5-1f231d446059)
btrfs
/var/tmp/głąbźśńćąśððð.img successfully formatted as btrfs (label "głąbźśńćąśððð.img", uuid 9e2e89f1-010d-4ab6-80f3-f9e215dbc225)
xfs
/var/tmp/głąbźśńćąśððð.img successfully formatted as xfs (label "głąbźśń", uuid 2cc937af-4c41-465c-8f52-aab2304bd860)
vfat
mkfs.fat 4.2 (2021-01-31)
/var/tmp/głąbźśńćąśððð.img successfully formatted as vfat (label "G__B_______", uuid a3a9e028)

swap
...
LABEL=głąbźśńć, UUID=0ab787aa-37a6-4b32-978b-d71efc6e6098
/var/tmp/głąbźśńćąśððð.img successfully formatted as swap (label "głąbźśńć", uuid 0ab787aa-37a6-4b32-978b-d71efc6e6098)

minix
...
/var/tmp/głąbźśńćąśððð.img successfully formatted as minix (no label or uuid specified)

4 years agomakefs: fix too-long ext2/3/4 labels
Zbigniew Jędrzejewski-Szmek [Fri, 12 Nov 2021 13:22:58 +0000 (14:22 +0100)] 
makefs: fix too-long ext2/3/4 labels

4 years agomakefs: fix label for vfat filesystems
Zbigniew Jędrzejewski-Szmek [Tue, 9 Nov 2021 07:52:19 +0000 (08:52 +0100)] 
makefs: fix label for vfat filesystems

I was testing with a "test1.img" and mkfs.vfat rejects "TEST1.IMG" with the
error "Labels with characters *?.,;:/\|+=<>[]" are not allowed". So let's
replace those characters with "_".

4 years agobasic/utf8: add function to convert to ASCII
Zbigniew Jędrzejewski-Szmek [Fri, 12 Nov 2021 09:27:13 +0000 (10:27 +0100)] 
basic/utf8: add function to convert to ASCII

The conversion must be lossy because ASCII doesn't have enough chars.

4 years agobasic/utf8: inline some iterator variables
Zbigniew Jędrzejewski-Szmek [Fri, 12 Nov 2021 08:31:55 +0000 (09:31 +0100)] 
basic/utf8: inline some iterator variables

4 years agomakefs: supress mkfs output, but print one line on success
Zbigniew Jędrzejewski-Szmek [Tue, 9 Nov 2021 07:40:24 +0000 (08:40 +0100)] 
makefs: supress mkfs output, but print one line on success

$ for i in ext2 ext3 ext4 btrfs xfs vfat swap minix; do
  echo $i && wipefs -q -a /var/tmp/test2_img && build/systemd-makefs $i /var/tmp/test2_img
done

ext2
/var/tmp/test2_img successfully formatted as ext2 (label "test2_img", uuid ad584a5b-037b-497a-825d-eaf2ba90da2d)
ext3
/var/tmp/test2_img successfully formatted as ext3 (label "test2_img", uuid 95239fff-55f4-44d5-bae0-11ef75d13166)
ext4
/var/tmp/test2_img successfully formatted as ext4 (label "test2_img", uuid 8c7ea699-05ab-4ce6-8df6-bc20d53dfd29)
btrfs
/var/tmp/test2_img successfully formatted as btrfs (label "test2_img", uuid 860bb061-4d92-4607-8821-a9d00216490e)
xfs
/var/tmp/test2_img successfully formatted as xfs (label "test2_img", uuid f32499ea-7311-47bb-be57-da62e51d33ae)
vfat
mkfs.fat 4.2 (2021-01-31)
/var/tmp/test2_img successfully formatted as vfat (label "TEST2_IMG", uuid d1e4ae63)
swap
mkswap: /var/tmp/test2_img: insecure permissions 0644, fix with: chmod 0600 /var/tmp/test2_img

mkswap: /var/tmp/test2_img contains holes or other unsupported extents.
        This swap file can be rejected by kernel on swap activation!
        Use --verbose for more details.

Setting up swapspace version 1, size = 256 MiB (268431360 bytes)
LABEL=test2_img, UUID=16bc3d8c-98d4-462b-8ff8-338467cde871
/var/tmp/test2_img successfully formatted as swap (no label or uuid specified)
minix
21856 inodes
65535 blocks
Firstdatazone=696 (696)
Zonesize=1024
Maxsize=268966912

/var/tmp/test2_img successfully formatted as minix (no label or uuid specified)

4 years agomakefs: also set uuid/label for ext2/ext3
Zbigniew Jędrzejewski-Szmek [Mon, 8 Nov 2021 11:18:30 +0000 (12:18 +0100)] 
makefs: also set uuid/label for ext2/ext3

We were only "supporting" ext4. Let's add "support", i.e. pass our optimization
options and uuid/label for the other two fses in the same family.

Nowadays there is separate code in the kernel, all three fs types are handled
by ext4 code. ext2 in particular is useful for in-memory devices: the journal
is just a waste of space there. ext3 is added for completeness mostly, since
ext4 should probably be used instead. But people might use it for testing or
for compatibility with older systems and I don't see much reason to not add
"support" here.

4 years agomakefs: reindent mkfs calls to follow the same style
Zbigniew Jędrzejewski-Szmek [Mon, 8 Nov 2021 11:12:58 +0000 (12:12 +0100)] 
makefs: reindent mkfs calls to follow the same style

I think this also makes it much easier to see what args are passed.

4 years agotest: refactor test-procfs-util for clarity and skip test on perm failure
Dan Streetman [Fri, 5 Nov 2021 20:56:16 +0000 (16:56 -0400)] 
test: refactor test-procfs-util for clarity and skip test on perm failure

After commit c3dead53d50e334f2d072a2248256983d6dc9f8c the test can fail
if the procfs file(s) aren't writable, because the check for permission
failure happens after a call that will never fail, since setting the
limit to the existing limit will always pass.

This also refactors the function slightly to make the test var names
clearer.

4 years agohwdb: remove the tablet pad entry for the UC-Logic 1060N
Peter Hutterer [Mon, 8 Nov 2021 00:47:56 +0000 (10:47 +1000)] 
hwdb: remove the tablet pad entry for the UC-Logic 1060N

This entry only matches on vid/pid, so the pen event node of the device
would also get assigned the ID_INPUT_TABLET_PAD property - making it
break with libinput.

On top of that, UC-Logic's tablets re-use USB ids, so now we're breaking
multiple devices this way.

To get this device tagged correctly, use libwacom which has the
per-device hwdb entries.

Fixes #17953

This reverts commit 0fbe78ac7a4c5689660b1c1e2c956ffa1a2e4ee5

4 years agopo: Translated using Weblate (German)
Ettore Atalan [Mon, 8 Nov 2021 00:49:23 +0000 (01:49 +0100)] 
po: Translated using Weblate (German)

Currently translated at 77.7% (147 of 189 strings)

Co-authored-by: Ettore Atalan <atalanttore@googlemail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/de/
Translation: systemd/main

4 years agoMerge pull request #21237 from bluca/analyze_skip
Luca Boccassi [Sat, 6 Nov 2021 11:19:40 +0000 (11:19 +0000)] 
Merge pull request #21237 from bluca/analyze_skip

analyze: allow a custom policy to skip a check

4 years agoMerge pull request #21171 from DaanDeMeyer/tty-dimensions
Lennart Poettering [Sat, 6 Nov 2021 09:16:45 +0000 (10:16 +0100)] 
Merge pull request #21171 from DaanDeMeyer/tty-dimensions

exec: Add TTYRows and TTYColumns properties to set TTY dimensions

4 years agouser-record: show CIFS extra mount options, in output too
Lennart Poettering [Fri, 5 Nov 2021 14:30:36 +0000 (15:30 +0100)] 
user-record: show CIFS extra mount options, in output too

Follow-up for 4c2ee5c7f26fda41d7eb1250c61c85cc869a90de

4 years agotest: wait until `lvm-activate-$vgroup.service` finishes
Frantisek Sumsal [Fri, 5 Nov 2021 17:57:26 +0000 (18:57 +0100)] 
test: wait until `lvm-activate-$vgroup.service` finishes

The new lvm autoactivation method runs `vgchange` via
`systemd-run --no-block`[0], which means that checking if the unit
is in the `active` state is not enough, since the main binary might
still be running. Let's fix this by waiting until the unit reaches
the `exited` sub state.

Follow-up to:
  * 29f8bef05eb9a4bb7f578b31409ca38ec1b1a069
  * e50d743f99fa66c9f55e534c4e109a2cf6323f04

[0] https://sourceware.org/git/?p=lvm2.git;a=blob;f=udev/69-dm-lvm.rules.in;h=39e5b98074010745f78a7a86a05929700c9cd690;hb=67722b312390cdab29c076c912e14bd739c5c0f6#l83

Example:
```
[   17.102002] systemd-udevd[282]: sdf: '/usr/bin/systemd-run -r --no-block --property DefaultDependencies=no --unit lvm-activate-iscsi_lvm2212 /usr/bin/lvm vgchange -aay --nohints iscsi_lvm2212'(err) 'Running as unit: lvm-activate-iscsi_>
[   17.102522] systemd-udevd[282]: sdf: Process '/usr/bin/systemd-run -r --no-block --property DefaultDependencies=no --unit lvm-activate-iscsi_lvm2212 /usr/bin/lvm vgchange -aay --nohints iscsi_lvm2212' succeeded.
[   17.102697] systemd-udevd[282]: sdf: Adding watch on '/dev/sdf'
[   17.104944] systemd[1]: lvm-activate-iscsi_lvm2212.service: Changed dead -> running
...
[   17.105434] systemd[1]: Started /usr/bin/lvm vgchange -aay --nohints iscsi_lvm2212.
[   17.105601] systemd[931]: lvm-activate-iscsi_lvm2212.service: Executing: /usr/bin/lvm vgchange -aay --nohints iscsi_lvm2212
...
[   17.420228] testsuite-64.sh[268]: + systemctl -q is-active lvm-activate-iscsi_lvm2212.service
[   17.420228] testsuite-64.sh[268]: + return 0
[   17.420228] testsuite-64.sh[268]: + test -e /dev/disk/by-path/ip-127.0.0.1:3260-iscsi-iqn.2021-09.com.example:iscsi.lvm.test-lun-4
[   17.420228] testsuite-64.sh[268]: + udevadm settle
[   17.420228] testsuite-64.sh[268]: + test -e /dev/iscsi_lvm2212/mypart1
...
[   17.451313] systemd[1]: testsuite-64.service: Main process exited, code=exited, status=1/FAILURE
[   17.451475] systemd[1]: testsuite-64.service: Failed with result 'exit-code'.
...
[   17.555759] systemd[1]: Starting End the test...
[   17.556972] sh[941]: + systemctl poweroff --no-block
...
[   17.688923] lvm[931]:   2 logical volume(s) in volume group "iscsi_lvm2212" now active
...
[   17.838484] systemd[1]: lvm-activate-iscsi_lvm2212.service: Child 931 belongs to lvm-activate-iscsi_lvm2212.service.
[   17.838718] systemd[1]: lvm-activate-iscsi_lvm2212.service: Main process exited, code=exited, status=0/SUCCESS (success)

```

4 years agocoredump: fix filename in journal when not compressed
xdavidwu [Fri, 5 Nov 2021 14:37:06 +0000 (22:37 +0800)] 
coredump: fix filename in journal when not compressed

Since 587f2a5e564cf434c2e0a653f52b8f73e86092d8, filename for
not-compressed coredump is missing from save_external_coredump, making
it write COREDUMP_FILENAME= (empty) in journal, making `coredumpctl`
report it missing but it is actually saved.
This fixes it.

4 years agoanalyze: allow a custom policy to skip a check with weight=0 21237/head
Luca Boccassi [Thu, 4 Nov 2021 19:48:58 +0000 (19:48 +0000)] 
analyze: allow a custom policy to skip a check with weight=0

In some cases an offline analysis should ignore some fields, for example
a portable service in an image will never list RootImage/RootDirectory, as
they are added at runtime, and thus can be skipped.

4 years agoexec: Add TTYRows and TTYColumns properties to set TTY dimensions 21171/head
Daan De Meyer [Thu, 28 Oct 2021 15:26:50 +0000 (16:26 +0100)] 
exec: Add TTYRows and TTYColumns properties to set TTY dimensions

4 years agogetty: Pass tty to use by agetty via stdin
Daan De Meyer [Fri, 29 Oct 2021 12:54:31 +0000 (13:54 +0100)] 
getty: Pass tty to use by agetty via stdin

If the tty arg is set to "-", agetty uses the stdin fd as the tty.
Let's pass the tty this way so that we keep an fd open to the tty
at all times. If all fd's to a tty are closed, the kernel might
reset the tty which we want to avoid.

4 years agotest: exercise sytemd-integritysetup & generator
Tony Asleson [Thu, 4 Nov 2021 19:19:56 +0000 (14:19 -0500)] 
test: exercise sytemd-integritysetup & generator

Ensures we can open a dm-integrity volume formated with
integritysetup.

4 years agosd-boot: Add .osrel section
Jan Janssen [Thu, 4 Nov 2021 09:37:25 +0000 (10:37 +0100)] 
sd-boot: Add .osrel section

This allows starting systemd-boot from \EFI\Linux for easier testing
and bisection without risking an unbootable system as the user does not
need to replace their working loader.

4 years agoanalyze: explain how the weight/range policy fields are used
Luca Boccassi [Thu, 4 Nov 2021 19:47:29 +0000 (19:47 +0000)] 
analyze: explain how the weight/range policy fields are used

4 years agoMerge pull request #21252 from poettering/homed-record-dir-env-var
Lennart Poettering [Fri, 5 Nov 2021 20:52:00 +0000 (21:52 +0100)] 
Merge pull request #21252 from poettering/homed-record-dir-env-var

homed: add env var to override dir where we fine stored user records

4 years agouser-record: fix display of access mode
Lennart Poettering [Fri, 5 Nov 2021 15:36:32 +0000 (16:36 +0100)] 
user-record: fix display of access mode

4 years agouser-record: show fs/luks/gpt UUIDs as proper UUIDs
Lennart Poettering [Fri, 5 Nov 2021 17:04:53 +0000 (18:04 +0100)] 
user-record: show fs/luks/gpt UUIDs as proper UUIDs

These are not defined by us, but are defined as proper UUIDs by their
respective specs, hence show them as such.

4 years agodocs: document systemd-homed development env vars 21252/head
Lennart Poettering [Fri, 5 Nov 2021 18:07:52 +0000 (19:07 +0100)] 
docs: document systemd-homed development env vars

4 years agohomed: add env var to override dir where we fine stored user records
Lennart Poettering [Fri, 5 Nov 2021 17:03:05 +0000 (18:03 +0100)] 
homed: add env var to override dir where we fine stored user records

This adds an env var which we can use to redirect where homed stores and
looks for user records kept on the host. This is useful for debugging
purposes so that one can easily run another homed instnce that doesn't
interfere with the main instance.

4 years agotest: Add test for flag macros
Jan Janssen [Fri, 5 Nov 2021 11:53:09 +0000 (12:53 +0100)] 
test: Add test for flag macros

4 years agoMerge pull request #20056 from calestyo/split-up-sysusers.d-systemd.conf.in
Zbigniew Jędrzejewski-Szmek [Fri, 5 Nov 2021 14:30:33 +0000 (15:30 +0100)] 
Merge pull request #20056 from calestyo/split-up-sysusers.d-systemd.conf.in

sysusers: split up systemd.conf

4 years agoMerge pull request #20138 from keszybz/coding-style-variable-decls
Luca Boccassi [Fri, 5 Nov 2021 13:57:30 +0000 (13:57 +0000)] 
Merge pull request #20138 from keszybz/coding-style-variable-decls

A coding style tweak and checking of sd_notify() calls and voidification of pager_open()

4 years agomeson-render-jinja2: use ast.literal_eval()
Zbigniew Jędrzejewski-Szmek [Fri, 5 Nov 2021 10:51:17 +0000 (11:51 +0100)] 
meson-render-jinja2: use ast.literal_eval()

Imports are sorted in the usual fashion: stdlib first.

literal_eval() parses string/numbers/lists/sets/dicts, and nothing else, while
eval will execute any python code. Using literal_eval() is generally more
correct, because it avoids the risk of side effects from the parsed expression.
In this case, we generate the parsed strings ourselves, so it's very unlikely
to have anything unexpected in the expressions. But let's do the correct thing
anyway.

4 years agoMerge pull request #21225 from medhefgo/boot-cleanup
Zbigniew Jędrzejewski-Szmek [Fri, 5 Nov 2021 13:53:47 +0000 (14:53 +0100)] 
Merge pull request #21225 from medhefgo/boot-cleanup

Boot cleanup

4 years agobasic/mountpoint-util: detect erofs as a read-only FS
Luca Boccassi [Thu, 4 Nov 2021 20:29:43 +0000 (20:29 +0000)] 
basic/mountpoint-util: detect erofs as a read-only FS

4 years agoloop-util: reopen device node if we shortcut loop device creation
Lennart Poettering [Thu, 4 Nov 2021 14:01:33 +0000 (15:01 +0100)] 
loop-util: reopen device node if we shortcut loop device creation

The LoopDevice object supports a shortcut: if the backing fd we are
supposed to create a loopback device of refers to a
block device alrady then we'll use it as is – if we can – instead of
setting up an unnecessary loopback device that would be pretty much
the same as its backing device.

Previously, when doing this we'd just dup() the original backing fd and
use that. But that's problematic in case O_DIRECT was set on the fd,
since we'll keep that flag set on our copy too, which means we can't do
simple, regular IO on it anymore.

Thus, let's reopen the inode in this case with the exact access flags
we'd apply if we'd actually allocate and open a new loopback device.

Fixes: #21176
4 years agoanalyze: fix typos in test policy
Luca Boccassi [Thu, 4 Nov 2021 19:22:28 +0000 (19:22 +0000)] 
analyze: fix typos in test policy

4 years agoMerge pull request #21229 from keszybz/improve-m-hint
Luca Boccassi [Thu, 4 Nov 2021 18:40:26 +0000 (18:40 +0000)] 
Merge pull request #21229 from keszybz/improve-m-hint

Improve hint to use -M in various tools

4 years agosd-boot: Fix efi_arch checks 21225/head
Jan Janssen [Tue, 2 Nov 2021 09:47:41 +0000 (10:47 +0100)] 
sd-boot: Fix efi_arch checks

efi_arch is set to whatever meson returns from host_machine.cpu_family() and
gnu_efi_arch is then set accordingly.

On x86, efi_arch == x86 and gnu_efi_arch == ia32. Surprisingly, compilation
worked (without disabling some instruction sets) and nobody ever complained
about systemd-bootia32.efi not working.

4 years agosd-boot: Detect supported compile args
Jan Janssen [Tue, 2 Nov 2021 09:21:19 +0000 (10:21 +0100)] 
sd-boot: Detect supported compile args

This brings the final list of compiler arguments more in line with
how meson does things. In particular, --buildtype=plain will not
add any optimizations on its own (and would have to be provided
through CFLAGS=).

4 years agosd-boot: Add some link flags
Jan Janssen [Mon, 1 Nov 2021 09:36:12 +0000 (10:36 +0100)] 
sd-boot: Add some link flags

These flags are used by gnu-efi. Adding --no-undefined even allows
us to drop the no-undefined-symbols.sh test in favor of immediate
compile time errors.

4 years agosd-stub: Fix possible memory leak
Jan Janssen [Tue, 26 Oct 2021 10:39:16 +0000 (12:39 +0200)] 
sd-stub: Fix possible memory leak

4 years agosd-boot: Check for existence of required pe sections
Jan Janssen [Tue, 26 Oct 2021 10:33:43 +0000 (12:33 +0200)] 
sd-boot: Check for existence of required pe sections

4 years agosd-boot: Move optional header verification into verify_pe
Jan Janssen [Tue, 26 Oct 2021 10:25:41 +0000 (12:25 +0200)] 
sd-boot: Move optional header verification into verify_pe

4 years agosd-boot: Use FLAGS_SET
Jan Janssen [Tue, 26 Oct 2021 10:17:31 +0000 (12:17 +0200)] 
sd-boot: Use FLAGS_SET

4 years agosd-boot: Move flags helpers to macro-fundamental.h
Jan Janssen [Tue, 26 Oct 2021 09:07:39 +0000 (11:07 +0200)] 
sd-boot: Move flags helpers to macro-fundamental.h

4 years agosd-boot: Always compile with -ffreestanding and -fshort-wchar
Jan Janssen [Tue, 26 Oct 2021 08:56:17 +0000 (10:56 +0200)] 
sd-boot: Always compile with -ffreestanding and -fshort-wchar

This is not a hosted environment and we should not pretend otherwise
if -ffreestanding is not supported.

With EFI strings being in UCS2, it is not supported to build without
-fshort-wchar as gcc/clang default to a w_char_t size of 4 bytes.

This also makes the charset for wide chars explicit on gcc. This way
we get a nice error message if anyone ever tries to add 💩 to strings.

4 years agosd-boot: Save and restore console attributes
Jan Janssen [Tue, 26 Oct 2021 07:56:32 +0000 (09:56 +0200)] 
sd-boot: Save and restore console attributes

This also only writes the message on a new line if we aren't at the
beginning of one already.

4 years agoMerge pull request #21070 from medhefgo/boot-save
Lennart Poettering [Thu, 4 Nov 2021 16:37:12 +0000 (17:37 +0100)] 
Merge pull request #21070 from medhefgo/boot-save

sd-boot: Add support to boot last select entry

4 years agoMerge pull request #21030 from DaanDeMeyer/path-skipped
Lennart Poettering [Thu, 4 Nov 2021 14:20:00 +0000 (15:20 +0100)] 
Merge pull request #21030 from DaanDeMeyer/path-skipped

core: Propagate condition failed state from service to path unit.

4 years agoupdate-helper: add missing loop over user units
Zbigniew Jędrzejewski-Szmek [Thu, 4 Nov 2021 08:49:18 +0000 (09:49 +0100)] 
update-helper: add missing loop over user units

Noticed by Luca.

shellcheck doens't catch this, and somehow it was missed in review
and testing ;(

4 years agotree-wide: do not print hint about -M if -M is already used 21229/head
Zbigniew Jędrzejewski-Szmek [Thu, 4 Nov 2021 09:41:47 +0000 (10:41 +0100)] 
tree-wide: do not print hint about -M if -M is already used

(Or when -H is used, since -H and -M are incompatible.)

Note that the slightly unusual form with separate boolean variables (hint_vars,
hint_addr) instead of e.g. a const char* variable to hold the message, because this
way we don't trigger the warning about non-literal format.

4 years agobusctl: do not print hint about -M if -M is already used
Zbigniew Jędrzejewski-Szmek [Thu, 4 Nov 2021 09:41:47 +0000 (10:41 +0100)] 
busctl: do not print hint about -M if -M is already used

(Or when -H is used, since -H and -M are incompatible.)

4 years agoshared/bus-util: make bus_log_*_error() functions functions
Zbigniew Jędrzejewski-Szmek [Thu, 4 Nov 2021 09:37:11 +0000 (10:37 +0100)] 
shared/bus-util: make bus_log_*_error() functions functions

They were defined as macros, but they are a bit too complicated for this,
so it's getting unwieldy. We can make them functions without any loss.

4 years agotree-wide: always use TAKE_FD() when calling rearrange_stdio()
Lennart Poettering [Tue, 2 Nov 2021 14:50:55 +0000 (15:50 +0100)] 
tree-wide: always use TAKE_FD() when calling rearrange_stdio()

rearrange_stdio() invalidates specified fds even on failure, which means
we should always invalidate the fds we pass in no matter what. Let's
make this explicit by using TAKE_FD() for that everywhere.

Note that in many places we such invalidation doesnt get us much
behaviour-wise, since we don't use the variables anymore later. But
TAKE_FD() in a way is also documentation, it encodes explicitly that the
fds are invalidated here, so I think it's a good thing to always make
this explicit here.

4 years agocore: Propagate condition failed state to triggering units. 21030/head
Daan De Meyer [Mon, 18 Oct 2021 12:17:02 +0000 (14:17 +0200)] 
core: Propagate condition failed state to triggering units.

Alternative to https://github.com/systemd/systemd/pull/20531.

Whenever a service triggered by another unit fails condition checks,
stop the triggering unit to prevent systemd busy looping trying to
start the triggered unit.

4 years agoMerge pull request #21217 from keszybz/debug-test-process-util
Yu Watanabe [Wed, 3 Nov 2021 19:03:56 +0000 (04:03 +0900)] 
Merge pull request #21217 from keszybz/debug-test-process-util

procfs-util: fix confusion wrt. quantity limit and maximum value

4 years agoMerge pull request #21216 from poettering/take-fd-tweak
Yu Watanabe [Wed, 3 Nov 2021 19:01:45 +0000 (04:01 +0900)] 
Merge pull request #21216 from poettering/take-fd-tweak

fd-util: make TAKE_FD free of double evaluation

4 years agomacro: make TAKE_PTR() side-effect free 21216/head
Lennart Poettering [Wed, 3 Nov 2021 14:56:34 +0000 (15:56 +0100)] 
macro: make TAKE_PTR() side-effect free

4 years agotree-wide: port more code to sigkill_wait()
Lennart Poettering [Wed, 3 Nov 2021 15:35:44 +0000 (16:35 +0100)] 
tree-wide: port more code to sigkill_wait()

4 years agotree-wide: port various places to use TAKE_PID()
Lennart Poettering [Wed, 3 Nov 2021 14:56:09 +0000 (15:56 +0100)] 
tree-wide: port various places to use TAKE_PID()

4 years agoprocess-util: rework TAKE_PID() to be side-effect free
Lennart Poettering [Wed, 3 Nov 2021 14:55:14 +0000 (15:55 +0100)] 
process-util: rework TAKE_PID() to be side-effect free

4 years agoprocess-util: wait for processes we killed even if killing failed
Lennart Poettering [Wed, 3 Nov 2021 14:54:28 +0000 (15:54 +0100)] 
process-util: wait for processes we killed even if killing failed

The processes might be zombies in which case killing will fail, but
reaping them still matters.

4 years agotest: add test that ensures TAKE_FD() works as it should
Lennart Poettering [Wed, 3 Nov 2021 14:56:48 +0000 (15:56 +0100)] 
test: add test that ensures TAKE_FD() works as it should

4 years agoMake pager_open() return void 20138/head
Zbigniew Jędrzejewski-Szmek [Tue, 3 Aug 2021 14:59:09 +0000 (16:59 +0200)] 
Make pager_open() return void

4 years agofd-util: make TAKE_FD free of double evaluation
Lennart Poettering [Tue, 2 Nov 2021 16:52:24 +0000 (17:52 +0100)] 
fd-util: make TAKE_FD free of double evaluation

Better be safe than sorry.

4 years agomanager: fix confusion when to send READY=1
Zbigniew Jędrzejewski-Szmek [Wed, 3 Nov 2021 10:22:28 +0000 (11:22 +0100)] 
manager: fix confusion when to send READY=1

I got the logic reversed in 6d9326595592f98e8126eacb4176acd8c3516d5c.
Let's just remove the conditionalization of the status message: if we're
sending something, we might just as well always attach READY=1, the extra
few bytes don't make much of a difference.

FWIW, it seems that this bug didn't cause problems, probably because we'd send
READY=1 either from user_manager_send_ready() or from a later call to
manager_send_ready().

4 years agotree-wide: drop "f" from sd_notify() calls with a static string
Zbigniew Jędrzejewski-Szmek [Wed, 3 Nov 2021 10:12:25 +0000 (11:12 +0100)] 
tree-wide: drop "f" from sd_notify() calls with a static string

If we don't need to do any formatting, let's optimize things a bit.

4 years agojournald: modernize code to send notifications
Zbigniew Jędrzejewski-Szmek [Wed, 3 Nov 2021 10:05:23 +0000 (11:05 +0100)] 
journald: modernize code to send notifications

No change except making things a bit less verbose.

4 years agotree-wide: warn when sd_notify fails with READY=1 or FDSTOREREMOVE=1
Zbigniew Jędrzejewski-Szmek [Wed, 3 Nov 2021 10:04:46 +0000 (11:04 +0100)] 
tree-wide: warn when sd_notify fails with READY=1 or FDSTOREREMOVE=1

Most sd_notify() calls are like log_info() — the result is only informative
and if they fail, it's best ignore this. But if a call with READY=1 fails,
the unit may enter a failed state, so we should warn about this. Similarly
for FSTOREREMOVE=1: the manager may be left with a stale fd, at least wasting
resources.

4 years agoCODING_STYLE: allow joined variable declarations and function calls
Zbigniew Jędrzejewski-Szmek [Tue, 6 Jul 2021 11:44:51 +0000 (13:44 +0200)] 
CODING_STYLE: allow joined variable declarations and function calls

… but only for a single variable.

The guidelines already allowed declaring variables at the point of
initialization. But not making a function call to do that. Let's allow that
now.  The existing style of declaring and initializing seperate is still
allowed, and whatever makes most sense should be used.

4 years agotest-process-util: also add EROFS to the list of "good" errors 21217/head
Zbigniew Jędrzejewski-Szmek [Wed, 3 Nov 2021 08:39:16 +0000 (09:39 +0100)] 
test-process-util: also add EROFS to the list of "good" errors

It is only added in the one place where we actually try to set the
setting to a new value. Before we were testing if we can set to it the
existing value, which was a noop. We could still get a permission error,
but this is the first place where we would propagate EROFS.

4 years agoprocfs-util: fix confusion wrt. quantity limit and maximum value
Zbigniew Jędrzejewski-Szmek [Tue, 2 Nov 2021 17:18:21 +0000 (18:18 +0100)] 
procfs-util: fix confusion wrt. quantity limit and maximum value

From packit/rawhide-arm64 logs:
Assertion 'limit >= INT_MAX || get_process_ppid(limit+1, NULL) == -ESRCH' failed at src/test/test-process-util.c:855, function test_get_process_ppid(). Aborting.
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

The kernel has a few different limits. In particular kernel.threads-max can be
set to some lower value, and kernel.pid_max can be set to a higher value. This
is nice because it reduces PID reuse, even if the number of threads that is
allowed is limited. But the tests assumed that we cannot have a thread with
PID above MIN(kernel.threads-max, kernel.pid_max-1), which is not valid.

So let's rework the whole thing: let's expose the helpers to read
kernel.threads-max and kernel.pid_max, and print what they return in tests.
procfs_tasks_get_limit() was something that is only used in tests, and wasn't
very well defined, so let's drop it.

Fixes #21193.

4 years agoMerge pull request #21210 from yuwata/network-dhcp-server-introduce-router-setting
Yu Watanabe [Wed, 3 Nov 2021 03:41:34 +0000 (12:41 +0900)] 
Merge pull request #21210 from yuwata/network-dhcp-server-introduce-router-setting

network: dhcp-server: introduce Router= setting to specify router address

4 years agopercent-util: clamp percent range before converting to 2^32 scale
Lennart Poettering [Fri, 29 Oct 2021 12:33:37 +0000 (14:33 +0200)] 
percent-util: clamp percent range before converting to 2^32 scale

Let#s better be safe than sorry and clamp the input, so that we don't
hit overflow issues.

4 years agomissing: add missing header inclusions
Lennart Poettering [Tue, 2 Nov 2021 17:15:32 +0000 (18:15 +0100)] 
missing: add missing header inclusions

These headers should work without any manual header inclusion.

4 years agotest-network: add a testcase for Router= setting 21210/head
Yu Watanabe [Tue, 2 Nov 2021 04:06:48 +0000 (13:06 +0900)] 
test-network: add a testcase for Router= setting

4 years agonetwork: dhcp-server: introduce Router= setting to specify router address
Yu Watanabe [Tue, 2 Nov 2021 03:58:50 +0000 (12:58 +0900)] 
network: dhcp-server: introduce Router= setting to specify router address

Closes #21202.

4 years agotest-keymap-util: always use kbd-model-map we ship
Franck Bui [Wed, 19 May 2021 12:14:58 +0000 (14:14 +0200)] 
test-keymap-util: always use kbd-model-map we ship

This test makes assumptions on the availability of some mappings contained in
kbd-model-map and therefore strongly relies on the version shipped by
upstream. IOW the test is likely to fail if it's installed on a system with a
more comprehensive kbd-model-map.

This patch makes the upstream kbd-model-map file available via a symlink in
test/testdata/test-keymap-util dir and makes sure that this specific version is
always used by test-keymap-util regardless of whether the test is installed and
run on a different system or directly run (optionally via meson) from the
project working dir.

4 years agoman: document cryptenroll limitations
Lennart Poettering [Tue, 2 Nov 2021 12:37:27 +0000 (13:37 +0100)] 
man: document cryptenroll limitations

Let's document this for now. We should be able to lift these limitations
sooner or later, at which point we can drop this documentation again.

These two limitations are a pitfall that people should be aware of,
before going FIDO2-only.

See: #20230 #19208

4 years agoMerge pull request #21207 from mrc0mmand/test-tweak-lvm-installation
Frantisek Sumsal [Tue, 2 Nov 2021 14:09:57 +0000 (14:09 +0000)] 
Merge pull request #21207 from mrc0mmand/test-tweak-lvm-installation

test: support the new lvm udev autoactivation

4 years agotest: support both lvm vgroup activation methods 21207/head
Frantisek Sumsal [Mon, 1 Nov 2021 22:03:26 +0000 (23:03 +0100)] 
test: support both lvm vgroup activation methods

4 years agoMerge pull request #21209 from yuwata/veth-peer-mtu
Daan De Meyer [Tue, 2 Nov 2021 09:58:39 +0000 (09:58 +0000)] 
Merge pull request #21209 from yuwata/veth-peer-mtu

network: also set MTU for veth peer interface

4 years agotest-network: add test case for MTUBytes= for veth 21209/head
Yu Watanabe [Tue, 2 Nov 2021 03:35:07 +0000 (12:35 +0900)] 
test-network: add test case for MTUBytes= for veth

4 years agonetwork/veth: also set MTU for peer interface
Yu Watanabe [Tue, 2 Nov 2021 03:25:12 +0000 (12:25 +0900)] 
network/veth: also set MTU for peer interface

Fixes #21206.

4 years agotest: support the new lvm udev autoactivation
Frantisek Sumsal [Mon, 1 Nov 2021 19:55:38 +0000 (20:55 +0100)] 
test: support the new lvm udev autoactivation

Introduced in lvm 2.03.14.
See: https://sourceware.org/git/?p=lvm2.git;a=commit;h=67722b312390cdab29c076c912e14bd739c5c0f6

4 years agoMerge pull request #21204 from yuwata/sd-dhcp6-client-cleanups
Yu Watanabe [Mon, 1 Nov 2021 18:11:02 +0000 (03:11 +0900)] 
Merge pull request #21204 from yuwata/sd-dhcp6-client-cleanups

sd-dhcp6-client: further cleanups

4 years agosd-dhcp6-client: simplify code a bit 21204/head
Yu Watanabe [Mon, 1 Nov 2021 13:50:55 +0000 (22:50 +0900)] 
sd-dhcp6-client: simplify code a bit

Also this adds a note.

4 years agosd-dhcp6-client: do not implicitly cast to boolean
Yu Watanabe [Mon, 1 Nov 2021 13:37:26 +0000 (22:37 +0900)] 
sd-dhcp6-client: do not implicitly cast to boolean

4 years agosd-dhcp6-client: introduce dhcp6_lease_{get,set}_clientid()
Yu Watanabe [Mon, 1 Nov 2021 05:19:16 +0000 (14:19 +0900)] 
sd-dhcp6-client: introduce dhcp6_lease_{get,set}_clientid()

4 years agosd-dhcp6-client: shorten code a bit
Yu Watanabe [Mon, 1 Nov 2021 05:10:35 +0000 (14:10 +0900)] 
sd-dhcp6-client: shorten code a bit

4 years agosd-dhcp6-client: prefix variables which store results with "ret_"
Yu Watanabe [Mon, 1 Nov 2021 05:04:34 +0000 (14:04 +0900)] 
sd-dhcp6-client: prefix variables which store results with "ret_"

4 years agosd-dhcp6-client: update log messages
Yu Watanabe [Mon, 1 Nov 2021 04:57:11 +0000 (13:57 +0900)] 
sd-dhcp6-client: update log messages

4 years agoMerge pull request #21200 from yuwata/sd-dhcp6-client-server-address
Yu Watanabe [Mon, 1 Nov 2021 12:04:48 +0000 (21:04 +0900)] 
Merge pull request #21200 from yuwata/sd-dhcp6-client-server-address

sd-dhcp6-client: introduce sd_dhcp6_lease_get_server_address()

4 years agoMerge pull request #21199 from yuwata/sd-dhcp6-client-trivial-cleanups
Yu Watanabe [Mon, 1 Nov 2021 12:04:05 +0000 (21:04 +0900)] 
Merge pull request #21199 from yuwata/sd-dhcp6-client-trivial-cleanups

sd-dhcp6-client: trivial cleanups

4 years agonetwork: save server address to DHCPv6 addresses 21200/head
Yu Watanabe [Mon, 1 Nov 2021 01:35:43 +0000 (10:35 +0900)] 
network: save server address to DHCPv6 addresses

The server address will be used in later commits.

4 years agosd-dhcp6-client: introduce sd_dhcp6_lease_get_server_address()
Yu Watanabe [Mon, 1 Nov 2021 01:31:31 +0000 (10:31 +0900)] 
sd-dhcp6-client: introduce sd_dhcp6_lease_get_server_address()

4 years agosd-lldp-tx: drop unused and useless function
Yu Watanabe [Mon, 1 Nov 2021 00:34:41 +0000 (09:34 +0900)] 
sd-lldp-tx: drop unused and useless function

sd-lldp-tx does not call any callback function. So, the function is
mostly useless.

4 years agosd-dhcp6: drop unused functions
Yu Watanabe [Mon, 1 Nov 2021 00:45:29 +0000 (09:45 +0900)] 
sd-dhcp6: drop unused functions

4 years agocore: ignore failure on setting smack process label when allowed
Yu Watanabe [Mon, 1 Nov 2021 04:48:32 +0000 (13:48 +0900)] 
core: ignore failure on setting smack process label when allowed