]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agorpm: restart services in %posttrans 18481/head
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 11:11:36 +0000 (12:11 +0100)] 
rpm: restart services in %posttrans

This fixes a long-standing issue in packaging scriptlets: daemon-reload
was moved to the end of the transaction, but restarting services was still
straightaway after package installation.

https://bugzilla.redhat.com/show_bug.cgi?id=1614751

Note that daemon-reload is called twice. This wouldn't be hardly noticable,
except that now a bunch of units (at least in Fedora) generate very verbose
warnings about deprecated features. So we get those warnings twice…

reload-or-restart --needing-restart is also called twice, but the second call
is usually a noop, because the first clears the flag for restarted units. The
second call is necessary for the case where we only uninstall packages, and the
%transfiletriggerpostun trigger fires, but not the %transfiletriggerin
scriptlet.

Also note that this assumes that units are marked only for restart if paths
under @systemunitdir@ or /etc/systemd/system have been touched. I would prefer
make the trigger that does 'restart --needing-restart' fire always, but it
seems rpm doesn't have such functionality. (Except as a %transfiletrigger that
would trigger on "/*" to catch all transactions, but that seems ineffiecient
and ugly.)

4 years agorpm: order sysctl/sysusers/tmpfiles execution before package scriptlets
Zbigniew Jędrzejewski-Szmek [Fri, 5 Feb 2021 16:03:43 +0000 (17:03 +0100)] 
rpm: order sysctl/sysusers/tmpfiles execution before package scriptlets

P>1000000 is *before* "normal" scriptlets, P<1000000 is *after*. I think it
makes sense to do stuff like execution of sysctl/sysusers/tmpfiles configuration
before package scriptlets. I think that was the intent, but a single digit got
dropped ;(

Also, let's reorder the scriptlets in the file to match execution order, to
make it easier to see what is going on.

Most of those may happen in any order, but there are some exceptions:
tmpfiles should be after sysusers,
udevadm --reload should be after hwdb.

4 years agorpm: simplify daemon-reload trigger
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 13:24:46 +0000 (14:24 +0100)] 
rpm: simplify daemon-reload trigger

The trigger was initially written to use %transfiletriggerun instead
of %transfiletriggerpostun because the latter would not fire. It turned
out to a buffer overread in rpm that since has been long fixed:
https://bugzilla.redhat.com/show_bug.cgi?id=1284645
https://github.com/rpm-software-management/rpm/commit/f6521c50f6836374a0f7995f8f393aaf36e178ea

4 years agorpm: sync the shell version of triggers.systemd with the lua version
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 16:56:11 +0000 (17:56 +0100)] 
rpm: sync the shell version of triggers.systemd with the lua version

Note that this goes both ways: in particular the lua version had udev
scriptlets in the wrong package, fixed in
https://src.fedoraproject.org/rpms/systemd/c/3c9433d7cf4afc8d76660402f6c3d9d991596b83.

Add missing "|| :" so the scriptlets never fail.

4 years agorpm: pull in the alternative trigger implementation in sh
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 16:30:49 +0000 (17:30 +0100)] 
rpm: pull in the alternative trigger implementation in sh

From https://src.fedoraproject.org/rpms/systemd/blob/master/f/triggers.systemd.

In 12dde791d519bc80d5cca4ab6f088763cd481015 scriptlets were converted to lua.
This is not only faster and cleaner, but also avoids a nasty dependency loop:
rpm implements the lua scripting internally, so we don't need a working shell
for the scriplets. This is nice and all, but unfortunately ostree wants to
capture scriptlets and execute them at a later time and does not support lua.
So in Fedora we ended up with a revert back to a shell-based implementation
[1]. At the time I hoped this would only be a temporary workaround, but three
years later I think it's fair to assume that this will not happen any time
soon. But carrying the upstream lua version and the downstream sh version is
error prone. So let's import the other version into our tree too so that they
can be kept in sync.

[1] https://src.fedoraproject.org/rpms/systemd/c/8e6b39457b3e2660793821e0524855226e33e306

4 years agoMove rpm stuff into a separate src/rpm/ directory
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 16:16:32 +0000 (17:16 +0100)] 
Move rpm stuff into a separate src/rpm/ directory

It is only of interest to rpm-based distros, we can move it out of src/core/
which is pretty busy.

4 years agosystemctl: add "reload-or-restart --marked"
Zbigniew Jędrzejewski-Szmek [Fri, 5 Feb 2021 12:54:33 +0000 (13:54 +0100)] 
systemctl: add "reload-or-restart --marked"

This is almost equivalent to 'busctl call-method org.freedesktop.systemd1
/org/freedesktop/systemd1 org.freedesktop.systemd1.Manager EnqueueMarkedJobs',
but waits for the jobs to finish.

4 years agosystemctl: reduce scope of iterator variables
Zbigniew Jędrzejewski-Szmek [Fri, 5 Feb 2021 10:33:48 +0000 (11:33 +0100)] 
systemctl: reduce scope of iterator variables

