]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agodissect-image: drop unnecessary duplication of partition device node 24571/head
Yu Watanabe [Tue, 6 Sep 2022 01:50:19 +0000 (10:50 +0900)] 
dissect-image: drop unnecessary duplication of partition device node

3 years agodissect-image: reuse LoopDevice.node in dissect_image()
Yu Watanabe [Tue, 6 Sep 2022 13:43:47 +0000 (22:43 +0900)] 
dissect-image: reuse LoopDevice.node in dissect_image()

Currently, dissect_image() is only called through dissect_loop_device(),
and the LoopDevice object has device name. Hence, it is not necessary to
get device name in dissect_image().

3 years agodissect-image: drop currently unused arguments
Yu Watanabe [Tue, 6 Sep 2022 13:39:31 +0000 (22:39 +0900)] 
dissect-image: drop currently unused arguments

3 years agodissect-image: drop currently unused code
Yu Watanabe [Tue, 6 Sep 2022 13:50:33 +0000 (22:50 +0900)] 
dissect-image: drop currently unused code

Currently, dissect_image() is called only through dissect_loop_device(),
and image_path is always specified. Let's drop it.

3 years agodissect-image: use loop backing file or device node as name of the image
Yu Watanabe [Tue, 6 Sep 2022 01:58:26 +0000 (10:58 +0900)] 
dissect-image: use loop backing file or device node as name of the image

Note, currently, for each call of dissect_loop_device_and_warn(), the
specified name is equivalent to the path passed to loop_device_make_by_path().
Hence, this should not change the current behavios.

3 years agogpt-auto: use LoopDevice object to manage whole block disk
Yu Watanabe [Tue, 6 Sep 2022 01:25:56 +0000 (10:25 +0900)] 
gpt-auto: use LoopDevice object to manage whole block disk

3 years agodissect-image: use backing_file stored in LoopDevice object to generate image name
Yu Watanabe [Mon, 5 Sep 2022 20:37:13 +0000 (05:37 +0900)] 
dissect-image: use backing_file stored in LoopDevice object to generate image name

