1
0
mirror of https://github.com/systemd/systemd synced 2025-11-08 19:34:45 +01:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Luca Boccassi
08de6f945d test: run systemd-dissect and systemd-run with log level debug in TEST-50-DISSECT 2020-07-21 10:03:10 +09:00
Hans de Goede
3a978b30cd logind: Fix org.freedesktop.login1.set-reboot-to-boot-loader-menu saving to the wrong file in the non EFI case
According to the docs, and to the
org.freedesktop.login1.get-reboot-to-boot-loader-menu code, the
(oneshot) boot-loader-menu timeout should be stored in
/run/systemd/reboot-to-boot-loader-menu, but the set method was storing it
in /run/systemd/reboot-to-loader-menu.

This commit fixes this. Note that the fixed name also is a better match
for the dbus call names and matches the related
/run/systemd/reboot-to-boot-loader-entry structure, so fixing the set code,
rather then the get code + docs seems like the right thing to do here.
2020-07-21 10:02:34 +09:00
fangxiuning
ddbab78f9a bus: use bus_log_connect_error to print error message 2020-07-21 10:02:01 +09:00
13 changed files with 31 additions and 23 deletions

View File

@ -627,7 +627,7 @@ static int analyze_plot(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, &use_full_bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
n = acquire_boot_times(bus, &boot);
if (n < 0)
@ -1026,7 +1026,7 @@ static int analyze_critical_chain(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
n = acquire_time_data(bus, &times);
if (n <= 0)
@ -1069,7 +1069,7 @@ static int analyze_blame(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
n = acquire_time_data(bus, &times);
if (n <= 0)
@ -1126,7 +1126,7 @@ static int analyze_time(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
r = pretty_boot_time(bus, &buf);
if (r < 0)
@ -1264,7 +1264,7 @@ static int dot(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
r = expand_patterns(bus, strv_skip(argv, 1), &expanded_patterns);
if (r < 0)
@ -1341,7 +1341,7 @@ static int dump(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
(void) pager_open(arg_pager_flags);
@ -1412,7 +1412,7 @@ static int set_log_level(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
r = bus_set_property(bus, bus_systemd_mgr, "LogLevel", &error, "s", argv[1]);
if (r < 0)
@ -1429,7 +1429,7 @@ static int get_log_level(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
r = bus_get_property_string(bus, bus_systemd_mgr, "LogLevel", &error, &level);
if (r < 0)
@ -1453,7 +1453,7 @@ static int set_log_target(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
r = bus_set_property(bus, bus_systemd_mgr, "LogTarget", &error, "s", argv[1]);
if (r < 0)
@ -1470,7 +1470,7 @@ static int get_log_target(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
r = bus_get_property_string(bus, bus_systemd_mgr, "LogTarget", &error, &target);
if (r < 0)
@ -2053,7 +2053,7 @@ static int service_watchdogs(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
if (argc == 1) {
/* get ServiceWatchdogs */
@ -2091,7 +2091,7 @@ static int do_security(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
(void) pager_open(arg_pager_flags);

View File

@ -197,7 +197,7 @@ static int run(int argc, char *argv[]) {
arg_show_unit == SHOW_UNIT_USER,
&bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
}
q = show_cgroup_get_unit_path_and_warn(bus, *name, &cgroup);

View File

@ -444,7 +444,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, false, &bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
return hostnamectl_main(bus, argc, argv);
}

View File

@ -511,7 +511,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, false, &bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
return localectl_main(bus, argc, argv);
}

View File

@ -1475,7 +1475,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, false, &bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
(void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);

View File

@ -2855,14 +2855,14 @@ static int method_set_reboot_to_boot_loader_menu(
return r;
} else {
if (x == UINT64_MAX) {
if (unlink("/run/systemd/reboot-to-loader-menu") < 0 && errno != ENOENT)
if (unlink("/run/systemd/reboot-to-boot-loader-menu") < 0 && errno != ENOENT)
return -errno;
} else {
char buf[DECIMAL_STR_MAX(uint64_t) + 1];
xsprintf(buf, "%" PRIu64, x); /* µs granularity */
r = write_string_file_atomic_label("/run/systemd/reboot-to-loader-menu", buf);
r = write_string_file_atomic_label("/run/systemd/reboot-to-boot-loader-menu", buf);
if (r < 0)
return r;
}

View File

@ -2897,7 +2897,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, false, &bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
(void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);

View File

@ -1456,7 +1456,7 @@ static int run(int argc, char* argv[]) {
r = bus_connect_transport_systemd(arg_transport, arg_host, arg_user, &bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
if (arg_action == ACTION_UMOUNT)
return action_umount(bus, argc, argv);

View File

@ -1753,7 +1753,7 @@ static int run(int argc, char* argv[]) {
else
r = bus_connect_transport_systemd(arg_transport, arg_host, arg_user, &bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
if (arg_scope)
r = start_transient_scope(bus);

View File

@ -37,6 +37,9 @@ int bus_connect_user_systemd(sd_bus **_bus);
int bus_connect_transport(BusTransport transport, const char *host, bool user, sd_bus **bus);
int bus_connect_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus);
#define bus_log_connect_error(r) \
log_error_errno(r, "Failed to create bus connection: %m")
#define bus_log_parse_error(r) \
log_error_errno(r, "Failed to parse bus message: %m")

View File

@ -371,7 +371,7 @@ int show_cgroup_get_path_and_warn(
r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, false, &bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
r = show_cgroup_get_unit_path_and_warn(bus, unit, &root);
if (r < 0)

View File

@ -1062,7 +1062,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, false, &bus);
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
return bus_log_connect_error(r);
return timedatectl_main(bus, argc, argv);
}

View File

@ -4,6 +4,8 @@
set -ex
set -o pipefail
export SYSTEMD_LOG_LEVEL=debug
cleanup()
{
if [ -z "${image_dir}" ]; then
@ -70,6 +72,9 @@ elif [ "${machine}" = "arm" ]; then
elif [ "${machine}" = "ia64" ]; then
root_guid=993d8d3d-f80e-4225-855a-9daf8ed7ea97
verity_guid=86ed10d5-b607-45bb-8957-d350f23d0571
else
echo "Unexpected uname -m: ${machine} in testsuite-50.sh, please fix me"
exit 1
fi
# du rounds up to block size, which is more helpful for partitioning
root_size="$(du -k ${image}.raw | cut -f1)"