4 years agocore: wrap long lines
Zbigniew Jędrzejewski-Szmek [Sat, 30 Jan 2021 18:53:58 +0000 (19:53 +0100)] 
core: wrap long lines

4 years agocore: add EnqueueMarkedJobs method to reload/restart marked units
Zbigniew Jędrzejewski-Szmek [Sat, 30 Jan 2021 18:44:15 +0000 (19:44 +0100)] 
core: add EnqueueMarkedJobs method to reload/restart marked units

We support two return types for methods that start jobs. EnqueueJob support the
full-monty mode with affected jobs. I didn't do this here, since it seems
unlikely to be used. In the common case there'd be a huge list of jobs and
affected jobs. EnqueueMarkedJobs() just returns a list of jobs that we can wait
upon.

The name of the method is generic in case we decide to add something other than
just reload/restart later on.

When errors occur, resource errors are treated as fatal, but for other error
types we queue up other jobs, and only return an error at the end. The
assumption is that the caller will ignore the result error anyway, so it's
better to try to reload/restart as much as possible.

4 years agocore: allow Markers to be set using set-property
Zbigniew Jędrzejewski-Szmek [Sat, 6 Feb 2021 10:39:55 +0000 (11:39 +0100)] 
core: allow Markers to be set using set-property

4 years agocore/dbus-unit: reduce scope of iterator variables
Zbigniew Jędrzejewski-Szmek [Fri, 12 Feb 2021 09:25:13 +0000 (10:25 +0100)] 
core/dbus-unit: reduce scope of iterator variables

4 years agocore: add Unit.Markers property
Zbigniew Jędrzejewski-Szmek [Sat, 30 Jan 2021 15:58:19 +0000 (16:58 +0100)] 
core: add Unit.Markers property

The property is never set by systemd, only reset after a stop or restart or
reload. It may externally be set to mark the unit for a later restart/reload.

I wasn't sure whether to configure the property only for the types where this
makes sense (Service, Swap, etc). But Restart() method is defined on the unit,
and also having this always under the same property name is more convenient.

4 years agocore: pahole optimization of struct Unit
Zbigniew Jędrzejewski-Szmek [Wed, 10 Feb 2021 16:32:31 +0000 (17:32 +0100)] 
core: pahole optimization of struct Unit

We had a lone 'bool job_running_timeout_set:1', which generated a hole. Let's
move things around a bit. The structure is a tiny bit smaller and has less
holes:
        /* size: 1192, cachelines: 19, members: 149 */
        /* sum members: 1175, holes: 3, sum holes: 11 */
        /* sum bitfield members: 27 bits, bit holes: 1, sum bit holes: 7 bits */
        /* bit_padding: 14 bits */
        /* last cacheline: 40 bytes */

        /* size: 1184, cachelines: 19, members: 149 */
        /* sum members: 1175, holes: 1, sum holes: 4 */
        /* sum bitfield members: 27 bits (3 bytes) */
        /* bit_padding: 13 bits */
        /* last cacheline: 32 bytes */

4 years agomanager: remove unnecessary conditional
Zbigniew Jędrzejewski-Szmek [Sat, 30 Jan 2021 16:27:45 +0000 (17:27 +0100)] 
manager: remove unnecessary conditional

4 years agocore: add helper macros for deserialization
Zbigniew Jędrzejewski-Szmek [Sat, 30 Jan 2021 19:50:19 +0000 (20:50 +0100)] 
core: add helper macros for deserialization

A helper function would seem more natural, but there are two reasons why a
macro is needed:
- many bool fields are bitfields, so we can't take a pointer, and using a macro
  allows us to avoid taking a pointer.
- we have a few diffent types (bool, uint64_t, FreezerState), and we can have
  type safety without specifying the type by using the macro.

This also makes the error messages more informative: they print the exact field
identifier that failed, which is more useful for debugging than a description.

4 years agocore: split out a few funcs into unit-serialize.[ch]
Zbigniew Jędrzejewski-Szmek [Sat, 6 Feb 2021 07:18:42 +0000 (08:18 +0100)] 
core: split out a few funcs into unit-serialize.[ch]

Just a straightforward move and resulting include file adjustments.

4 years agosd-bus: standarize on NULL for empty signature in method calls
Zbigniew Jędrzejewski-Szmek [Fri, 5 Feb 2021 14:33:10 +0000 (15:33 +0100)] 
sd-bus: standarize on NULL for empty signature in method calls

We would use sometimes "" and sometimes NULL. They are equivalent, so let's use
NULL everywhere, except for a two places in tests.

4 years agosd-bus: extend sd_bus_message_read_strv() to paths and signatures
Zbigniew Jędrzejewski-Szmek [Fri, 5 Feb 2021 14:22:42 +0000 (15:22 +0100)] 
sd-bus: extend sd_bus_message_read_strv() to paths and signatures