Follow-up for e374439f4b8def786031ddbbd7dfdae3a335d4d2 (#24322).

This also simplify the logic of generating image name from image path.

3 years agoloop-util: save backing file of loopback block device
Yu Watanabe [Mon, 5 Sep 2022 20:19:46 +0000 (05:19 +0900)] 
loop-util: save backing file of loopback block device

It will be used in later commits.

3 years agoloop-util: move device_has_block_children() to blockdev-util.c
Yu Watanabe [Mon, 5 Sep 2022 20:01:34 +0000 (05:01 +0900)] 
loop-util: move device_has_block_children() to blockdev-util.c

As the function is not only for loopback block device.

No actual code changes, just refactoring.

3 years agoblockdev-util: check if provided sd_device is for a whole block device
Yu Watanabe [Mon, 5 Sep 2022 20:00:49 +0000 (05:00 +0900)] 
blockdev-util: check if provided sd_device is for a whole block device

And split out partition_generator_new(), to make it usable in other
functions.

3 years agoblockdev-util: make block_device_remove_all_partitions() take sd_device object
Yu Watanabe [Mon, 5 Sep 2022 19:46:04 +0000 (04:46 +0900)] 
blockdev-util: make block_device_remove_all_partitions() take sd_device object

Then, it is not necessary to recreate sd_device object when we already
have.

3 years agoloop-util: store sd_device object for the loop device
Yu Watanabe [Mon, 5 Sep 2022 19:35:54 +0000 (04:35 +0900)] 
loop-util: store sd_device object for the loop device

It will be used in later commits.

3 years agoMerge pull request #24520 from yuwata/udevadm-wait-listen-kernel-uevents
Yu Watanabe [Mon, 5 Sep 2022 23:33:27 +0000 (08:33 +0900)] 
Merge pull request #24520 from yuwata/udevadm-wait-listen-kernel-uevents

udevadm-wait: also listen kernel uevents

3 years agotest: kill plymouthd after initrd transition if it's still running
Frantisek Sumsal [Mon, 5 Sep 2022 19:02:25 +0000 (21:02 +0200)] 
test: kill plymouthd after initrd transition if it's still running

Until now using the INTERACTIVE_DEBUG=yes stuff together with sanitizers
was almost impossible, since the console kept eating up our inputs or
not responding at all. After a painful day of debugging I noticed that
if we use a shell script in the initrd -> root transition, we might end up
with a plymouthd still running, which kept screwing with the tty.

E.g. with initrd -> wrapper -> systemd transition, where the `wrapper`
is a simple script:

```
exec -- /usr/lib/systemd/systemd "$@"
```

we'd end up with a stray plymouthd process after the bootup:

```
 1     0     440       2  20   0      0     0 worker I    ?          0:00 [kworker/5:2-ata_sff]
 1     0     453       2  20   0      0     0 worker I    ?          0:00 [kworker/9:2-rcu_gp]
 5     0     456       1  20   0   7252  1960 do_epo S    ?          0:00 @usr/sbin/plymouthd --mode=boot --pid-file=/run/plymouth/pid --attach-to-session
```

After killing it, the tty works finally as expected.

3 years agoudevadm-wait: shorten code a bit 24520/head
Yu Watanabe [Fri, 2 Sep 2022 17:09:06 +0000 (02:09 +0900)] 
udevadm-wait: shorten code a bit

3 years agoudevadm-wait: wait for two periodic timer triggered before exit
Yu Watanabe [Fri, 2 Sep 2022 17:05:30 +0000 (02:05 +0900)] 
udevadm-wait: wait for two periodic timer triggered before exit

3 years agoudevadm-wait: also listen kernel uevent stream if --initialized=no
Yu Watanabe [Wed, 31 Aug 2022 15:32:27 +0000 (00:32 +0900)] 
udevadm-wait: also listen kernel uevent stream if --initialized=no

Suggested at https://github.com/systemd/systemd/pull/24471#discussion_r959703103.

3 years agohwdb: Add accel orientation quirk for the Aya Neo Air
Maccraft123 [Tue, 30 Aug 2022 19:16:17 +0000 (21:16 +0200)] 
hwdb: Add accel orientation quirk for the Aya Neo Air

3 years agoUse original filename for extension name check
Kai Lueke [Mon, 15 Aug 2022 15:47:03 +0000 (17:47 +0200)] 
Use original filename for extension name check

The loading of an extension image from a symlink "NAME.raw" to
"NAME-VERSION.raw" failed because the release file name check worked
with the backing file of the loop device which already resolves the
symlink and thus the found name "NAME-VERSION" mismatched "NAME".
Pass the original filename and use it instead of the backing file
when available. This fixes the loading of "NAME.raw" extensions which
are a symlink to "NAME-VERSION.raw" as, e.g., may be the case when
systemd-sysupdate manages multiple versions.

Fixes https://github.com/systemd/systemd/issues/24293

3 years agoMerge pull request #24467 from qdeslandes/nspawn_rootidmap
Yu Watanabe [Mon, 5 Sep 2022 18:45:53 +0000 (03:45 +0900)] 
Merge pull request #24467 from qdeslandes/nspawn_rootidmap

nspawn: add rootidmap as --bind option

3 years agoMerge pull request #24568 from poettering/atou16-atou-rework
Yu Watanabe [Mon, 5 Sep 2022 18:38:41 +0000 (03:38 +0900)] 
Merge pull request #24568 from poettering/atou16-atou-rework

parse-util: simplify safe_atou8() + safe_atou16()

3 years agoudev/rules,hwdb: filter out mostly meaningless default strings
Yu Watanabe [Thu, 25 Aug 2022 19:13:26 +0000 (04:13 +0900)] 
udev/rules,hwdb: filter out mostly meaningless default strings

The filter is generated based on the following results:
---
git clone git@github.com:linuxhw/DMI.git
cd DMI
git grep -h -A2 '^System Information$' | grep 'Manufacturer' | sort | uniq -c | sort -nr | less
git grep -h -A2 '^System Information$' | grep 'Product Name' | sort | uniq -c | sort -nr | less
---

Closes #24446.

3 years agoMerge pull request #24566 from mrc0mmand/TEST-75-fix
Frantisek Sumsal [Mon, 5 Sep 2022 17:48:24 +0000 (17:48 +0000)] 
Merge pull request #24566 from mrc0mmand/TEST-75-fix

test: mark knot.conf tmpfiles config as optional

3 years agoMerge pull request #24567 from poettering/homed-wait-timeout
Zbigniew Jędrzejewski-Szmek [Mon, 5 Sep 2022 16:30:26 +0000 (18:30 +0200)] 
Merge pull request #24567 from poettering/homed-wait-timeout

homed: don't wait for workers without time limit

3 years agonspawn: add support for rootidmap bind option 24467/head
Quentin Deslandes [Sun, 4 Sep 2022 18:30:58 +0000 (20:30 +0200)] 
nspawn: add support for rootidmap bind option

rootidmap bind option will map the root user from the container to the
owner of the mounted directory on the filesystem. This will ensure files
and directories created by the root user in the container will be owned
by the directory owner on the filesystem. All other user will remain
unmapped.

3 years agoparse-util: make safe_atou8() just a wrapper around safe_atou8_full() 24568/head
Lennart Poettering [Mon, 5 Sep 2022 16:08:16 +0000 (18:08 +0200)] 
parse-util: make safe_atou8() just a wrapper around safe_atou8_full()

As in the previous commit: it's just a wrapper around the same
strtoul(), hence let's just share some more code.

3 years agoparse-util: make safe_atou16_full() just a wrapper around safe_atou_full()
Lennart Poettering [Mon, 5 Sep 2022 15:59:52 +0000 (17:59 +0200)] 
parse-util: make safe_atou16_full() just a wrapper around safe_atou_full()

Both are fancy wrappers around strtoul() anyway, not more, hence let's
just make them a wrapper around each other, too, to simplify things a
lot.

3 years agotest: zone-set requires TTL for the first record in the rrset 24566/head
Frantisek Sumsal [Mon, 5 Sep 2022 15:28:04 +0000 (17:28 +0200)] 
test: zone-set requires TTL for the first record in the rrset

I'm not sure why this worked previously.

3 years agotest: mark knot.conf tmpfiles config as optional
Frantisek Sumsal [Mon, 5 Sep 2022 11:54:22 +0000 (13:54 +0200)] 
test: mark knot.conf tmpfiles config as optional

Since it got removed in the recent knot release.

See: https://github.com/CZ-NIC/knot/commit/a6971a4025133a77b29f6d2b381b40dc0499730c

3 years agoMerge pull request #24404 from thatguystone/socket-jobs
Lennart Poettering [Mon, 5 Sep 2022 15:20:50 +0000 (17:20 +0200)] 
Merge pull request #24404 from thatguystone/socket-jobs

job: Don't discard propagated restart jobs when unit is activating

3 years agonspawn: rename RemountIdmapFlags enum to RemountIdmapping
Quentin Deslandes [Mon, 5 Sep 2022 14:42:48 +0000 (15:42 +0100)] 
nspawn: rename RemountIdmapFlags enum to RemountIdmapping

This enum should be used to define various idmapping modes for bind
mounts which might be incompatible. Changing its name and the values
name to reflect that.

3 years agorepart: Add support for setting a partition's UUID to zero
Daan De Meyer [Sun, 4 Sep 2022 16:53:25 +0000 (18:53 +0200)] 
repart: Add support for setting a partition's UUID to zero

This is useful when we need to fill in the UUID later, such as when
using verity partitions.

3 years agounits: prolong the stop timeout for homed 24567/head
Lennart Poettering [Mon, 5 Sep 2022 13:15:36 +0000 (15:15 +0200)] 
units: prolong the stop timeout for homed

Let's give IO/resizing/… more time then usual.

Fixes: #22901
3 years agohomed: don't wait indefinitely for workers on exit
Lennart Poettering [Mon, 5 Sep 2022 13:14:11 +0000 (15:14 +0200)] 
homed: don't wait indefinitely for workers on exit

Let's put some time-limit on it.

Fixes: #22901
3 years agoMerge pull request #24561 from yuwata/loop-util-follow-ups
Daan De Meyer [Mon, 5 Sep 2022 09:21:29 +0000 (11:21 +0200)] 
Merge pull request #24561 from yuwata/loop-util-follow-ups

loop-util: several follow ups for recent changes

3 years agoloop-util: lock_fd must be closed before calling LOOP_CLR_FD 24561/head
Yu Watanabe [Sun, 4 Sep 2022 18:04:07 +0000 (03:04 +0900)] 
loop-util: lock_fd must be closed before calling LOOP_CLR_FD

Follow-up for 7f52206a2bc128f9ae8306db43aa6e2f7d916f82.

C.f. 87862cc2b4abb9564f7e0365ac515dc9020a54e4.

3 years agoloop-util: drop unnecessary initializations
Yu Watanabe [Sun, 4 Sep 2022 17:57:49 +0000 (02:57 +0900)] 
loop-util: drop unnecessary initializations

3 years agoloop-util: use loop_device_open_full() when whole block device is passed to loop_devi...
Yu Watanabe [Sun, 4 Sep 2022 17:57:29 +0000 (02:57 +0900)] 
loop-util: use loop_device_open_full() when whole block device is passed to loop_device_make()

This also fixes a leak of lock_fd, which introduced by
7f52206a2bc128f9ae8306db43aa6e2f7d916f82, when fd is for a block device,
and size or offset is non-zero.

Fixes another issue in #24147.

3 years agoloop-util: introduce loop_device_open_full()
Yu Watanabe [Sun, 4 Sep 2022 17:48:01 +0000 (02:48 +0900)] 
loop-util: introduce loop_device_open_full()

3 years agoloop-util: fix LoopDevice.devno assigned by loop_device_open()
Yu Watanabe [Sun, 4 Sep 2022 17:39:16 +0000 (02:39 +0900)] 
loop-util: fix LoopDevice.devno assigned by loop_device_open()

3 years agoloop-util: also set LoopDevice.diskseq when created with loop_device_open()
Yu Watanabe [Sun, 4 Sep 2022 17:05:52 +0000 (02:05 +0900)] 
loop-util: also set LoopDevice.diskseq when created with loop_device_open()

3 years agomount-util: fix error code
Yu Watanabe [Sun, 4 Sep 2022 13:34:38 +0000 (22:34 +0900)] 
mount-util: fix error code

If multiple service is starting simultaneously with a shared image,
then one of the service may fail to create a mount node:

systemd[695]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[696]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[695]: Failed to mount /usr/lib/os-release (type n/a) on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC ""): No such file or directory
systemd[696]: Failed to mount /usr/lib/os-release (type n/a) on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC ""): No such file or directory
systemd[695]: Bind-mounting /usr/lib/os-release on /run/systemd/unit-root/run/host/os-release (MS_BIND|MS_REC "")...
systemd[696]: Failed to create destination mount point node '/run/systemd/unit-root/run/host/os-release': Operation not permitted
systemd[695]: Successfully mounted /usr/lib/os-release to /run/systemd/unit-root/run/host/os-release

