Commit Graph
69715 Commits
Author SHA1 Message Date
Yu Watanabe f1f494f3f8 Merge pull request #30634 from dtardon/docbook-valid-3
DocBook validation fixes (part 3)
2023-12-28 04:06:57 +09:00
Yu Watanabe 51dfa75c6e Merge pull request #30639 from mrc0mmand/more-cocci-shenanigans
Another batch of Coccinelle tweaks
2023-12-27 20:33:46 +09:00
Frantisek Sumsal 321e64dc67 tpm2-util: declare the cleanup attribute first
As we do everywhere else (apart from it being incosistent, the switched
order also makes Coccinelle unhappy).
2023-12-27 11:15:48 +01:00
Frantisek Sumsal 8f07111aa8 bootctl: add a missing space 2023-12-27 11:15:48 +01:00
Frantisek Sumsal b8e0dd3939 test: use timestamp_is_set() 2023-12-27 11:15:48 +01:00
Frantisek Sumsal cfae9ec203 test: use set_isempty() in one more place 2023-12-27 11:15:48 +01:00
Frantisek Sumsal 6f8b3838c9 test: use IN_SET()/ERRNO_IS_NEG_*() more 2023-12-27 11:15:48 +01:00
Frantisek Sumsal c83f4220a1 tree-wide: use IN_SET() more 2023-12-27 11:15:48 +01:00
Frantisek Sumsal c633361f06 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.
2023-12-27 11:15:48 +01:00
Frantisek Sumsal b25d3b36a2 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.
2023-12-27 11:15:48 +01:00
Frantisek Sumsal 11959eb201 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).
2023-12-27 11:15:44 +01:00
Luca Boccassi 74ce6bbdee Merge pull request #30631 from yuwata/network-address-free
network/address: tiny cleanups for address_free()
2023-12-26 19:21:15 +01:00
Mike Yuan e14348c616 sleep: connect to correct bus when locking homed-managed homes
Partially reverts 122f6f1eaa

Fixes https://github.com/systemd/systemd/issues/29938#issuecomment-1869508708
2023-12-26 18:53:03 +01:00
David Tardon af29d0b179 man: rewrite as <group> 2023-12-26 13:10:36 +01:00
David Tardon 0fd5f9fb50 man: fix markup
<arg> is not allowed inside <title>.
2023-12-26 13:10:36 +01:00
David Tardon 7f9d96d4c5 man: move </variablelist> to the right place 2023-12-26 13:10:35 +01:00
David Tardon b239fc7250 man: fix <cmdsynopsis> content
Inline text is not allowed.
2023-12-26 13:10:35 +01:00
David Tardon 20dcd73a28 man: fix markup
<option> is not allowed in <cmdsynopsis>.
2023-12-26 13:10:35 +01:00
David Tardon dfa6c32ad9 man: restrict <command> to the actual command 2023-12-26 13:10:35 +01:00
David Tardon 996de3397b man: move macro decls. out of <funcsynopsis>
<funcsynopsis> doesn't allow block content.
2023-12-26 13:10:35 +01:00
David Tardon 932abebf4d man: fix markup
<arg> is not allowed inside <term>.
2023-12-26 13:10:35 +01:00
Frantisek Sumsal 4d3510d00f coccinelle: explicitly undefine SD_BOOT
So Coccinelle doesn't pull in includes guarded by #if SD_BOOT.

For example:

$ head -n5 main.c
 #if FOO
 #include "foo.h"
 #else
 #include "bar.h"
 #endif

$ spatch --verbose-includes --recursive-includes --sp-file zz-drop-braces.cocci main.c
init_defs_builtins: /usr/lib64/coccinelle/standard.h
HANDLING: main.c
including ./foo.h
including ./bar.h