It's rather convenient to be able to read all three types with this function.
Strictly speaking this change is not fully compatible, in case someone was
relying on sd_bus_message_read_strv() returning an error for anything except
"as", but I hope nobody was doing that.

4 years agoMerge pull request #11484 from keszybz/udevadm-error-logs
Yu Watanabe [Wed, 10 Feb 2021 18:17:47 +0000 (03:17 +0900)] 
Merge pull request #11484 from keszybz/udevadm-error-logs

Use real return codes in _from_string() functions

4 years agotest: count call instructions as well
Frantisek Sumsal [Wed, 10 Feb 2021 09:16:09 +0000 (10:16 +0100)] 
test: count call instructions as well

Binaries on the latest Arch Linux use `call` instructions instead of
`callq`, which breaks the ASan detection and eventually the image
building process (due to insufficient space).

4 years agoTranslations update from Weblate (#18537)
Weblate (bot) [Wed, 10 Feb 2021 15:55:41 +0000 (16:55 +0100)] 
Translations update from Weblate (#18537)

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agoci: build on Fedora ELN as well
Frantisek Sumsal [Wed, 10 Feb 2021 14:06:40 +0000 (15:06 +0100)] 
ci: build on Fedora ELN as well

ELN builds with a slightly different content set and RHEL-like options,
which should, theoretically, help a bit with RHEL stuff.

4 years agoMerge pull request #18506 from keszybz/fuzz-systemctl-parse-argv
Yu Watanabe [Wed, 10 Feb 2021 15:29:22 +0000 (00:29 +0900)] 
Merge pull request #18506 from keszybz/fuzz-systemctl-parse-argv

Fuzzer for systemctl argline parsing

4 years agoMerge pull request #18521 from poettering/coredumpctl-table
Lennart Poettering [Wed, 10 Feb 2021 14:58:56 +0000 (15:58 +0100)] 
Merge pull request #18521 from poettering/coredumpctl-table

coredumpctl improvements (mostly about table formatting)

4 years agotest-string-util: add missing comma 11484/head
Zbigniew Jędrzejewski-Szmek [Wed, 10 Feb 2021 07:00:33 +0000 (08:00 +0100)] 
test-string-util: add missing comma

Coverity CID#1446368.

4 years agoresolved: rework a few functions to return early on error
Zbigniew Jędrzejewski-Szmek [Wed, 8 May 2019 08:55:39 +0000 (10:55 +0200)] 
resolved: rework a few functions to return early on error

The implementation is a bit ugly because we set the output variable
twice. But we were already doing this on error, so this is not
significantly worse. Doing this allows us to avoid goto's, and the
compiler should be able to figure this out and only set once.

4 years agomachinectl: write arg_* only after verifying the value
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 15:07:19 +0000 (16:07 +0100)] 
machinectl: write arg_* only after verifying the value

4 years agotree-wide: propagate error code from _from_string() functions
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 15:06:36 +0000 (16:06 +0100)] 
tree-wide: propagate error code from _from_string() functions

Now that we know we have something useful, no need to make an answer up.

4 years agoReturn -EINVAL from _from_string() functions
Zbigniew Jędrzejewski-Szmek [Fri, 18 Jan 2019 15:26:31 +0000 (16:26 +0100)] 
Return -EINVAL from _from_string() functions

We'd return -1 (-EPERM), even though we have a general rule to use real errno
values. The particular case that caught my attention was:

$ sudo udevadm control -l asdf
Failed to parse log priority 'asdf': Operation not permitted

... but "git grep 'r =.*_from_string' src/" return 110 hits. Confusingly, some
of the _from_string functions already return a proper errno value, so not all
of those are broken, but probably quite a few.

4 years agotree-wide: use -EINVAL for enum invalid values
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 16:17:47 +0000 (17:17 +0100)] 
tree-wide: use -EINVAL for enum invalid values

As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617.

This does not touch anything exposed in src/systemd. Changing the defines there
would be a compatibility break.

Note that tests are broken after this commit. They will be fixed in the next one.

4 years agoudev: make sure UdevBuiltinCommand is properly converted
Zbigniew Jędrzejewski-Szmek [Wed, 10 Feb 2021 07:32:23 +0000 (08:32 +0100)] 
udev: make sure UdevBuiltinCommand is properly converted

4 years agosd-bus: drop some bitfields in sd_bus_slot
Zbigniew Jędrzejewski-Szmek [Wed, 10 Feb 2021 13:03:10 +0000 (14:03 +0100)] 
sd-bus: drop some bitfields in sd_bus_slot

A hole was/is present after the booleans, so changing them to be one byte each
doesn't change the structure size (122 bits on amd64). If we add more stuff
later, it might make sense to turn some of those into bitfields again. For now,
let's take the easy route. EINVAL fits into type now.

Code size it minimally reduced:
-rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb 10 14:00 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 4109712 Feb 10 14:01 build/libsystemd.so.0.30.0

4 years agogithub: expressly ask for logs in github issue template
Lennart Poettering [Wed, 10 Feb 2021 13:11:44 +0000 (14:11 +0100)] 
github: expressly ask for logs in github issue template