The function apply_one_mount() in src/core/namespace.c gracefully
handles -EEXIST from make_mount_point_inode_from_path(), but it erroneously
returned -EPERM previously. This fixes the issue.

Fixes one of the issues in #24147, especially reported at
https://github.com/systemd/systemd/issues/24147#issuecomment-1236194671.

3 years agoman: fix static bridge example
Jade Bilkey [Sat, 3 Sep 2022 21:37:45 +0000 (17:37 -0400)] 
man: fix static bridge example

A NetDev is needed to create the bridge in order to match the example's description "This creates a bridge..."

3 years agotest: actually set SYSTEMD_DISSECT_VERITY_TIMEOUT_SEC=30
Frantisek Sumsal [Sat, 3 Sep 2022 16:51:56 +0000 (18:51 +0200)] 
test: actually set SYSTEMD_DISSECT_VERITY_TIMEOUT_SEC=30

Without the section header the assignments were effectively ignored.

Follow-up to 9fff8e1fdd222f8f05b9ecf170814a9059acfc78.

3 years agoMerge pull request #24550 from yuwata/bootspec
Yu Watanabe [Sat, 3 Sep 2022 18:00:22 +0000 (03:00 +0900)] 
Merge pull request #24550 from yuwata/bootspec

bootspec: do not build too many json object at once

