1
0
mirror of https://github.com/systemd/systemd synced 2026-04-17 20:44:52 +02:00

Compare commits

..

No commits in common. "df4ec48f45f518b6926e02ef4d77c8ed1a8b4e2c" and "ac16a593cf4ecf8dd04b8be78fd2e8fd2fe55991" have entirely different histories.

8 changed files with 59 additions and 71 deletions

View File

@ -19,7 +19,7 @@ support_url = get_option('support-url')
support_sed = 's~%SUPPORT_URL%~@0@~'.format(support_url) support_sed = 's~%SUPPORT_URL%~@0@~'.format(support_url)
foreach file : in_files foreach file : in_files
catalogs += custom_target( custom_target(
file, file,
input : file + '.in', input : file + '.in',
output: file, output: file,

View File

@ -226,8 +226,7 @@ update_dbus_docs = custom_target(
if conf.get('BUILD_MODE_DEVELOPER') == 1 if conf.get('BUILD_MODE_DEVELOPER') == 1
test('dbus-docs-fresh', test('dbus-docs-fresh',
update_dbus_docs_py, update_dbus_docs_py,
args : ['--build-dir', project_build_root, '--test', dbus_docs], args : ['--build-dir', project_build_root, '--test', dbus_docs])
depends : dbus_programs)
endif endif
update_man_rules = custom_target( update_man_rules = custom_target(

View File

@ -1765,7 +1765,6 @@ conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
tests = [] tests = []
fuzzers = [] fuzzers = []
catalogs = []
############################################################ ############################################################
@ -2073,8 +2072,7 @@ foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
test('dlopen-nss_' + module, test('dlopen-nss_' + module,
test_dlopen, test_dlopen,
# path to dlopen must include a slash # path to dlopen must include a slash
args : nss.full_path(), args : nss.full_path())
depends : nss)
endif endif
endif endif
endforeach endforeach
@ -2188,8 +2186,7 @@ if want_tests != 'false'
test('test-fstab-generator', test('test-fstab-generator',
test_fstab_generator_sh, test_fstab_generator_sh,
# https://github.com/mesonbuild/meson/issues/2681 # https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path(), args : exe.full_path())
depends : exe)
endif endif
if conf.get('ENABLE_ENVIRONMENT_D') == 1 if conf.get('ENABLE_ENVIRONMENT_D') == 1
@ -2340,8 +2337,7 @@ if conf.get('ENABLE_LOGIND') == 1
test('dlopen-pam_systemd', test('dlopen-pam_systemd',
test_dlopen, test_dlopen,
# path to dlopen must include a slash # path to dlopen must include a slash
args : pam_systemd.full_path(), args : pam_systemd.full_path())
depends : pam_systemd)
endif endif
endif endif
@ -2680,7 +2676,7 @@ if conf.get('HAVE_LIBCRYPTSETUP') == 1
endif endif
if conf.get('HAVE_SYSV_COMPAT') == 1 if conf.get('HAVE_SYSV_COMPAT') == 1
exe = executable( executable(
'systemd-sysv-generator', 'systemd-sysv-generator',
'src/sysv-generator/sysv-generator.c', 'src/sysv-generator/sysv-generator.c',
include_directories : includes, include_directories : includes,
@ -2689,13 +2685,6 @@ if conf.get('HAVE_SYSV_COMPAT') == 1
install : true, install : true,
install_dir : systemgeneratordir) install_dir : systemgeneratordir)
sysv_generator_test_py = find_program('test/sysv-generator-test.py')
if want_tests != 'false'
test('sysv-generator-test',
sysv_generator_test_py,
depends : exe)
endif
executable( executable(
'systemd-rc-local-generator', 'systemd-rc-local-generator',
'src/rc-local-generator/rc-local-generator.c', 'src/rc-local-generator/rc-local-generator.c',
@ -3579,8 +3568,7 @@ if want_tests != 'false'
test('test-network-generator-conversion', test('test-network-generator-conversion',
test_network_generator_conversion_sh, test_network_generator_conversion_sh,
# https://github.com/mesonbuild/meson/issues/2681 # https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path(), args : exe.full_path())
depends : exe)
endif endif
executable( executable(
@ -3594,14 +3582,13 @@ executable(
############################################################ ############################################################
runtest_env = custom_target( custom_target(
'systemd-runtest.env', 'systemd-runtest.env',
output : 'systemd-runtest.env', output : 'systemd-runtest.env',
command : [sh, '-c', command : [sh, '-c',
'{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format( '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
project_source_root / 'test', project_source_root / 'test',
project_build_root / 'catalog')], project_build_root / 'catalog')],
depends : catalogs,
build_by_default : true) build_by_default : true)
test_cflags = ['-DTEST_CODE=1'] test_cflags = ['-DTEST_CODE=1']
@ -3644,8 +3631,7 @@ foreach tuple : tests
build_by_default : want_tests != 'false', build_by_default : want_tests != 'false',
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : install_tests, install : install_tests,
install_dir : testsdir / type, install_dir : testsdir / type)
link_depends : runtest_env)
if type == 'manual' if type == 'manual'
message('@0@ is a manual test'.format(name)) message('@0@ is a manual test'.format(name))
@ -3838,8 +3824,7 @@ foreach exec : public_programs
if want_tests != 'false' if want_tests != 'false'
test('check-help-' + name, test('check-help-' + name,
check_help, check_help,
args : exec.full_path(), args : exec.full_path())
depends: exec)
endif endif
endforeach endforeach

View File

@ -195,7 +195,7 @@ efi_cflags += cc.get_supported_arguments({
if get_option('werror') if get_option('werror')
efi_cflags += ['-Werror'] efi_cflags += ['-Werror']
endif endif
if get_option('debug') and get_option('mode') == 'developer' if get_option('debug')
efi_cflags += ['-ggdb', '-DEFI_DEBUG'] efi_cflags += ['-ggdb', '-DEFI_DEBUG']
endif endif
if get_option('optimization') != '0' if get_option('optimization') != '0'
@ -213,15 +213,13 @@ foreach arg : get_option('c_args')
if arg in [ if arg in [
'-DNDEBUG', '-DNDEBUG',
'-fno-lto', '-fno-lto',
'-g', '-ggdb',
'-O1', '-O2', '-O3', '-Og', '-Os', '-O1', '-O2', '-O3', '-Og', '-Os',
'-Werror', '-Werror',
] or arg.split('=')[0] in [ ] or arg.split('=')[0] in [
'-ffile-prefix-map', '-ffile-prefix-map',
'-flto', '-flto',
] or (get_option('mode') == 'developer' and arg in [ ]
'-DEFI_DEBUG',
'-g', '-ggdb',
])
message('Using "@0@" from c_args for EFI compiler'.format(arg)) message('Using "@0@" from c_args for EFI compiler'.format(arg))
efi_cflags += arg efi_cflags += arg

View File

@ -399,7 +399,7 @@ void process_audit_string(Server *s, int type, const char *data, size_t size) {
z = n; z = n;
map_all_fields(p, map_fields_kernel, "_AUDIT_FIELD_", true, iovec, &n, n + N_IOVEC_AUDIT_FIELDS); map_all_fields(p, map_fields_kernel, "_AUDIT_FIELD_", true, iovec, &n, ELEMENTSOF(iovec));
server_dispatch_message(s, iovec, n, ELEMENTSOF(iovec), NULL, NULL, LOG_NOTICE, 0); server_dispatch_message(s, iovec, n, ELEMENTSOF(iovec), NULL, NULL, LOG_NOTICE, 0);

View File

@ -152,7 +152,7 @@ foreach prog : udev_progs
install : true, install : true,
install_dir : udevlibexecdir) install_dir : udevlibexecdir)
udev_prog_paths += {name : exe} udev_prog_paths += {name : exe.full_path()}
endforeach endforeach
if install_sysconfdir_samples if install_sysconfdir_samples

View File

@ -47,8 +47,6 @@ static const char *arg_export_prefix = NULL;
static usec_t arg_wait_for_initialization_timeout = 0; static usec_t arg_wait_for_initialization_timeout = 0;
static bool skip_attribute(const char *name) { static bool skip_attribute(const char *name) {
assert(name);
/* Those are either displayed separately or should not be shown at all. */ /* Those are either displayed separately or should not be shown at all. */
return STR_IN_SET(name, return STR_IN_SET(name,
"uevent", "uevent",
@ -68,9 +66,6 @@ typedef struct SysAttr {
STATIC_DESTRUCTOR_REGISTER(arg_properties, strv_freep); STATIC_DESTRUCTOR_REGISTER(arg_properties, strv_freep);
static int sysattr_compare(const SysAttr *a, const SysAttr *b) { static int sysattr_compare(const SysAttr *a, const SysAttr *b) {
assert(a);
assert(b);
return strcmp(a->name, b->name); return strcmp(a->name, b->name);
} }
@ -80,8 +75,6 @@ static int print_all_attributes(sd_device *device, bool is_parent) {
size_t n_items = 0; size_t n_items = 0;
int r; int r;
assert(device);
value = NULL; value = NULL;
(void) sd_device_get_devpath(device, &value); (void) sd_device_get_devpath(device, &value);
printf(" looking at %sdevice '%s':\n", is_parent ? "parent " : "", strempty(value)); printf(" looking at %sdevice '%s':\n", is_parent ? "parent " : "", strempty(value));
@ -146,8 +139,6 @@ static int print_device_chain(sd_device *device) {
sd_device *child, *parent; sd_device *child, *parent;
int r; int r;
assert(device);
printf("\n" printf("\n"
"Udevadm info starts with the device specified by the devpath and then\n" "Udevadm info starts with the device specified by the devpath and then\n"
"walks up the chain of parent devices. It prints for every device\n" "walks up the chain of parent devices. It prints for every device\n"
@ -173,8 +164,6 @@ static int print_record(sd_device *device) {
const char *str, *val; const char *str, *val;
int i; int i;
assert(device);
(void) sd_device_get_devpath(device, &str); (void) sd_device_get_devpath(device, &str);
printf("P: %s\n", str); printf("P: %s\n", str);
@ -201,8 +190,6 @@ static int print_record(sd_device *device) {
static int stat_device(const char *name, bool export, const char *prefix) { static int stat_device(const char *name, bool export, const char *prefix) {
struct stat statbuf; struct stat statbuf;
assert(name);
if (stat(name, &statbuf) != 0) if (stat(name, &statbuf) != 0)
return -errno; return -errno;
@ -242,11 +229,11 @@ static int export_devices(void) {
} }
static void cleanup_dir(DIR *dir, mode_t mask, int depth) { static void cleanup_dir(DIR *dir, mode_t mask, int depth) {
assert(dir);
if (depth <= 0) if (depth <= 0)
return; return;
assert(dir);
FOREACH_DIRENT_ALL(dent, dir, break) { FOREACH_DIRENT_ALL(dent, dir, break) {
struct stat stats; struct stat stats;
@ -274,27 +261,38 @@ static void cleanup_dir(DIR *dir, mode_t mask, int depth) {
* entries for devices in /run/udev/data (such as "b8:16"), and removes * entries for devices in /run/udev/data (such as "b8:16"), and removes
* all files except those that haven't been deleted in /run/udev/data * all files except those that haven't been deleted in /run/udev/data
* (i.e. they were skipped during db cleanup because of the db_persist flag). * (i.e. they were skipped during db cleanup because of the db_persist flag).
* Returns true if the directory is empty after cleanup.
*/ */
static void cleanup_dir_after_db_cleanup(DIR *dir, DIR *datadir) { static bool cleanup_dir_after_db_cleanup(DIR *dir, DIR *datadir) {
assert(dir); unsigned int kept = 0;
assert(datadir);
assert(dir && datadir);
FOREACH_DIRENT_ALL(dent, dir, break) { FOREACH_DIRENT_ALL(dent, dir, break) {
struct stat data_stats, link_stats;
if (dot_or_dot_dot(dent->d_name)) if (dot_or_dot_dot(dent->d_name))
continue; continue;
if (fstatat(dirfd(dir), dent->d_name, &link_stats, AT_SYMLINK_NOFOLLOW) < 0) {
if (faccessat(dirfd(datadir), dent->d_name, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) if (errno != ENOENT)
/* The corresponding udev database file still exists. kept++;
* Assuming the parsistent flag is set for the database. */
continue; continue;
(void) unlinkat(dirfd(dir), dent->d_name, 0);
} }
if (fstatat(dirfd(datadir), dent->d_name, &data_stats, 0) < 0)
(void) unlinkat(dirfd(dir), dent->d_name,
S_ISDIR(link_stats.st_mode) ? AT_REMOVEDIR : 0);
else
/* The entry still exists under /run/udev/data */
kept++;
}
return kept == 0;
} }
static void cleanup_dirs_after_db_cleanup(DIR *dir, DIR *datadir) { static void cleanup_dirs_after_db_cleanup(DIR *dir, DIR *datadir) {
assert(dir);
assert(datadir); assert(dir && datadir);
FOREACH_DIRENT_ALL(dent, dir, break) { FOREACH_DIRENT_ALL(dent, dir, break) {
struct stat stats; struct stat stats;
@ -307,9 +305,7 @@ static void cleanup_dirs_after_db_cleanup(DIR *dir, DIR *datadir) {
_cleanup_closedir_ DIR *dir2 = NULL; _cleanup_closedir_ DIR *dir2 = NULL;
dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC));
if (dir2) if (dir2 && cleanup_dir_after_db_cleanup(dir2, datadir))
cleanup_dir_after_db_cleanup(dir2, datadir);
(void) unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR); (void) unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR);
} else } else
(void) unlinkat(dirfd(dir), dent->d_name, 0); (void) unlinkat(dirfd(dir), dent->d_name, 0);
@ -317,7 +313,7 @@ static void cleanup_dirs_after_db_cleanup(DIR *dir, DIR *datadir) {
} }
static void cleanup_db(void) { static void cleanup_db(void) {
_cleanup_closedir_ DIR *dir1 = NULL, *dir2 = NULL, *dir3 = NULL, *dir4 = NULL; _cleanup_closedir_ DIR *dir1 = NULL, *dir2 = NULL, *dir3 = NULL, *dir4 = NULL, *dir5 = NULL;
dir1 = opendir("/run/udev/data"); dir1 = opendir("/run/udev/data");
if (dir1) if (dir1)
@ -335,8 +331,9 @@ static void cleanup_db(void) {
if (dir4) if (dir4)
cleanup_dir(dir4, 0, 2); cleanup_dir(dir4, 0, 2);
/* Do not remove /run/udev/watch. It will be handled by udevd well on restart. dir5 = opendir("/run/udev/watch");
* And should not be removed by external program when udevd is running. */ if (dir5)
cleanup_dir_after_db_cleanup(dir5, dir1);
} }
static int query_device(QueryType query, sd_device* device) { static int query_device(QueryType query, sd_device* device) {
@ -402,10 +399,10 @@ static int query_device(QueryType query, sd_device* device) {
case QUERY_ALL: case QUERY_ALL:
return print_record(device); return print_record(device);
default:
assert_not_reached();
} }
assert_not_reached();
return 0;
} }
static int help(void) { static int help(void) {

View File

@ -116,6 +116,16 @@ endif
############################################################ ############################################################
if conf.get('HAVE_SYSV_COMPAT') == 1
sysv_generator_test_py = find_program('sysv-generator-test.py')
if want_tests != 'false'
test('sysv-generator-test',
sysv_generator_test_py)
endif
endif
############################################################
if install_tests if install_tests
install_data('run-unit-tests.py', install_data('run-unit-tests.py',
install_mode : 'rwxr-xr-x', install_mode : 'rwxr-xr-x',
@ -174,10 +184,9 @@ if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
test(name, test(name,
udev_dmi_memory_id_test, udev_dmi_memory_id_test,
args : [udev_prog_paths['dmi_memory_id'].full_path(), args : [udev_prog_paths['dmi_memory_id'],
source, source,
source + '.txt'], source + '.txt'])
depends : udev_prog_paths['dmi_memory_id'])
endforeach endforeach
endif endif