Joakim Nohlgård [Fri, 29 Dec 2023 14:06:50 +0000 (15:06 +0100)]
udevadm: Propagate return code from verb result
udevadm lock did not propagate the return code from the child process
because all positive values were treated as success.
v2:
Now 'udevadm test-builtin' ignores all positive return values from the
builtin commands. Otherwise, as the hwdb builtin returns an positive value
when a matching entry found, 'udevadm test-builtin hwdb' will fail.
v3:
Initialize partition table before calling 'sfdisk --delete'.
Frantisek Sumsal [Thu, 28 Dec 2023 22:42:47 +0000 (23:42 +0100)]
test: avoid starting/stopping unwanted units during fuzzing
Skip calling start and stop methods on unit objects, as doing that is
not only time consuming, but it also starts/stops units that interfere
with the machine state. The actual code paths should be covered (to some
degree) by the respective method counterparts on the manager object.
Yu Watanabe [Thu, 28 Dec 2023 19:31:21 +0000 (04:31 +0900)]
sd-journal: check sd-event state before setting up post change timer
The similar check already exists in schedule_post_change().
The function is currently called at two places.
- journal_file_open() in sd-journal:
In this case, if the timer is not set up, then journal_file_post_change()
will be called at the end of journal_file_append_entry(). So, the necessary
task will be done sequentially when an journal entry is stored to the opened
journal file. That is desired when the function is called at outside of the
event loop.
- server_open_journal() in journald:
This is not called after we exit the event loop.
So, we can safely do nothing in the function if the event loop is being
finished or already finished.
Ronan Pigott [Thu, 28 Dec 2023 01:27:00 +0000 (18:27 -0700)]
dns: update record type enum to match iana
Adds some new dns record types. Also, some types were inserted into the
middle of the enum — this corrects an error where the enum constants for
some of the record types previously held an incorrect value.
A S Alam [Thu, 28 Dec 2023 15:36:26 +0000 (16:36 +0100)]
po: Translated using Weblate (Punjabi)
Currently translated at 26.4% (60 of 227 strings)
Co-authored-by: A S Alam <aalam@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/pa/
Translation: systemd/main
Yu Watanabe [Tue, 26 Dec 2023 02:04:20 +0000 (11:04 +0900)]
network/address: unconditionally check if address is ready
Previously, we checked if the address is ready only when it is an IPv6
address. But, IPv4 address never enter tentative state, hence the check
for an IPv4 address is effectively equivalent to the one for IPv6.
So, let's unify the check. This does not change any effective behavior.
Luca Boccassi [Wed, 27 Dec 2023 16:48:05 +0000 (17:48 +0100)]
bash completion: make systemctl mount-image/bind autocomplete on active services
The verb works only on running service units, so complete on that as the first
parameter, and a local file as the second. The other parameters are inside the
service namespace so we can't autocomplete from the outside, return early.
Frantisek Sumsal [Tue, 26 Dec 2023 18:39:12 +0000 (19:39 +0100)]
coccinelle: dial back warnings about performance
Turns out I _really_ underestimated the impact of
--include-headers-for-types, as it significantly reduces both runtime
and storage penalties. For example, on my machine the runtime of
uncached run goes down from ~15 minutes to ~2 minutes, and similarly the
total storage needed by the cache goes from ~15 GiB down to ~3 GiB.
Frantisek Sumsal [Tue, 26 Dec 2023 17:55:31 +0000 (18:55 +0100)]
coccinelle: help Coccinelle with some more complex macros
Drop the original macro file, since it's not needed anymore thanks to
resolving includes properly, but introduce a similar file -
parsing_hacks.h - that helps Coccinelle in some specific corner cases.
This eliminates most of the outstanding parsing errors in source files.
The remaining ones are limitations of the parsing engine (see the FIXMEs
in pasing_hacks.h) and need further investigation.
Frantisek Sumsal [Tue, 26 Dec 2023 17:44:21 +0000 (18:44 +0100)]
coccinelle: search the system include path for header files as well
Since Coccinelle is originally a kernel tool, it doesn't search the
system include path by default for header files. Without this we're
missing a lot of types provides by stdlib (and other libraries we make
use of).
Frantisek Sumsal [Mon, 25 Dec 2023 10:28:26 +0000 (11:28 +0100)]
coccinelle: rework how we run the Coccinelle transformations
Turns out that the original way we did things was quite broken, as it
skipped a _lot_ of code. This was because we just threw everything into
one pile and tried to spatch it, but this made Coccinelle sad, like when
man page examples redefined some of our macros, causing typedef
conflicts.
For example, with a minimal reproducer that defines a cleanup macro in
two source files, Coccinelle has no issues when spatch-ing each one
separately:
$ spatch --verbose-parsing --sp-file zz-drop-braces.cocci main.c
init_defs_builtins: /usr/lib64/coccinelle/standard.h
HANDLING: main.c
SPECIAL NAMES: adding _cleanup_ as a attribute with arguments
SPECIAL NAMES: adding _cleanup_free_ as a attribute
$ spatch --verbose-parsing --sp-file zz-drop-braces.cocci
logcontrol-example.c
init_defs_builtins: /usr/lib64/coccinelle/standard.h
HANDLING: logcontrol-example.c
SPECIAL NAMES: adding _cleanup_ as a attribute with arguments
But when you try to spatch both of them at once, Coccinelle starts
complaining and skipping the "bad" code:
$ spatch --verbose-parsing --sp-file zz-drop-braces.cocci main.c logcontrol-example.c
init_defs_builtins: /usr/lib64/coccinelle/standard.h
HANDLING: main.c logcontrol-example.c
SPECIAL NAMES: adding _cleanup_ as a attribute with arguments
SPECIAL NAMES: adding _cleanup_free_ as a attribute
remapping: _cleanup_ to an ident in macro name
ERROR-RECOV: found sync end of #define, line 44
parsing pass2: try again
ERROR-RECOV: found sync end of #define, line 44
parse error
= File "logcontrol-example.c", line 44, column 21, charpos = 1719
around = '__attribute__',
whole content = #define _cleanup_(f) __attribute__((cleanup(f)))
badcount: 2
bad: #include <systemd/sd-journal.h>
bad:
BAD:!!!!! #define _cleanup_(f) __attribute__((cleanup(f)))
This was, unfortunately, hidden as it is visible only with
--verbose-parsing (or --parse-error-msg).
Another issue was how we handled includes. The original way of throwing
them into the pile of source files doesn't really work, leading up to
similar issues as above. The better way is to let Coccinelle properly
resolve all includes by telling it where to find our own include files
(basically the same thing we already do during compilation).
After fixing all this, Coccinelle now has a chance to process much more
of our code (there are still some issues in more complex macros, but
that requires further investigation). However, there's a huge downside
from all of this - doing a _proper_ code analysis is surprisingly time
and resource heavy; meaning that processing just one Coccinelle rule now
takes 15 - 30 minutes.
To make this slightly less painful, Coccinelle supports caching the
generated ASTs, which actually helps a lot - it gets the runtime of one
rule from 15 - 30 minutes down to ~1 minute. It, of course, has its own
downside - the cache is _really_ big (ATTOW the cache takes ~15 GiB).
However, even with the aggressive AST caching you're still looking at
~1 hour for one full Coccinelle run, which is a bit annoying, but I
guess that's the price of doing things _properly_ (but I'll definitely
look into ways of further optimizing this).
David Tardon [Mon, 25 Dec 2023 09:50:13 +0000 (10:50 +0100)]
man: use <refsect1> instead of <refsection>
DocBook document model doesn't allow mixing of <refsection> with the
numbered variants (<refsect1> etc.). Therefore, any document that
included something from standard-conf.xml was invalid. Fortunately, all
the includes are at the 1st level, hence let's just change
standard-conf.xml to use <refsect1> to fix that.