$ spatch --verbose-includes --recursive-includes --sp-file zz-drop-braces.cocci main.c --undefined FOO
init_defs_builtins: /usr/lib64/coccinelle/standard.h
HANDLING: main.c
including ./bar.h
2023-12-26 11:23:19 +01:00
David Tardon b3579feb59 man: fix indentation 2023-12-26 08:59:53 +01:00
Yu Watanabe 5a4631bd8f coccinelle: fix typo 2023-12-26 09:43:21 +09:00
Stuart Hayhurst 5fd55b2c26 hwdb: Add override for headset form-factor for the Corsair Void Elite
Earlier versions of the headset had 'Headset' in the product name.
This version uses 'Dongle' instead, so it doesn't get given a form-factor.
2023-12-26 06:04:47 +09:00
Yu Watanabe fe3fcb9492 Merge pull request #30633 from mrc0mmand/cocci-shenanigans
coccinelle: rework how we run the Coccinelle transformations
2023-12-26 05:45:58 +09:00
Frantisek Sumsal 8451e720d8 systemctl: use SYNTHETIC_ERRNO() 2023-12-25 19:51:43 +01:00
Frantisek Sumsal 0b3c270896 modules-load: simplify OOM check 2023-12-25 18:26:59 +01:00
Frantisek Sumsal f2d0e2e5f5 sd-bus: drop unnecessary braces 2023-12-25 18:26:59 +01:00
Frantisek Sumsal 50f605bfe6 network: use timestamp_is_set() in one more place 2023-12-25 18:26:59 +01:00
Frantisek Sumsal 78bc04cf12 tree-wide: use strndupa_safe() in a couple more cases 2023-12-25 18:26:59 +01:00
Frantisek Sumsal 34e2897f51 nspawn: log & return in a single statement 2023-12-25 18:26:59 +01:00
Frantisek Sumsal c490b6ddc2 tree-wide: use IOVEC_MAKE() in a couple more places 2023-12-25 18:26:59 +01:00
Frantisek Sumsal dd1b1dae7e test: use FLAGS_SET() in one more place 2023-12-25 18:26:59 +01:00
Frantisek Sumsal cd1c510f0c test: use ERRNO_IS_NEG_NOT_SUPPORTED() in one more place 2023-12-25 18:26:59 +01:00
Frantisek Sumsal 6f7936cf57 killall: fix errno check 2023-12-25 18:26:59 +01:00
Frantisek Sumsal 4b68f70829 network: ENOTSUP -> EOPNOTSUPP 2023-12-25 18:26:59 +01:00
Frantisek Sumsal f51aec74c9 tree-wide: shorten a couple of ternary expressions 2023-12-25 18:26:59 +01:00
Frantisek Sumsal 0a6a59650e tree-wide: drop !! casts to booleans 2023-12-25 18:26:59 +01:00
David Tardon 0f095802ad man: add required <title> 2023-12-25 17:59:50 +01:00
David Tardon 70601fa571 man: match doctype and root element 2023-12-25 15:51:47 +01:00
David Tardon eea10b26f7 man: use same version in public and system ident. 2023-12-25 15:51:47 +01:00
Mike Yuan 245841a872 core/unit: don't log 0 values in unit_log_resources
Prompted by #30573
2023-12-25 23:19:44 +09:00
Yu Watanabe 372acaad58 network: use RET_GATHER() macro 2023-12-25 22:02:14 +08:00
Frantisek Sumsal fcd2db31c0 coccinelle: properly drop braces around single-statement if()s 2023-12-25 13:53:02 +01:00
Frantisek Sumsal 6688db4194 coccinelle: fix the log-json rule
As it generated very questionable results.
2023-12-25 13:53:02 +01:00
Frantisek Sumsal c988ef4cf4 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).
2023-12-25 13:52:42 +01:00
Yu Watanabe f089d3ebd5 network/address: move post-processes on address removal to address_drop()
For consistency with other follow-up processes after address removal.

No functional change, just refactoring and preparation for later
commits.
2023-12-25 20:19:40 +09:00
Yu Watanabe 8ae3a4f5e2 network/address: also drop reference for DHCP server address
The Address object should never freed after it is referenced.
So, this should not change any behavior. Just for safety.
2023-12-25 20:19:40 +09:00
Mike Yuan 38617c516a various: use FOREACH_ARRAY more
Prompted by #30622
2023-12-25 20:17:48 +09:00