Apparently it's not obvious that logs are a good thing to provide, hence
let's explicitly ask for them.

4 years agosd-netlink: pahole optimization of sd_netlink_slot
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 18:51:50 +0000 (19:51 +0100)] 
sd-netlink: pahole optimization of sd_netlink_slot

By rearranging the fields, we can avoid one of the holes (on amd64).
By adding more space for .type, -EINVAL can be used as a value later on.
The structure is reduced from 96 to 88 bytes (on amd64).

Text size is also smaller:
-rwxrwxr-x 1 zbyszek zbyszek 4109832 Feb  9 19:50 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb  9 19:51 build/libsystemd.so.0.30.0

4 years agoshared/json: make JsonVariant.type field wider
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 16:08:06 +0000 (17:08 +0100)] 
shared/json: make JsonVariant.type field wider

pahole shows that this doesn't make a difference, but we can fit -EINVAL
into .type without warnings.

4 years agosd-event: drop one bitfield from sd_event_source
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 16:02:18 +0000 (17:02 +0100)] 
sd-event: drop one bitfield from sd_event_source

pahole analysis confirms that the structure size does not change (there
was/is a hole after the sequence of bitfields anyway).

4 years agocore: drop bitfields in Manager object
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 15:43:03 +0000 (16:43 +0100)] 
core: drop bitfields in Manager object

Every bitfield may make the object a little smaller, but requires additional
code when accessing the field. So it only makes sense in objects that are
created in many many copies. The Manager is pretty much a singleton.

-rwxrwxr-x 1 zbyszek zbyszek 4443840 Feb  9 16:14 build/systemd
-rwxrwxr-x 1 zbyszek zbyszek 4442552 Feb  9 16:42 build/systemd

We save 1288 bytes of code by "wasting" a few bytes on storage. (The speed
advantages are probably more important, but harder to measure…)

4 years agoAdd comma in structured initialization in a few places
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 15:32:55 +0000 (16:32 +0100)] 
Add comma in structured initialization in a few places

It just looks nicer…

4 years agocore: do not initialize variable which is unconditionally set below
Zbigniew Jędrzejewski-Szmek [Wed, 8 May 2019 09:09:10 +0000 (11:09 +0200)] 
core: do not initialize variable which is unconditionally set below

4 years agotest-tables: make the assert more readable
Zbigniew Jędrzejewski-Szmek [Fri, 18 Jan 2019 16:31:32 +0000 (17:31 +0100)] 
test-tables: make the assert more readable

Doing it all in one line and with negation in front seemed like a good
idea at some point, but I think it is vastly easier to understand when
it is split out a bit.

4 years agotest-tables: fix warning about NULL used in printf
Zbigniew Jędrzejewski-Szmek [Wed, 10 Feb 2021 06:49:17 +0000 (07:49 +0100)] 
test-tables: fix warning about NULL used in printf

With the simplified asserts, newer gcc is able to (correctly) figure
out that NULL was being passed.

4 years agoclock-util: modernize settimeofday() timezone calls
Lennart Poettering [Wed, 10 Feb 2021 11:09:38 +0000 (12:09 +0100)] 
clock-util: modernize settimeofday() timezone calls

Let's use structured initialization, and avoid the weird `tv_null`
indirection.

No changes in behaviour, just some clean-ups.

4 years agoFix coverity warning in test-string-util.c
Luca Boccassi [Wed, 10 Feb 2021 11:10:27 +0000 (11:10 +0000)] 
Fix coverity warning in test-string-util.c

CID 1446368:  Incorrect expression  (MISSING_COMMA)

4 years agocoredumpctl: include coredump size in output 18521/head
Lennart Poettering [Tue, 9 Feb 2021 16:41:10 +0000 (17:41 +0100)] 
coredumpctl: include coredump size in output

This improves the output of the "list" and "info" verbs and adds
coredump size information to the output.

For doing that a common helper function is added that analyzes the
coredump file on disk.

4 years agoman: document new coredumpctl features
Lennart Poettering [Tue, 9 Feb 2021 15:43:55 +0000 (16:43 +0100)] 
man: document new coredumpctl features

4 years agocoredumpctl: modernize table output
Lennart Poettering [Tue, 9 Feb 2021 15:40:44 +0000 (16:40 +0100)] 
coredumpctl: modernize table output

Let's use our table formatter for generating the coredump table. Bring
support up to our current standards, with a bit of color, JSON output
and so on.

Also adds supports for setting a max for the number of lines to
generate. (with the new -n switch)

The existing -1 switch now becomes a synonym for "-n 1 --reverse"

Fixes: #3271
4 years agoformat-table: when generating json, synthesize "null" for invalid ifindex
Lennart Poettering [Tue, 9 Feb 2021 15:39:49 +0000 (16:39 +0100)] 
format-table: when generating json, synthesize "null" for invalid ifindex

This matches what we do for other cell types that have an invalid value.

