Compare commits

...

18 Commits

Author SHA1 Message Date
Plan C b23728ec9f
Add simple usage message to systemd-backlight (#16709) 2020-08-28 13:50:35 +02:00
Ikey Doherty 677bb0555a partition/makefs: Include missing sys/file.h header
This file must be included on non-glibc systems to ensure
the `LOCK_EX` definition is available.

Signed-off-by: Ikey Doherty <ikey.doherty@lispysnake.com>
2020-08-28 13:32:09 +02:00
Lennart Poettering ae6ad21e0b device: propagate reload events from devices on everything but "add", and "remove"
Any uevent other then the initial and the last uevent we see for a
device (which is "add" and "remove") should result in a reload being
triggered, including "bind" and "unbind". Hence, let's fix up the check.

("move" is kinda a combined "remove" + "add", hence cover that too)
2020-08-28 13:30:13 +02:00
Zbigniew Jędrzejewski-Szmek c1afa2ed39
Merge pull request #16879 from keszybz/test-last-cap-and-dbus-docs
Add "developer mode" and test last cap and dbus docs
2020-08-28 08:30:00 +02:00
Zbigniew Jędrzejewski-Szmek 7efbe21850
Merge pull request #16872 from keszybz/test-50
Improve handling of os-release in tests
2020-08-28 08:27:55 +02:00
Zbigniew Jędrzejewski-Szmek e4b2cea32a man: update dbus doc stubs
For 4e39995371 and
bb0c0d6f29.
2020-08-27 21:30:23 +02:00
Zbigniew Jędrzejewski-Szmek c91e3116f4 update-dbus-docs: add hint 2020-08-27 21:30:23 +02:00
Zbigniew Jędrzejewski-Szmek 04aa6fa8cd update-dbus-docs: omit verbose output when in --test mode
It makes the ninja output listing very long for no good purpose.
2020-08-27 21:30:23 +02:00
Zbigniew Jędrzejewski-Szmek 4cc73cf9c1 test: verify that dbus docs are fresh
This makes use of the developer mode switch: the test is only done
if the user opted-in into developer mode.

Before the man/update-dbus-docs was using the argument form where
we don't need to run find_command(), but that doesn't work with test(),,
so find_command() is used and we get one more line in the config log.
2020-08-27 21:30:22 +02:00
Zbigniew Jędrzejewski-Szmek 1b584f38a8 update-dbus-docs: add test mode 2020-08-27 20:22:52 +02:00
Zbigniew Jędrzejewski-Szmek 0f5cea0212 update-dbus-docs: use argparse 2020-08-27 20:22:52 +02:00
Zbigniew Jędrzejewski-Szmek af4c7dc269 update-dbus-docs: print statistics at the end
Right now:
org.freedesktop.LogControl1.xml: 3/3
org.freedesktop.home1.xml:       44/44
org.freedesktop.hostname1.xml:   21/21
org.freedesktop.import1.xml:     17/19
org.freedesktop.locale1.xml:     10/10
org.freedesktop.login1.xml:      172/172
org.freedesktop.machine1.xml:    49/65
org.freedesktop.resolve1.xml:    25/61
org.freedesktop.systemd1.xml:    214/1468
org.freedesktop.timedate1.xml:   12/12
total:                           567/1875

:(
2020-08-27 20:22:40 +02:00
Zbigniew Jędrzejewski-Szmek b7be416f55 basic/missing_capability: clean up our defines and check that our fallback is up-to-date
There is little point in #defining and #undefining CAP_LAST_CAP multiple times.

The check is only done in developer mode. After all, it's not an error to
compile on a newer kernel, and we shouldn't even warn in that case.
2020-08-27 20:20:23 +02:00
Zbigniew Jędrzejewski-Szmek 839bdf2505 meson: add "develop mode" config switch 2020-08-27 20:20:23 +02:00
Zbigniew Jędrzejewski-Szmek c87d0661a0 test-path: remove unnecessary check
test points to an array, so it canont be NULL at this point.
2020-08-27 20:20:23 +02:00
Zbigniew Jędrzejewski-Szmek 9f927e46ac test/test-functions: do not execute strip_binaries twice
It is called from setup_basic_environment(), which also calls install_symtemd()
a bit earlier, so in effect it would be called twice.
2020-08-27 13:10:30 +02:00
Zbigniew Jędrzejewski-Szmek ae6c598791 tests/TEST-50: support the case when /etc/os-release is present
We have four legal cases:
1. /usr/lib/os-release exists and /etc/os-release is a symlink to it
2. both exist but /etc/os-release is not a symlink to /usr/lib/os-release
3. only /usr/lib/os-release exists
4. only /etc/os-release exists

The generic setup code in test-functions and create-busybox-image didn't handle
case 3.

The test-specific code in TEST-50 didn't handle 2 (because the general setup
code would only install /etc/os-release in the image and
grep -f /usr/lib/os-release would not work) and 4 (same reason) and would fail
in case 3 in generic setup.
2020-08-27 13:08:14 +02:00
Zbigniew Jędrzejewski-Szmek 37b6a5dff5 TEST-50: sfdisk is already installed by setup_basic_environment 2020-08-27 11:31:11 +02:00
16 changed files with 242 additions and 72 deletions

View File

@ -202,11 +202,17 @@ if dbus_docs.length() > 0
custom_target(
'update-dbus-docs',
output : 'update-dbus-docs',
command : ['python3',
'@0@/tools/update-dbus-docs.py'.format(project_source_root),
command : [update_dbus_docs_py,
'--build-dir=@0@'.format(project_build_root),
'@INPUT@'],
input : dbus_docs)
if conf.get('DEVELOPER_MODE') == 1
test('dbus-docs-fresh',
update_dbus_docs_py,
args : ['--build-dir=@0@'.format(project_build_root),
'--test'] + dbus_docs)
endif
endif
############################################################

View File

@ -2567,6 +2567,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b RemoveIPC = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly a(say) SetCredential = [...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly a(ss) LoadCredential = [...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly as SupplementaryGroups = ['...', ...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s PAMName = '...';
@ -2673,6 +2677,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s KeyringMode = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s ProtectProc = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s ProcSubset = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b ProtectHostname = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s NetworkNamespacePath = '...';
@ -3068,6 +3076,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
<!--property RemoveIPC is not documented!-->
<!--property SetCredential is not documented!-->
<!--property LoadCredential is not documented!-->
<!--property SupplementaryGroups is not documented!-->
<!--property PAMName is not documented!-->
@ -3172,6 +3184,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
<!--property KeyringMode is not documented!-->
<!--property ProtectProc is not documented!-->
<!--property ProcSubset is not documented!-->
<!--property ProtectHostname is not documented!-->
<!--property NetworkNamespacePath is not documented!-->
@ -3616,6 +3632,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
<variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/>
<variablelist class="dbus-property" generated="True" extra-ref="SetCredential"/>
<variablelist class="dbus-property" generated="True" extra-ref="LoadCredential"/>
<variablelist class="dbus-property" generated="True" extra-ref="SupplementaryGroups"/>
<variablelist class="dbus-property" generated="True" extra-ref="PAMName"/>
@ -3722,6 +3742,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
<variablelist class="dbus-property" generated="True" extra-ref="KeyringMode"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProtectProc"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProcSubset"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProtectHostname"/>
<variablelist class="dbus-property" generated="True" extra-ref="NetworkNamespacePath"/>
@ -4236,6 +4260,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b RemoveIPC = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly a(say) SetCredential = [...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly a(ss) LoadCredential = [...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly as SupplementaryGroups = ['...', ...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s PAMName = '...';
@ -4342,6 +4370,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s KeyringMode = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s ProtectProc = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s ProcSubset = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b ProtectHostname = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s NetworkNamespacePath = '...';
@ -4757,6 +4789,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
<!--property RemoveIPC is not documented!-->
<!--property SetCredential is not documented!-->
<!--property LoadCredential is not documented!-->
<!--property SupplementaryGroups is not documented!-->
<!--property PAMName is not documented!-->
@ -4861,6 +4897,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
<!--property KeyringMode is not documented!-->
<!--property ProtectProc is not documented!-->
<!--property ProcSubset is not documented!-->
<!--property ProtectHostname is not documented!-->
<!--property NetworkNamespacePath is not documented!-->
@ -5303,6 +5343,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
<variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/>
<variablelist class="dbus-property" generated="True" extra-ref="SetCredential"/>
<variablelist class="dbus-property" generated="True" extra-ref="LoadCredential"/>
<variablelist class="dbus-property" generated="True" extra-ref="SupplementaryGroups"/>
<variablelist class="dbus-property" generated="True" extra-ref="PAMName"/>
@ -5409,6 +5453,10 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
<variablelist class="dbus-property" generated="True" extra-ref="KeyringMode"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProtectProc"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProcSubset"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProtectHostname"/>
<variablelist class="dbus-property" generated="True" extra-ref="NetworkNamespacePath"/>
@ -5859,6 +5907,10 @@ node /org/freedesktop/systemd1/unit/home_2emount {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b RemoveIPC = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly a(say) SetCredential = [...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly a(ss) LoadCredential = [...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly as SupplementaryGroups = ['...', ...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s PAMName = '...';
@ -5965,6 +6017,10 @@ node /org/freedesktop/systemd1/unit/home_2emount {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s KeyringMode = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s ProtectProc = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s ProcSubset = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b ProtectHostname = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s NetworkNamespacePath = '...';
@ -6310,6 +6366,10 @@ node /org/freedesktop/systemd1/unit/home_2emount {
<!--property RemoveIPC is not documented!-->
<!--property SetCredential is not documented!-->
<!--property LoadCredential is not documented!-->
<!--property SupplementaryGroups is not documented!-->
<!--property PAMName is not documented!-->
@ -6414,6 +6474,10 @@ node /org/freedesktop/systemd1/unit/home_2emount {
<!--property KeyringMode is not documented!-->
<!--property ProtectProc is not documented!-->
<!--property ProcSubset is not documented!-->
<!--property ProtectHostname is not documented!-->
<!--property NetworkNamespacePath is not documented!-->
@ -6778,6 +6842,10 @@ node /org/freedesktop/systemd1/unit/home_2emount {
<variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/>
<variablelist class="dbus-property" generated="True" extra-ref="SetCredential"/>
<variablelist class="dbus-property" generated="True" extra-ref="LoadCredential"/>
<variablelist class="dbus-property" generated="True" extra-ref="SupplementaryGroups"/>
<variablelist class="dbus-property" generated="True" extra-ref="PAMName"/>
@ -6884,6 +6952,10 @@ node /org/freedesktop/systemd1/unit/home_2emount {
<variablelist class="dbus-property" generated="True" extra-ref="KeyringMode"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProtectProc"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProcSubset"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProtectHostname"/>
<variablelist class="dbus-property" generated="True" extra-ref="NetworkNamespacePath"/>
@ -7453,6 +7525,10 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b RemoveIPC = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly a(say) SetCredential = [...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly a(ss) LoadCredential = [...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly as SupplementaryGroups = ['...', ...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s PAMName = '...';
@ -7559,6 +7635,10 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s KeyringMode = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s ProtectProc = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s ProcSubset = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b ProtectHostname = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s NetworkNamespacePath = '...';
@ -7890,6 +7970,10 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
<!--property RemoveIPC is not documented!-->
<!--property SetCredential is not documented!-->
<!--property LoadCredential is not documented!-->
<!--property SupplementaryGroups is not documented!-->
<!--property PAMName is not documented!-->
@ -7994,6 +8078,10 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
<!--property KeyringMode is not documented!-->
<!--property ProtectProc is not documented!-->
<!--property ProcSubset is not documented!-->
<!--property ProtectHostname is not documented!-->
<!--property NetworkNamespacePath is not documented!-->
@ -8344,6 +8432,10 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
<variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/>
<variablelist class="dbus-property" generated="True" extra-ref="SetCredential"/>
<variablelist class="dbus-property" generated="True" extra-ref="LoadCredential"/>
<variablelist class="dbus-property" generated="True" extra-ref="SupplementaryGroups"/>
<variablelist class="dbus-property" generated="True" extra-ref="PAMName"/>
@ -8450,6 +8542,10 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
<variablelist class="dbus-property" generated="True" extra-ref="KeyringMode"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProtectProc"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProcSubset"/>
<variablelist class="dbus-property" generated="True" extra-ref="ProtectHostname"/>
<variablelist class="dbus-property" generated="True" extra-ref="NetworkNamespacePath"/>

View File

@ -23,7 +23,8 @@
<refsynopsisdiv>
<para><filename>systemd-backlight@.service</filename></para>
<para><filename>/usr/lib/systemd/systemd-backlight</filename></para>
<para><filename>/usr/lib/systemd/systemd-backlight</filename> save [backlight|leds]:DEVICE</para>
<para><filename>/usr/lib/systemd/systemd-backlight</filename> load [backlight|leds]:DEVICE</para>
</refsynopsisdiv>
<refsect1>

View File

@ -38,6 +38,9 @@ relative_source_path = run_command('realpath',
project_source_root).stdout().strip()
conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
conf.set10('DEVELOPER_MODE', get_option('mode') == 'developer',
description : 'enable additional checks only suitable in development')
want_ossfuzz = get_option('oss-fuzz')
want_libfuzzer = get_option('llvm-fuzz')
if want_ossfuzz + want_libfuzzer > 1
@ -1634,6 +1637,7 @@ make_directive_index_py = find_program('tools/make-directive-index.py')
make_man_index_py = find_program('tools/make-man-index.py')
syscall_names_update_sh = find_program('tools/syscall-names-update.sh')
xml_helper_py = find_program('tools/xml_helper.py')
update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
############################################################

View File

@ -4,6 +4,9 @@
option('version-tag', type : 'string',
description : 'override the git version string')
option('mode', type : 'combo', choices : ['default', 'developer'],
description : 'enable additional checks suitable for systemd development')
option('split-usr', type : 'combo', choices : ['auto', 'true', 'false'],
description : '''/bin, /sbin aren't symlinks into /usr''')
option('split-bin', type : 'combo', choices : ['auto', 'true', 'false'],

View File

@ -13,11 +13,36 @@
#include "main-func.h"
#include "mkdir.h"
#include "parse-util.h"
#include "pretty-print.h"
#include "terminal-util.h"
#include "reboot-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
static int help(void) {
_cleanup_free_ char *link = NULL;
int r;
r = terminal_urlify_man("systemd-backlight", "8", &link);
if (r < 0)
return log_oom();
printf("%s save [backlight|leds]:DEVICE\n"
"%s load [backlight|leds]:DEVICE\n"
"\n%sSave and restore backlight brightness at shutdown and boot.%s\n\n"
" save Save current brightness\n"
" load Set brightness to be the previously saved value\n"
"\nSee the %s for details.\n"
, program_invocation_short_name
, program_invocation_short_name
, ansi_highlight(), ansi_normal()
, link
);
return 0;
}
static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) {
const char *subsystem, *sysname, *value;
sd_device *parent;
@ -334,6 +359,9 @@ static int run(int argc, char *argv[]) {
log_setup_service();
if (strv_contains(strv_skip(argv, 1), "--help"))
return help();
if (argc != 3)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program requires two arguments.");

View File

@ -6,31 +6,34 @@
/* 3a101b8de0d39403b2c7e5c23fd0b005668acf48 (3.16) */
#ifndef CAP_AUDIT_READ
# define CAP_AUDIT_READ 37
#undef CAP_LAST_CAP
#define CAP_LAST_CAP CAP_AUDIT_READ
#endif
/* 980737282232b752bb14dab96d77665c15889c36 (5.8) */
#ifndef CAP_PERFMON
# define CAP_PERFMON 38
#undef CAP_LAST_CAP
#define CAP_LAST_CAP CAP_PERFMON
#endif
/* a17b53c4a4b55ec322c132b6670743612229ee9c (5.8) */
#ifndef CAP_BPF
# define CAP_BPF 39
#undef CAP_LAST_CAP
#define CAP_LAST_CAP CAP_BPF
#endif
/* 124ea650d3072b005457faed69909221c2905a1f (5.9) */
#ifndef CAP_CHECKPOINT_RESTORE
# define CAP_CHECKPOINT_RESTORE 40
#undef CAP_LAST_CAP
#define CAP_LAST_CAP CAP_CHECKPOINT_RESTORE
#endif
#define SYSTEMD_CAP_LAST_CAP CAP_CHECKPOINT_RESTORE
#ifdef CAP_LAST_CAP
# if CAP_LAST_CAP > SYSTEMD_CAP_LAST_CAP
# if DEVELOPER_MODE && defined(TEST_CAPABILITY_C)
# warning "The capability list here is outdated"
# endif
# else
# undef CAP_LAST_CAP
# endif
#endif
#ifndef CAP_LAST_CAP
# define CAP_LAST_CAP SYSTEMD_CAP_LAST_CAP
#endif

View File

@ -915,20 +915,19 @@ static int device_dispatch_io(sd_device_monitor *monitor, sd_device *dev, void *
return 0;
}
if (action == DEVICE_ACTION_CHANGE)
if (!IN_SET(action, DEVICE_ACTION_ADD, DEVICE_ACTION_REMOVE, DEVICE_ACTION_MOVE))
device_propagate_reload_by_sysfs(m, sysfs);
/* A change event can signal that a device is becoming ready, in particular if
* the device is using the SYSTEMD_READY logic in udev
* so we need to reach the else block of the following if, even for change events */
/* A change event can signal that a device is becoming ready, in particular if the device is using
* the SYSTEMD_READY logic in udev so we need to reach the else block of the following if, even for
* change events */
if (action == DEVICE_ACTION_REMOVE) {
r = swap_process_device_remove(m, dev);
if (r < 0)
log_device_warning_errno(dev, r, "Failed to process swap device remove event, ignoring: %m");
/* If we get notified that a device was removed by
* udev, then it's completely gone, hence unset all
* found bits */
/* If we get notified that a device was removed by udev, then it's completely gone, hence
* unset all found bits */
device_update_found_by_sysfs(m, sysfs, 0, DEVICE_FOUND_UDEV|DEVICE_FOUND_MOUNT|DEVICE_FOUND_SWAP);
} else if (device_is_ready(dev)) {
@ -944,13 +943,10 @@ static int device_dispatch_io(sd_device_monitor *monitor, sd_device *dev, void *
/* The device is found now, set the udev found bit */
device_update_found_by_sysfs(m, sysfs, DEVICE_FOUND_UDEV, DEVICE_FOUND_UDEV);
} else {
/* The device is nominally around, but not ready for
* us. Hence unset the udev bit, but leave the rest
* around. */
} else
/* The device is nominally around, but not ready for us. Hence unset the udev bit, but leave
* the rest around. */
device_update_found_by_sysfs(m, sysfs, 0, DEVICE_FOUND_UDEV);
}
return 0;
}

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include <sys/file.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/types.h>

View File

@ -7,6 +7,8 @@
#include <sys/wait.h>
#include <unistd.h>
#define TEST_CAPABILITY_C
#include "alloc-util.h"
#include "capability-util.h"
#include "errno-util.h"

View File

@ -350,7 +350,7 @@ int main(int argc, char *argv[]) {
assert_se(set_unit_path(test_path) >= 0);
assert_se(runtime_dir = setup_fake_runtime_dir());
for (const test_function_t *test = tests; test && *test; test++) {
for (const test_function_t *test = tests; *test; test++) {
Manager *m = NULL;
int r;

View File

@ -28,7 +28,6 @@ test_create_image() {
instmods dm_verity =md
install_dmevent
generate_module_dependencies
inst_binary sfdisk
inst_binary losetup
BASICTOOLS=(
@ -41,7 +40,7 @@ test_create_image() {
mkdir -p $initdir
setup_basic_dirs
install_basic_tools
inst /usr/lib/os-release
cp $os_release $initdir/usr/lib/os-release
ln -s ../usr/lib/os-release $initdir/etc/os-release
echo MARKER=1 >> $initdir/usr/lib/os-release
mksquashfs $initdir $oldinitdir/usr/share/minimal.raw

View File

@ -9,7 +9,8 @@ mkdir -p "$root"
mkdir "$root/bin"
cp $(type -P busybox) "$root/bin"
ID_LIKE=$(awk -F= '$1=="ID_LIKE" { print $2 ;}' /etc/os-release)
os_release=$(test -e /etc/os-release && echo /etc/os-release || echo /usr/lib/os-release)
ID_LIKE=$(awk -F= '$1=="ID_LIKE" { print $2 ;}' $os_release)
if [[ "$ID_LIKE" = *"suse"* ]]; then
mkdir -p "$root/lib"
mkdir -p "$root/lib64"

View File

@ -4,9 +4,10 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
LOOKS_LIKE_DEBIAN=$(source /etc/os-release && [[ "$ID" = "debian" || " $ID_LIKE " = *" debian "* ]] && echo yes || :)
LOOKS_LIKE_ARCH=$(source /etc/os-release && [[ "$ID" = "arch" || " $ID_LIKE " = *" arch "* ]] && echo yes || :)
LOOKS_LIKE_SUSE=$(source /etc/os-release && [[ " $ID_LIKE " = *" suse "* ]] && echo yes || :)
os_release=$(test -e /etc/os-release && echo /etc/os-release || echo /usr/lib/os-release)
LOOKS_LIKE_DEBIAN=$(source $os_release && [[ "$ID" = "debian" || " $ID_LIKE " = *" debian "* ]] && echo yes || :)
LOOKS_LIKE_ARCH=$(source $os_release && [[ "$ID" = "arch" || " $ID_LIKE " = *" arch "* ]] && echo yes || :)
LOOKS_LIKE_SUSE=$(source $os_release && [[ " $ID_LIKE " = *" suse "* ]] && echo yes || :)
KERNEL_VER=${KERNEL_VER-$(uname -r)}
KERNEL_MODS="/lib/modules/$KERNEL_VER/"
QEMU_TIMEOUT="${QEMU_TIMEOUT:-infinity}"
@ -639,7 +640,8 @@ install_dmevent() {
}
install_systemd() {
# install compiled files
ddebug "Install compiled systemd"
local _ninja_bin=$(type -P ninja || type -P ninja-build)
if [[ -z "$_ninja_bin" ]]; then
dfatal "ninja was not found"
@ -648,9 +650,6 @@ install_systemd() {
(set -x; DESTDIR=$initdir "$_ninja_bin" -C $BUILD_DIR install)
# remove unneeded documentation
rm -fr $initdir/usr/share/{man,doc}
# we strip binaries since debug symbols increase binaries size a lot
# and it could fill the available space
strip_binaries
[[ "$LOOKS_LIKE_SUSE" ]] && setup_suse
@ -940,7 +939,7 @@ install_config_files() {
inst /etc/shells
inst_any /etc/nsswitch.conf /usr/etc/nsswitch.conf
inst /etc/pam.conf || :
inst /etc/os-release
inst_any /etc/os-release /usr/lib/os-release
inst /etc/localtime
# we want an empty environment
> $initdir/etc/environment

View File

@ -28,22 +28,24 @@ cp /usr/share/minimal.* "${image_dir}/"
image="${image_dir}/minimal"
roothash="$(cat ${image}.roothash)"
os_release=$(test -e /etc/os-release && echo /etc/os-release || echo /usr/lib/os-release)
systemd-dissect --json=short ${image}.raw | grep -q -F '{"rw":"ro","designator":"root","partition_uuid":null,"fstype":"squashfs","architecture":null,"verity":"external"'
systemd-dissect ${image}.raw | grep -q -F "MARKER=1"
systemd-dissect ${image}.raw | grep -q -F -f /usr/lib/os-release
systemd-dissect ${image}.raw | grep -q -F -f $os_release
mv ${image}.verity ${image}.fooverity
mv ${image}.roothash ${image}.foohash
systemd-dissect --json=short ${image}.raw --root-hash=${roothash} --verity-data=${image}.fooverity | grep -q -F '{"rw":"ro","designator":"root","partition_uuid":null,"fstype":"squashfs","architecture":null,"verity":"external"'
systemd-dissect ${image}.raw --root-hash=${roothash} --verity-data=${image}.fooverity | grep -q -F "MARKER=1"
systemd-dissect ${image}.raw --root-hash=${roothash} --verity-data=${image}.fooverity | grep -q -F -f /usr/lib/os-release
systemd-dissect ${image}.raw --root-hash=${roothash} --verity-data=${image}.fooverity | grep -q -F -f $os_release
mv ${image}.fooverity ${image}.verity
mv ${image}.foohash ${image}.roothash
mkdir -p ${image_dir}/mount ${image_dir}/mount2
systemd-dissect --mount ${image}.raw ${image_dir}/mount
cat ${image_dir}/mount/usr/lib/os-release | grep -q -F -f /usr/lib/os-release
cat ${image_dir}/mount/etc/os-release | grep -q -F -f /usr/lib/os-release
cat ${image_dir}/mount/usr/lib/os-release | grep -q -F -f $os_release
cat ${image_dir}/mount/etc/os-release | grep -q -F -f $os_release
cat ${image_dir}/mount/usr/lib/os-release | grep -q -F "MARKER=1"
# Verity volume should be shared (opened only once)
systemd-dissect --mount ${image}.raw ${image_dir}/mount2
@ -118,11 +120,11 @@ VERITY_UUID=$(systemd-id128 -u show $(tail -c 32 ${image}.roothash) -u | tail -n
systemd-dissect --json=short --root-hash ${roothash} ${image}.gpt | grep -q '{"rw":"ro","designator":"root","partition_uuid":"'$ROOT_UUID'","fstype":"squashfs","architecture":"x86-64","verity":"yes","node":'
systemd-dissect --json=short --root-hash ${roothash} ${image}.gpt | grep -q '{"rw":"ro","designator":"root-verity","partition_uuid":"'$VERITY_UUID'","fstype":"DM_verity_hash","architecture":"x86-64","verity":null,"node":'
systemd-dissect --root-hash ${roothash} ${image}.gpt | grep -q -F "MARKER=1"
systemd-dissect --root-hash ${roothash} ${image}.gpt | grep -q -F -f /usr/lib/os-release
systemd-dissect --root-hash ${roothash} ${image}.gpt | grep -q -F -f $os_release
systemd-dissect --root-hash ${roothash} --mount ${image}.gpt ${image_dir}/mount
cat ${image_dir}/mount/usr/lib/os-release | grep -q -F -f /usr/lib/os-release
cat ${image_dir}/mount/etc/os-release | grep -q -F -f /usr/lib/os-release
cat ${image_dir}/mount/usr/lib/os-release | grep -q -F -f $os_release
cat ${image_dir}/mount/etc/os-release | grep -q -F -f $os_release
cat ${image_dir}/mount/usr/lib/os-release | grep -q -F "MARKER=1"
umount ${image_dir}/mount

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1+
import argparse
import collections
import sys
import os
@ -14,8 +15,6 @@ PARSER = etree.XMLParser(no_network=True,
strip_cdata=False,
resolve_entities=False)
PRINT_ERRORS = True
class NoCommand(Exception):
pass
@ -37,7 +36,7 @@ def print_method(declarations, elem, *, prefix, file, is_signal=False):
argname = arg.get('name')
if argname is None:
if PRINT_ERRORS:
if opts.print_errors:
print(f'method {name}: argument {num+1} has no name', file=sys.stderr)
argname = 'UNNAMED'
@ -120,9 +119,11 @@ def document_has_elem_with_text(document, elem, item_repr):
else:
return False
def check_documented(document, declarations):
def check_documented(document, declarations, stats):
missing = []
for klass, items in declarations.items():
stats['total'] += len(items)
for item in items:
if klass == 'method':
elem = 'function'
@ -137,10 +138,12 @@ def check_documented(document, declarations):
assert False, (klass, item)
if not document_has_elem_with_text(document, elem, item_repr):
if PRINT_ERRORS:
if opts.print_errors:
print(f'{klass} {item} is not documented :(')
missing.append((klass, item))
stats['missing'] += len(missing)
return missing
def xml_to_text(destination, xml, *, only_interface=None):
@ -165,7 +168,7 @@ def xml_to_text(destination, xml, *, only_interface=None):
return file.getvalue(), declarations, interfaces
def subst_output(document, programlisting):
def subst_output(document, programlisting, stats):
executable = programlisting.get('executable', None)
if executable is None:
# Not our thing
@ -174,7 +177,7 @@ def subst_output(document, programlisting):
node = programlisting.get('node')
interface = programlisting.get('interface')
argv = [f'{build_dir}/{executable}', f'--bus-introspect={interface}']
argv = [f'{opts.build_dir}/{executable}', f'--bus-introspect={interface}']
print(f'COMMAND: {shlex.join(argv)}')
try:
@ -189,7 +192,7 @@ def subst_output(document, programlisting):
programlisting.text = '\n' + new_text + ' '
if declarations:
missing = check_documented(document, declarations)
missing = check_documented(document, declarations, stats)
parent = programlisting.getparent()
# delete old comments
@ -253,9 +256,11 @@ def process(page):
if xml.tag != 'refentry':
return
stats = collections.Counter()
pls = xml.findall('.//programlisting')
for pl in pls:
subst_output(xml, pl)
subst_output(xml, pl, stats)
out_text = etree.tostring(xml, encoding='unicode')
# massage format to avoid some lxml whitespace handling idiosyncrasies
@ -264,20 +269,44 @@ def process(page):
out_text[out_text.find('<refentryinfo'):] +
'\n')
if not opts.test:
with open(page, 'w') as out:
out.write(out_text)
return dict(stats=stats, outdated=(out_text != src))
def parse_args():
p = argparse.ArgumentParser()
p.add_argument('--test', action='store_true',
help='only verify that everything is up2date')
p.add_argument('--build-dir', default='build')
p.add_argument('pages', nargs='+')
opts = p.parse_args()
opts.print_errors = not opts.test
return opts
if __name__ == '__main__':
pages = sys.argv[1:]
opts = parse_args()
if pages[0].startswith('--build-dir='):
build_dir = pages[0].partition('=')[2]
pages = pages[1:]
else:
build_dir = 'build'
if not os.path.exists(f'{opts.build_dir}/systemd'):
exit(f"{opts.build_dir}/systemd doesn't exist. Use --build-dir=.")
if not os.path.exists(f'{build_dir}/systemd'):
exit(f"{build_dir}/systemd doesn't exist. Use --build-dir=.")
stats = {page.split('/')[-1] : process(page) for page in opts.pages}
for page in pages:
process(page)
# Let's print all statistics at the end
mlen = max(len(page) for page in stats)
total = sum((item['stats'] for item in stats.values()), start=collections.Counter())
total = 'total', dict(stats=total, outdated=False)
outdated = []
for page, info in sorted(stats.items()) + [total]:
m = info['stats']['missing']
t = info['stats']['total']
p = page + ':'
c = 'OUTDATED' if info['outdated'] else ''
if c:
outdated.append(page)
print(f'{p:{mlen + 1}} {t - m}/{t} {c}')
if opts.test and outdated:
exit(f'Outdated pages: {", ".join(outdated)}\n'
f'Hint: ninja -C {opts.build_dir} man/update-dbus-docs')