Go to file
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
.clusterfuzzlite ci: unpin CFLite 2022-04-26 09:13:57 +00:00
.github build(deps): bump meson from 1.2.3 to 1.3.0 in /.github/workflows 2023-12-01 14:49:19 +00:00
.semaphore test: use 'until' instead of 'while !' 2023-09-06 19:54:29 +01:00
catalog tree-wide: s/life-cycle/lifecycle/g 2023-11-06 20:16:34 +01:00
coccinelle coccinelle: rework how we run the Coccinelle transformations 2023-12-25 13:52:42 +01:00
docs Add $SYSTEMD_HWDB_UPDATE_BYPASS (#30463) 2023-12-14 18:57:05 +09:00
factory docs: excorcise NIS from nsswitch.conf 2023-09-20 15:17:52 +02:00
hwdb.d Add Bosto BT-12HD series to hwdb 2023-12-17 16:57:42 +09:00
LICENSES LICENSES/README.md: fix syntax 2023-07-08 22:33:53 +00:00
man Merge pull request #30615 from dtardon/docbook-valid-1 2023-12-24 19:27:26 +09:00
mime mime: register confext/sysext images in shared-mime-info 2023-12-06 22:11:21 +01:00
mkosi.conf.d Update to mkosi v19 2023-11-28 19:54:58 +01:00
mkosi.images mkosi: don't turn off installation of our PAM snippets 2023-12-21 19:14:43 +01:00
modprobe.d meson: install the right README file in modprobe.d 2021-07-07 14:52:05 +02:00
network meson: always install network example files 2023-11-23 10:02:36 +00:00
po po: Translated using Weblate (Turkish) 2023-12-11 21:04:30 +00:00
presets preset: enable systemd-networkd-wait-online.service by default 2023-06-07 21:51:37 +01:00
rules.d rules: set up tty permissions and group for /dev/hvc* nodes 2023-12-20 21:01:05 +09:00
shell-completion bash-completion: add missing option to systemd-confext 2023-12-21 23:23:13 +02:00
src busctl: avoid asserting on NULL message 2023-12-24 15:04:28 +01:00
sysctl.d sysctl.d: Fix pid_max comment 2023-10-31 13:07:49 +01:00
sysusers.d Revert "sysusers.d: create the user for systemd-journal-upload.service" 2023-12-04 19:44:10 +01:00
test test: flush the socket once the triggered unit exits 2023-12-24 13:00:56 +01:00
tmpfiles.d tmpfiles.d/systemd-nologin.conf: use f+ instead of F (deprecated) 2023-12-08 10:58:05 +09:00
tools elf2efi: remove outdated comment mentioning linker script 2023-12-10 12:50:14 +00:00
units creds: add varlink API for encrypting/decrypting credentials 2023-12-21 19:19:12 +01:00
xorg xorg/50-systemd-user: add a full license header 2021-10-01 14:45:00 +02:00
.clang-format clang-format: Adjust style of pointers 2022-05-30 04:00:54 +09:00
.ctags editors: Prevent ctags from following symlinks 2019-02-15 11:01:20 -08:00
.dir-locals.el scripts: use 4 space indentation 2019-04-12 08:30:31 +02:00
.editorconfig editorconfig: add NEWS whitespace configuration 2023-10-26 22:41:03 +01:00
.gitattributes Mark all base64 files as generated 2023-08-16 12:49:45 +02:00
.gitignore Update to mkosi v19 2023-11-28 19:54:58 +01:00
.mailmap mailmap: "reduce contributor count by 13" 2023-08-16 12:49:42 +02:00
.packit.yml Revert "packit: don't take ownership of /etc/ssh/sshd_config.d/" 2023-12-08 19:12:19 +00:00
.pylintrc Add .pylintrc to globally suppress warnings we don't really care about 2023-08-10 18:13:29 +02:00
.vimrc vimrc: explicitly set shiftwidth for the C file type 2023-09-18 13:11:45 +02:00
.ycm_extra_conf.py ycm: add doc string for all the functions in configuration file 2017-11-29 13:21:49 -07:00
configure configure: update meson invocation 2023-07-29 14:08:06 +02:00
LICENSE.GPL2 relicense to LGPLv2.1 (with exceptions) 2012-04-12 00:24:39 +02:00
LICENSE.LGPL2.1 licence: remove references to old FSF address 2012-12-17 11:41:31 +01:00
Makefile tree-wide: add spdx header on all scripts and helpers 2021-01-28 09:55:35 +01:00
meson.build meson: check for pefile dependency before enabling ukify 2023-12-24 06:54:41 +09:00
meson_options.txt userdbctl: enable ssh-authorized-keys logic by default 2023-12-06 22:11:04 +01:00
mkosi.conf Merge pull request #30464 from CodethinkLabs/misc-integration-test-fixes 2023-12-18 16:11:16 +01:00
mkosi.kernel.config mkosi: Don't disable CONFIG_USB 2023-09-06 12:58:30 +02:00
NEWS networkd: support proxy_arp_pvlan sysctl 2023-12-24 03:40:03 +09:00
README Document kernel configs required for reading credentials from SMBIOS 2023-12-04 11:13:59 +01:00
README.md README.md: irc:// URLs are not rendered as links by markdown on Github 2023-12-06 22:23:16 +01:00
TODO TODO: fix typo 2023-12-23 04:49:26 +09:00

Systemd

System and Service Manager

Semaphore CI 2.0 Build Status
Coverity Scan Status
OSS-Fuzz Status
CIFuzz
CII Best Practices
CentOS CI - CentOS 8
CentOS CI - Arch
CentOS CI - Arch (sanitizers)
Fossies codespell report
Weblate
Coverage Status
Packaging status
OpenSSF Scorecard

Details

Most documentation is available on systemd's web site.

Assorted, older, general information about systemd can be found in the systemd Wiki.

Information about build requirements is provided in the README file.

Consult our NEWS file for information about what's new in the most recent systemd versions.

Please see the Code Map for information about this repository's layout and content.

Please see the Hacking guide for information on how to hack on systemd and test your modifications.

Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.

When preparing patches for systemd, please follow our Coding Style Guidelines.

If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel

Stable branches with backported patches are available in the stable repo.