4 years agoformat-table: make UID/GID/PID fields first class citizens + add signal cell type
Lennart Poettering [Tue, 9 Feb 2021 15:36:07 +0000 (16:36 +0100)] 
format-table: make UID/GID/PID fields first class citizens + add signal cell type

This way we can display invalid UIDs/GIDs/PIDs as n/a while still
storing them as is.

Also, let's add a new cell type for unix signal, that is stored as
integer, but displayed as signal name string.

4 years agoanalyze: slightly reword PrivatTmp= message
Lennart Poettering [Wed, 10 Feb 2021 09:50:23 +0000 (10:50 +0100)] 
analyze: slightly reword PrivatTmp= message

Apparently there way confusion about "does not apply". Let's say "is not
appropriate".

Fixes: #13095
4 years agoMerge pull request #18518 from poettering/inhibit-limit-columns
Lennart Poettering [Tue, 9 Feb 2021 16:14:25 +0000 (17:14 +0100)] 
Merge pull request #18518 from poettering/inhibit-limit-columns

put a width limit on the "systemd-inhibit --list" table

4 years agoinhibit: cut off overly long "who" fields 18518/head
Lennart Poettering [Tue, 9 Feb 2021 14:03:46 +0000 (15:03 +0100)] 
inhibit: cut off overly long "who" fields

systemd-inhibit when invoked with a command line will put the whole
command line in the "who" field of the inhibitor lock. This can get
extremely long for shell expressions, making the table "systemd-inhibit
--list" shows ridiculously weirdly formatted. Let's put a limit on the
column width: half of the screen, not more.

4 years agoformat-table: don't hit assert if column got less width than it asked for
Lennart Poettering [Tue, 9 Feb 2021 14:02:21 +0000 (15:02 +0100)] 
format-table: don't hit assert if column got less width than it asked for

If one field in a specific column has a maximum size limit, other fields
in the same column might affected by it and get less than they asked
for. Let's make sure we can handle this, and don't assert on this
because surprisingly we got less than what we asked for.

4 years agosystemctl: remove comment about --failed being deprecated 18506/head
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 13:14:16 +0000 (14:14 +0100)] 
systemctl: remove comment about --failed being deprecated

Follow-up for bef19548a2430909019d7cff095b8600c796c3ef.

4 years agofuzz-systemctl-parse-argv: a new fuzzer
Zbigniew Jędrzejewski-Szmek [Sun, 7 Feb 2021 17:30:42 +0000 (18:30 +0100)] 
fuzz-systemctl-parse-argv: a new fuzzer

Does what the name suggests. Obviously inspired by sudoers, but note that
our tools are not supposed to be installed suid, so there is no privilege
boundary to cross here.

4 years agoMerge pull request #18470 from mrc0mmand/ci-clang-12
Luca Boccassi [Tue, 9 Feb 2021 13:06:40 +0000 (13:06 +0000)] 
Merge pull request #18470 from mrc0mmand/ci-clang-12

ci: run build test with clang-12 as well

4 years agoMerge pull request #18416 from yuwata/strverscmp
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 13:06:18 +0000 (14:06 +0100)] 
Merge pull request #18416 from yuwata/strverscmp

util: introduce strverscmp_improved()

4 years agofuzz-journal-remote: do not assert on resource conditions
Zbigniew Jędrzejewski-Szmek [Mon, 8 Feb 2021 09:20:03 +0000 (10:20 +0100)] 
fuzz-journal-remote: do not assert on resource conditions

We have a number of issues where oss-fuzz reports input-independent crashes of
fuzz-journal-remote. Instead of asserting that stuff that allocated fds and
memory never fails, let's instead just return an error.

https://oss-fuzz.com/testcase-detail/4791099424112640
https://oss-fuzz.com/testcase-detail/4531912477638656

I don't see any docs as to whether LLVMFuzzerTestOneInput() is allowed to
return non-zero. Propagating the error code is easiest, so let's just do that.
If it turns out that this causes oss-fuzz to still report a failure, we can
suppress that later.

4 years agolog: do not use uninitialized value
Yu Watanabe [Tue, 9 Feb 2021 10:07:35 +0000 (19:07 +0900)] 
log: do not use uninitialized value

Follow-up for 85cf96e3f567cd51f79d671bbf3559550fdd67b7.

4 years agoci: temporarily pin Arch repositories to glibc 2.32-5
Frantisek Sumsal [Tue, 9 Feb 2021 11:49:31 +0000 (12:49 +0100)] 
ci: temporarily pin Arch repositories to glibc 2.32-5

glibc 2.33-3 shipped on 2021-02-06 breaks running Arch containers on
systems with older kernels (like Ubuntu Focal). Until the issue is
resolved, let's pin the Arch repositories to glibc 2.32-5 to mitigate
the annoying CI fails.

See: https://bugs.archlinux.org/task/69563