3 years agotest: check returned values are always initialized on success 24550/head
Yu Watanabe [Sat, 3 Sep 2022 15:02:38 +0000 (00:02 +0900)] 
test: check returned values are always initialized on success

3 years agobootspec: shorten code a bit
Yu Watanabe [Sat, 3 Sep 2022 15:01:09 +0000 (00:01 +0900)] 
bootspec: shorten code a bit

3 years agofuzz: add a test case for fuzz-bootspec
Yu Watanabe [Sat, 3 Sep 2022 14:21:18 +0000 (23:21 +0900)] 
fuzz: add a test case for fuzz-bootspec

This adds a testcase for the issue oss-fuzz#50949
(https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50949).

3 years agobootspec: do not build two many json object at once
Yu Watanabe [Sat, 3 Sep 2022 13:01:16 +0000 (22:01 +0900)] 
bootspec: do not build two many json object at once

This is a workaround for an issue in the memory sanitizer.
If a function is called with too many arguments, then the sanitizer
triggers the following false-positive warning:

==349==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f8b247134a7 in json_buildv /work/build/../../src/systemd/src/shared/json.c:3213:17
    #1 0x7f8b24714231 in json_build /work/build/../../src/systemd/src/shared/json.c:4117:13
    #2 0x7f8b24487fa5 in show_boot_entries /work/build/../../src/systemd/src/shared/bootspec.c:1424:29
    #3 0x4a6a1b in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-bootspec.c:119:16
    #4 0x4c6693 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #5 0x4c5e7a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
    #6 0x4c7ce4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
    #7 0x4c7f19 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
    #8 0x4b757f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #9 0x4e0bd2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #10 0x7f8b23ead082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #11 0x41f69d in _start (build-out/fuzz-bootspec+0x41f69d)

Follow-up for #24541.
Fixes #24551.

3 years agojson: introduce json_append()
Yu Watanabe [Sat, 3 Sep 2022 14:10:24 +0000 (23:10 +0900)] 
json: introduce json_append()

3 years agoloop-util: fix memleak when fd is for a block device with non-zero offset or size
Yu Watanabe [Fri, 2 Sep 2022 20:52:45 +0000 (05:52 +0900)] 
loop-util: fix memleak when fd is for a block device with non-zero offset or size

3 years agotmpfile-util: truncate original filename if the result filename is too long
Yu Watanabe [Sun, 10 Apr 2022 22:02:52 +0000 (07:02 +0900)] 
tmpfile-util: truncate original filename if the result filename is too long

This also verify that the extra string does not contain '/'.

3 years agotest: extend ConditionFirmware tests
Daniel Braunwarth [Sat, 27 Aug 2022 08:56:03 +0000 (10:56 +0200)] 
test: extend ConditionFirmware tests

3 years agoMerge pull request #24538 from mrc0mmand/TEST-13-tweaks
Luca Boccassi [Fri, 2 Sep 2022 23:16:36 +0000 (00:16 +0100)] 
Merge pull request #24538 from mrc0mmand/TEST-13-tweaks

test: forward nspawn logs to journal

3 years agoMerge pull request #24546 from mrc0mmand/test-exec-deserialization-tweaks
Luca Boccassi [Fri, 2 Sep 2022 23:15:45 +0000 (00:15 +0100)] 
Merge pull request #24546 from mrc0mmand/test-exec-deserialization-tweaks

A couple of tweaks for test-exec-deserialization

3 years agotest: suppress not-found errors for `selinuxenabled` 24538/head
Frantisek Sumsal [Fri, 2 Sep 2022 17:39:30 +0000 (19:39 +0200)] 
test: suppress not-found errors for `selinuxenabled`

if the binary is not available.

3 years agotest: forward nspawn logs to journal
Frantisek Sumsal [Fri, 2 Sep 2022 10:43:02 +0000 (12:43 +0200)] 
test: forward nspawn logs to journal

Dumping everything to console slows the test quite considerably on
slower machines, so let's forward nspawn logs to the journal to still
have them available in case something goes south.

This should, hopefully, help with TEST-13 timeouts in Ubuntu CI and
maybe with CPU soft lockups in CentOS CI.

3 years agoMerge pull request #24541 from poettering/bootspec-tweaks
Lennart Poettering [Fri, 2 Sep 2022 19:29:31 +0000 (21:29 +0200)] 
Merge pull request #24541 from poettering/bootspec-tweaks

bootspec: slightly stricter validation + process tries-left/tries-done counters in filenames

3 years agomkosi: update to latest commit
Luca Boccassi [Fri, 2 Sep 2022 18:15:46 +0000 (19:15 +0100)] 
mkosi: update to latest commit

Required to fix Debian testing/unstable builds, as resolved is
now in its own package

3 years agotest: make pylint happy 24546/head
Frantisek Sumsal [Fri, 2 Sep 2022 18:14:53 +0000 (20:14 +0200)] 
test: make pylint happy

3 years agolog: don't attempt to duplicate closed fd
Lennart Poettering [Fri, 2 Sep 2022 16:35:03 +0000 (18:35 +0200)] 
log: don't attempt to duplicate closed fd

if the console fd is not open we shouldn#t try to move it out of the 0…2
range.

Fixes: #24535
Alternative-for: #24537

3 years agotest: check for the output file in a loop
Frantisek Sumsal [Fri, 2 Sep 2022 18:06:12 +0000 (20:06 +0200)] 
test: check for the output file in a loop

This should make the test faster on fast machines and more reliable on
slower/under-load machines, where the 4 sec sleep wasn't sometimes enough.

Spotted on C8S machines under load:

```
test_added_after (__main__.ExecutionResumeTest) ... FAIL
test_added_before (__main__.ExecutionResumeTest) ... ok
test_interleaved (__main__.ExecutionResumeTest) ... ok
test_issue_6533 (__main__.ExecutionResumeTest) ... ok
test_no_change (__main__.ExecutionResumeTest) ... ok
test_removal (__main__.ExecutionResumeTest) ... ok
test_swapped (__main__.ExecutionResumeTest) ... ok

======================================================================
FAIL: test_added_after (__main__.ExecutionResumeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test/test-exec-deserialization.py", line 101, in check_output
    with open(self.output_file, 'r') as log:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpjnec1dj4'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./test/test-exec-deserialization.py", line 150, in test_added_after
    self.check_output(expected_output)
  File "./test/test-exec-deserialization.py", line 104, in check_output
    self.fail()
AssertionError: None

----------------------------------------------------------------------
Ran 7 tests in 44.270s
```

3 years agoMerge pull request #24536 from yuwata/dissect-take-loop-device
Yu Watanabe [Fri, 2 Sep 2022 18:05:57 +0000 (03:05 +0900)] 
Merge pull request #24536 from yuwata/dissect-take-loop-device

dissect-image: introduce dissect_loop_device() which takes LoopDevice object

3 years agoudevadm-wait: move comments and condition outside of setup_periodic_timer()
Yu Watanabe [Wed, 31 Aug 2022 15:31:19 +0000 (00:31 +0900)] 
udevadm-wait: move comments and condition outside of setup_periodic_timer()

3 years agodissect-image: introduce dissect_loop_device() which takes LoopDevice object 24536/head
Yu Watanabe [Fri, 2 Sep 2022 10:09:51 +0000 (19:09 +0900)] 
dissect-image: introduce dissect_loop_device() which takes LoopDevice object

3 years agofind-esp: call the right function
Lennart Poettering [Fri, 2 Sep 2022 09:08:50 +0000 (11:08 +0200)] 
find-esp: call the right function

We want the parent dir here, let's fix that.

3 years agoupdate TODO 24541/head
Lennart Poettering [Fri, 2 Sep 2022 11:48:32 +0000 (13:48 +0200)] 
update TODO

3 years agobootspec: clarify we knowingly ignore all errors but ENOMEM
Lennart Poettering [Fri, 2 Sep 2022 11:41:59 +0000 (13:41 +0200)] 
bootspec: clarify we knowingly ignore all errors but ENOMEM

3 years agobootspec: properly parse tries done/tries left from bootspec file names
Lennart Poettering [Fri, 2 Sep 2022 11:41:09 +0000 (13:41 +0200)] 
bootspec: properly parse tries done/tries left from bootspec file names

This has been a long-time omission in the userspace parser of bootspec
files. Correct that.

Fixes: #16457
3 years agoloop-util: always set LoopDevice.node
Yu Watanabe [Fri, 2 Sep 2022 15:40:23 +0000 (00:40 +0900)] 
loop-util: always set LoopDevice.node

3 years agoloop-util: rename loopdev -> node
Yu Watanabe [Fri, 2 Sep 2022 15:39:07 +0000 (00:39 +0900)] 
loop-util: rename loopdev -> node

Preparation for the next commit. No functional change.

3 years agocore/swap: use devname_from_stat_rdev()
Yu Watanabe [Fri, 2 Sep 2022 15:35:50 +0000 (00:35 +0900)] 
core/swap: use devname_from_stat_rdev()

3 years agosd-device: introduce devname_from_stat_rdev()
Yu Watanabe [Fri, 2 Sep 2022 15:35:34 +0000 (00:35 +0900)] 
sd-device: introduce devname_from_stat_rdev()

3 years agosd-device: rename devpath_from_devnum() -> devname_from_devnum()
Yu Watanabe [Fri, 2 Sep 2022 15:28:03 +0000 (00:28 +0900)] 
sd-device: rename devpath_from_devnum() -> devname_from_devnum()

In sd-device, `devpath` is a kind of syspath without '/sys' prefix, e.g.
/devices/pci0000:00/0000:00:1c.4/0000:3c:00.0/nvme/nvme0/nvme0n1,
and `devname` is a path to the device node, e.g. /dev/nvme0n1.

Let's use the consistent name for the helper function.

3 years agobootspec: rename "id" function parameters to "fname"
Lennart Poettering [Fri, 2 Sep 2022 09:40:26 +0000 (11:40 +0200)] 
bootspec: rename "id" function parameters to "fname"

It's really the file name, so name it like that. Just some renaming.

(This is preparation for later work, to extract tries-done/tries-left
info from filenames)