4 years agoMerge pull request #18346 from yuwata/hostnamectl-try-to-set-transient-hostname
Zbigniew Jędrzejewski-Szmek [Tue, 9 Feb 2021 11:42:25 +0000 (12:42 +0100)] 
Merge pull request #18346 from yuwata/hostnamectl-try-to-set-transient-hostname

hostnamectl: try to set transient hostname even if setting static or pretty hostname failed

4 years agotest-network: support protocol and linkdown flag for ff00::/8 route
Yu Watanabe [Tue, 9 Feb 2021 05:12:25 +0000 (14:12 +0900)] 
test-network: support protocol and linkdown flag for ff00::/8 route

Fixes #18507.

4 years agonetwork: Delay addition of IPv6 Proxy NDP addresses
Kevin P. Fleming [Sat, 6 Feb 2021 15:58:43 +0000 (10:58 -0500)] 
network: Delay addition of IPv6 Proxy NDP addresses

Setting of IPv6 Proxy NDP addresses must be done at the same
time as static addresses, static routes, and other link attributes
that must be configured when the link is up. Doing this ensures
that they are reconfigured on the link if the link goes down
and returns to service.

4 years agotree-wide: replace strverscmp() and str_verscmp() with strverscmp_improved() 18416/head
Yu Watanabe [Sat, 30 Jan 2021 16:12:27 +0000 (01:12 +0900)] 
tree-wide: replace strverscmp() and str_verscmp() with strverscmp_improved()

4 years agostring-util: introduce strverscmp_improved()
Yu Watanabe [Wed, 3 Feb 2021 20:55:59 +0000 (05:55 +0900)] 
string-util: introduce strverscmp_improved()

Unfortunately, strverscmp() from libc or str_verscmp() do not correctly
handle pre-release version, e.g. 247 vs 247~rc1.

This implement a new comparison function, which is based on the RPM's
rpmvercmp().

4 years agofundamental: move several macros and functions into src/fundamental/
Yu Watanabe [Wed, 3 Feb 2021 18:21:08 +0000 (03:21 +0900)] 
fundamental: move several macros and functions into src/fundamental/

sd-boot has a copy of a subset of codes from libbasic. This makes
sd-boot share the code with libbasic, and dedup the code.

Note, startswith_no_case() is dropped from sd-boot, as
- it is not used,
- the previous implementation is not correct,
- gnu-efi does not have StrniCmp() or so.

4 years agohostnamectl: use Table 18346/head
Yu Watanabe [Fri, 29 Jan 2021 07:48:03 +0000 (16:48 +0900)] 
hostnamectl: use Table

4 years agohostnamectl: show hint when user try to set transient hostname but static hostname...
Yu Watanabe [Mon, 25 Jan 2021 04:44:00 +0000 (13:44 +0900)] 
hostnamectl: show hint when user try to set transient hostname but static hostname is already used

4 years agohostname: use free_and_strdup_and_warn()
Yu Watanabe [Fri, 22 Jan 2021 07:46:18 +0000 (16:46 +0900)] 
hostname: use free_and_strdup_and_warn()

4 years agohostname: re-read file later when failed to update file
Yu Watanabe [Fri, 22 Jan 2021 07:38:52 +0000 (16:38 +0900)] 
hostname: re-read file later when failed to update file

Previously, even when writing e.g. /etc/hostname fails, the static
hostname in Context is not restored. So, the subsequent call of the same
method succeeds:
```
$ sudo chattr +i /etc/hostname
$ sudo hostnamectl --static set-hostname aaa
Could not set static hostname: Access denied
$ echo $?
1
$ sudo hostnamectl --static set-hostname aaa
$ echo $?
0
```

This makes when updating file is failed, the saved stat is cleared. So,
the static hostname or machine information in the context are always
consistent to the corresponding files.

4 years agohostnamectl: unset pretty hostname only when no target is specified
Yu Watanabe [Fri, 22 Jan 2021 02:28:06 +0000 (11:28 +0900)] 
hostnamectl: unset pretty hostname only when no target is specified

4 years agohostnamectl: try to set transient hostname even if updating static or pretty hostname...
Yu Watanabe [Fri, 22 Jan 2021 02:20:50 +0000 (11:20 +0900)] 
hostnamectl: try to set transient hostname even if updating static or pretty hostname failed

If no target (--pretty, --static, or --transient) is specified, then
let's try to set transient hostname even if setting static or pretty
hostname failed. This may be useful for read-only filesystem.

4 years agohostname: introduce two bus errors for updating file
Yu Watanabe [Mon, 25 Jan 2021 04:16:20 +0000 (13:16 +0900)] 
hostname: introduce two bus errors for updating file

4 years agobus-error: align error definitions
Yu Watanabe [Fri, 29 Jan 2021 06:28:41 +0000 (15:28 +0900)] 
bus-error: align error definitions

4 years agohostnamectl: improve log message on failure
Yu Watanabe [Fri, 22 Jan 2021 02:18:42 +0000 (11:18 +0900)] 
hostnamectl: improve log message on failure