3 years agobootspec: complain about loader.conf lines without parameter
Lennart Poettering [Fri, 2 Sep 2022 09:33:48 +0000 (11:33 +0200)] 
bootspec: complain about loader.conf lines without parameter

3 years agobootspec: port type1 parser to log_syntax()
Lennart Poettering [Fri, 2 Sep 2022 09:04:44 +0000 (11:04 +0200)] 
bootspec: port type1 parser to log_syntax()

3 years agobootspec: let's actually use the result of strstrip() for further parsing
Lennart Poettering [Fri, 2 Sep 2022 09:07:22 +0000 (11:07 +0200)] 
bootspec: let's actually use the result of strstrip() for further parsing

Also, given we are looking for whitespace as separators, just pass NULL
as separators, extract_first_word() defaults to whitespace after all.

3 years agobootspec: simplify paths + insist they are normalized
Lennart Poettering [Fri, 2 Sep 2022 09:04:51 +0000 (11:04 +0200)] 
bootspec: simplify paths + insist they are normalized

Inspired by #23913, let's complain if people use paths with ".."
in Type #1 bootspec entries.

Let's prefix all paths with "/" if it is missing.

Let's simplify all paths.

let's refuse paths/warn with "..".

Fixes: #23913
3 years agoMerge pull request #24491 from poettering/compare-order
Lennart Poettering [Fri, 2 Sep 2022 05:18:10 +0000 (07:18 +0200)] 
Merge pull request #24491 from poettering/compare-order

condition: unify operator parsing handling

3 years agosysusers: make sp_lstchg shadow field reproducible
Johannes Schauer Marin Rodrigues [Thu, 1 Sep 2022 09:49:19 +0000 (11:49 +0200)] 
sysusers: make sp_lstchg shadow field reproducible

If the environment variable SOURCE_DATE_EPOCH is set, use its value
instead of the current time.

3 years agoMerge pull request #24530 from poettering/loop-with-more-lock
Luca Boccassi [Thu, 1 Sep 2022 23:04:32 +0000 (00:04 +0100)] 
Merge pull request #24530 from poettering/loop-with-more-lock

a variety of loopback block device fixes

3 years agomention ConditionKernelVersion= compat break in NEWS 24491/head
Lennart Poettering [Thu, 1 Sep 2022 21:20:11 +0000 (23:20 +0200)] 
mention ConditionKernelVersion= compat break in NEWS

3 years agocondition: change operator logic to use $= instead of =$ for glob comparisons
Lennart Poettering [Mon, 29 Aug 2022 11:42:44 +0000 (13:42 +0200)] 
condition: change operator logic to use $= instead of =$ for glob comparisons

So this is a bit of a bikeshedding thing. But I think we should do this
nonetheless, before this is released.

Playing around with the glob matches I realized that "=$" is really hard
to grep for, since in shell code it's an often seen construct. Also,
when reading code I often found myself thinking first that the "$"
belongs to the rvalue instead of the operator, in a variable expansion
scheme.

If we move the $ character to the left hand, I think we are on the safer
side, since usually lvalues are much more restricted in character sets
than rvalues (at least most programming languages do enforce limits on
the character set for identifiers).

It makes it much easier to grep for the new operator, and easier to read
too. Example:

before:
    ConditionOSRelease=ID=$fedora-*
after:
    ConditionOSRelease=ID$=fedora-*

3 years agocondition: change ConditionKernelVersion= so that =/!= mean literal string comparison...
Lennart Poettering [Mon, 29 Aug 2022 11:27:11 +0000 (13:27 +0200)] 
condition: change ConditionKernelVersion= so that =/!= mean literal string comparison, and ==/<> version comparison

The only reason to do this is to ensure uniformity with the other
options, that work like this, i.e. ConditionOSRelease= or
ConditionSecurity=.

This is a compatibility break, but a minor one, given that string
comparison and version comparison is mostly the same for equality and
inequality.

3 years agocondition: allow literal string compares in SMBIOS condition
Lennart Poettering [Mon, 29 Aug 2022 09:10:38 +0000 (11:10 +0200)] 
condition: allow literal string compares in SMBIOS condition

This ensures that "=" and "!=" are now interpreted as literal string
compares, and "==" and "<>" are for version compares.

This is not a compat break, since the SMBIOS stuff has not been included
in any release yet.

Main reason to do this, is to be systematic with the other conditions
that check for text stuff.

3 years agocondition: allow fnmatch() matches in ConditionKernelVersion=
Lennart Poettering [Mon, 29 Aug 2022 09:10:18 +0000 (11:10 +0200)] 
condition: allow fnmatch() matches in ConditionKernelVersion=

This is mostly to make things systematic, and brings no new
functionality, as not specifying any operator is identical to prefixing
with =$ anyway.

3 years agocompare: add macro for operator charset
Lennart Poettering [Mon, 29 Aug 2022 09:09:48 +0000 (11:09 +0200)] 
compare: add macro for operator charset

3 years agocompare: propagate errors of fnmatch() as errors
Lennart Poettering [Mon, 29 Aug 2022 09:08:18 +0000 (11:08 +0200)] 
compare: propagate errors of fnmatch() as errors

3 years agocompare: support textual operators, and port analyze over to it
Lennart Poettering [Fri, 26 Aug 2022 15:31:34 +0000 (17:31 +0200)] 
compare: support textual operators, and port analyze over to it

3 years agocompare: add two new operators "==" and "<>"
Lennart Poettering [Fri, 26 Aug 2022 15:20:56 +0000 (17:20 +0200)] 
compare: add two new operators "==" and "<>"

These two operators always indicate ordering comparisons, as opposed to
"=" and "!=" which depending on context mean literal string compares.

This is useful for ConditionOSRelease= for example, as this means
there's now always a way to do version compares.

3 years agocompare: rework table in parse_compare_operator() to be array of structs
Lennart Poettering [Fri, 26 Aug 2022 15:08:37 +0000 (17:08 +0200)] 
compare: rework table in parse_compare_operator() to be array of structs

Let's change the lookup table to contain pairs of operator/strings,
instead of being indexed by operator.

The table isn't dense anymore, and this allows us to add alias strings
sooner or later.

3 years agocondition: allow fnmatch compares for ConditionOSRelease=
Lennart Poettering [Fri, 26 Aug 2022 14:59:47 +0000 (16:59 +0200)] 
condition: allow fnmatch compares for ConditionOSRelease=

We support this for smbios matches, hence do so for /etc/os-release
matches too.

3 years agocompare: add flag for parse_compare_operator() to do equality/inequality comparison...
Lennart Poettering [Fri, 26 Aug 2022 14:56:04 +0000 (16:56 +0200)] 
compare: add flag for parse_compare_operator() to do equality/inequality comparison via simple string compares

This allows us to switch condition_test_osrelease() to use generic
version_or_fnmatch_compare() for executing the comparison.

3 years agocompare: add a proper flags field for parse_compare_operator()
Lennart Poettering [Fri, 26 Aug 2022 14:51:12 +0000 (16:51 +0200)] 
compare: add a proper flags field for parse_compare_operator()

3 years agocompare: drop use of FNM_EXTMATCH for now
Lennart Poettering [Fri, 26 Aug 2022 14:31:30 +0000 (16:31 +0200)] 
compare: drop use of FNM_EXTMATCH for now

None of our other fnmatch() calls make use of this, and the concept was
new to me at least. Given that this is only used for the recently added
SMBIOS field matches (and is not included in any release) let's disable
"extended" matches for now. We can certainly revisit this, and enable it
later if there is real demand, but if we do, we should probably add that
all over the place, not just for smbios matches.

3 years agocomapre: add generic implementation for comapring with verscmp+fnmatch
Lennart Poettering [Fri, 26 Aug 2022 14:28:06 +0000 (16:28 +0200)] 
comapre: add generic implementation for comapring with verscmp+fnmatch

3 years agocompare: move test_order() → compare-operator.[ch]
Lennart Poettering [Fri, 26 Aug 2022 14:27:55 +0000 (16:27 +0200)] 
compare: move test_order() → compare-operator.[ch]

3 years agocondition: split out order operator enum
Lennart Poettering [Fri, 26 Aug 2022 14:10:40 +0000 (16:10 +0200)] 
condition: split out order operator enum

Let's move the operator enum into its own .c/.h file, so that we can
reuse it elsewhere, in particular systemd-analyze's compare-versions
logic.

Let's rename the concept CompareOperator, since it is nowadays
genericlaly about both order *and* fnmatch comparisons, hence just
naming it "order" is misleading.

3 years agoloop-util: make clearer how LoopDevice objects that do not encapsulate an actual... 24530/head
Lennart Poettering [Thu, 1 Sep 2022 19:34:58 +0000 (21:34 +0200)] 
loop-util: make clearer how LoopDevice objects that do not encapsulate an actual loopback device are set up