4 years agohwdb: add axis overrides for the Dell Latitude E5510 TouchPad (#18493) 18512/head
Gablegritule [Mon, 8 Feb 2021 23:30:49 +0000 (00:30 +0100)] 
hwdb: add axis overrides for the Dell Latitude E5510 TouchPad (#18493)

I added an entry for Dell Latitude E5510 TouchPad to set up the true size
of the TouchPad (the size is currently over-estimated)

4 years agoMerge pull request #18478 from mrc0mmand/fix-TEST-06
Frantisek Sumsal [Mon, 8 Feb 2021 11:34:13 +0000 (12:34 +0100)] 
Merge pull request #18478 from mrc0mmand/fix-TEST-06

TEST-06-SELINUX fixes

4 years agotree-wide: fix the string concatenation warning with clang-12 18470/head
Frantisek Sumsal [Mon, 8 Feb 2021 10:26:26 +0000 (11:26 +0100)] 
tree-wide: fix the string concatenation warning with clang-12

e.g.:
./src/shared/dissect-image.c:2218:39: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
                                      "/usr/lib/os-release\0",
                                      ^
../src/shared/dissect-image.c:2217:39: note: place parentheses around the string literal to silence warning
                [META_OS_RELEASE]   = "/etc/os-release\0"
                                      ^
1 error generated.

See: https://reviews.llvm.org/D85545

4 years agoxdg-autostart-generator: sort header includes
Zbigniew Jędrzejewski-Szmek [Sun, 7 Feb 2021 17:29:35 +0000 (18:29 +0100)] 
xdg-autostart-generator: sort header includes

4 years agosystemctl: move telinit execcing out of parse_argv()
Zbigniew Jędrzejewski-Szmek [Sun, 7 Feb 2021 16:35:06 +0000 (17:35 +0100)] 
systemctl: move telinit execcing out of parse_argv()

With this change, parse_argv() does parsing, without any real actions.
Fully untested ;)

4 years agoMerge pull request #18375 from yuwata/cli-tools-also-read-kernel-command-line
Zbigniew Jędrzejewski-Szmek [Mon, 8 Feb 2021 10:45:42 +0000 (11:45 +0100)] 
Merge pull request #18375 from yuwata/cli-tools-also-read-kernel-command-line

tree-wide: make CLI tools also read kernel command line when run as service

4 years agoMerge pull request #18331 from yuwata/test-udev-event-spawn
Zbigniew Jędrzejewski-Szmek [Mon, 8 Feb 2021 10:10:36 +0000 (11:10 +0100)] 
Merge pull request #18331 from yuwata/test-udev-event-spawn

udev: add tests for udev_event_spawn()

4 years agoUse correct config parser for MountAPIVFS (#18501)
Antonius Frie [Mon, 8 Feb 2021 08:15:15 +0000 (09:15 +0100)] 
Use correct config parser for MountAPIVFS (#18501)

As far as I can see, at some point the parser function for MountAPIVFS
was changed from the generic bool parser to a custom implementation, to
allow the context to keep track of whether MountAPIVFS had been set
explicitly. If not, exec_context_get_effective_mount_apivfs would fall
back to a default value. However, the corresponding entry in the big
parser table wasn't updated, meaning that the old bool parser was still
used, meaning that context->mount_apivfs_set remained at its default
value of false, meaning that the default value was always used and the
config option was effectively ignored.

Fix for 5e98086d1629f5c5b73645ba2568de4b09b7d958.

4 years agocore: drop references to Upstart
Zbigniew Jędrzejewski-Szmek [Sun, 7 Feb 2021 16:02:56 +0000 (17:02 +0100)] 
core: drop references to Upstart

The last release of Upstart was July 2014 [1], and there have been no new
commits to the repo. We should move on too.
[1] https://lists.ubuntu.com/archives/upstart-devel/2014-July/003313.html

The only real support was in the code that looked for $PREVLEVEL.
https://codesearch.debian.net/search?q=PREVLEVEL&literal=1&perpkg=1 shows this
string in our own code (or the copy in elogind), our own man pages, and init
scripts for two packages (brltty, salt), which shouldn't be used with systemd.
(And both *check* for PREVLEVEL, and don't set it. So most likely nothing at
all sets it.)

4 years agohwdb: add Acecad Flair / Pentagram Quadpen (#18443)
cprn [Sun, 7 Feb 2021 11:33:43 +0000 (12:33 +0100)] 
hwdb: add Acecad Flair / Pentagram Quadpen (#18443)

4 years agoMerge pull request #18490 from keszybz/prettify-update-dbus-docs
Luca Boccassi [Sat, 6 Feb 2021 15:36:39 +0000 (15:36 +0000)] 
Merge pull request #18490 from keszybz/prettify-update-dbus-docs

Prettify update-dbus-docs

4 years agoupdate-dbus-docs: use color in summary 18490/head
Zbigniew Jędrzejewski-Szmek [Sat, 6 Feb 2021 09:02:37 +0000 (10:02 +0100)] 
update-dbus-docs: use color in summary

4 years agoupdate-dbus-docs: say "MODIFIED" not "OUTDATED"
Zbigniew Jędrzejewski-Szmek [Sat, 6 Feb 2021 08:42:54 +0000 (09:42 +0100)] 
update-dbus-docs: say "MODIFIED" not "OUTDATED"

When executed in test mode, "OUTDATED" is appropriate. But when executed
to actually update the text, after the tool executes, those pages are the
opposite, not outdated.

4 years agocopy: use stat_verify_directory() where appropriate
Lennart Poettering [Mon, 1 Feb 2021 16:03:19 +0000 (17:03 +0100)] 
copy: use stat_verify_directory() where appropriate

4 years agoman: fix misspellings of "NameSeviceSwitch"
Julia Cartwright [Fri, 5 Feb 2021 21:16:18 +0000 (15:16 -0600)] 
man: fix misspellings of "NameSeviceSwitch"

Fixup NameSeviceSwitch -> NameServiceSwitch spelling error in
documentation.

Found through inspection of documentation.

4 years agoTranslations update from Weblate (#18485)
Weblate (bot) [Fri, 5 Feb 2021 23:54:58 +0000 (00:54 +0100)] 
Translations update from Weblate (#18485)

* Translated using Weblate (Swedish)

Currently translated at 100.0% (189 of 189 strings)

Translation: systemd/main
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agogithub: ask for systemd version in RFE form
Lennart Poettering [Fri, 5 Feb 2021 23:14:47 +0000 (00:14 +0100)] 
github: ask for systemd version in RFE form

It happens too often that what people ask for already is implemented.
Let's help cut the noise a bit, and make people check things first
hopefully, and at least make it either for us to detect such cases.

4 years agoresolved: suppress ifindex info in varlink JSON responses if zero
Lennart Poettering [Fri, 5 Feb 2021 17:43:55 +0000 (18:43 +0100)] 
resolved: suppress ifindex info in varlink JSON responses if zero

If we don't have ifindex info, don't set the field for it.

We already do that for parsed IP address replies, let's do it for all
cases: it's a bit nicer to suppress the ifindex prop if it doesn't apply
than to pass it invalid.

This is the other side of #18482, i.e. fixes things so that the parser
doesn't get tripped up by this.

(This too makes a problem go away we should track down properly, i.e.
figure out how the ifindex got lost in
https://github.com/systemd/systemd/pull/17823#issuecomment-742439422 )

4 years agoMerge pull request #18482 from poettering/resolved-nss-varlink-ifindex-fix
Lennart Poettering [Fri, 5 Feb 2021 23:16:28 +0000 (00:16 +0100)] 
Merge pull request #18482 from poettering/resolved-nss-varlink-ifindex-fix

nss-resolve: handle zero ifindex reply from server

4 years agonss-resolve: shortcut fixing of ifindex if it's zero anyway 18482/head
Lennart Poettering [Fri, 5 Feb 2021 17:46:18 +0000 (18:46 +0100)] 
nss-resolve: shortcut fixing of ifindex if it's zero anyway

4 years agonss-resolve: accept zero ifindex when parsing resolved reply
Lennart Poettering [Fri, 5 Feb 2021 17:44:22 +0000 (18:44 +0100)] 
nss-resolve: accept zero ifindex when parsing resolved reply

Sometimes a reply isn't associated to any specific interface, it might
be a general truth (for example served from /etc/hosts or so). In this
case the server might pass ifindex == 0. Accept that.

https://github.com/systemd/systemd/pull/17823#issuecomment-742439422

4 years agoMerge pull request #18318 from yuwata/network-route-table-name
Lennart Poettering [Fri, 5 Feb 2021 17:08:56 +0000 (18:08 +0100)] 
Merge pull request #18318 from yuwata/network-route-table-name

network: RouteTable= improvements

4 years agoPATCH] Always free deserialized_subscribed on reload
Ali Abdallah [Thu, 21 Jan 2021 06:37:21 +0000 (07:37 +0100)] 
PATCH] Always free deserialized_subscribed on reload

Otherwise, it will keep consuming memory on systemctl daemon-reload.

4 years agotest: add a custom SELinux file context 18478/head
Frantisek Sumsal [Fri, 5 Feb 2021 15:59:38 +0000 (16:59 +0100)] 
test: add a custom SELinux file context

Since the test suite overhaul, the test units are now under
/usr/lib/systemd/tests/testdata/tetsuite-06.units with
system_u:object_r:lib_t context. This causes an AVC denial, since the
systemd unit files are expected to have the
system_u:object_r:systemd_unit_file_t context. Let's fix this by using a
custom file context definition.

4 years agotest: clean the module build dir before compiling it
Frantisek Sumsal [Fri, 5 Feb 2021 15:57:30 +0000 (16:57 +0100)] 
test: clean the module build dir before compiling it

otherwise the module won't compile & load after autorelabel reboot,
since the target is already built.