diff --git a/srcpkgs/elogind/files/007-fix-non_portable_percent_m.patch b/srcpkgs/elogind/files/007-fix-non_portable_percent_m.patch new file mode 100644 index 00000000000..6ce6b44986d --- /dev/null +++ b/srcpkgs/elogind/files/007-fix-non_portable_percent_m.patch @@ -0,0 +1,1744 @@ +--- src/cgroups-agent/cgroups-agent.c 2016-03-06 16:00:52.027398234 +0100 ++++ src/cgroups-agent/cgroups-agent.c 2017-03-04 16:53:10.369345842 +0100 +@@ -44,7 +44,7 @@ + system bus. */ + r = sd_bus_open_system(&bus); + if (r < 0) { +- log_debug_errno(r, "Failed to open system bus: %m"); ++ log_debug_errno(r, "Failed to open system bus: %s", error_str()); + return EXIT_FAILURE; + } + +@@ -54,7 +54,7 @@ + "Released", + "s", argv[1]); + if (r < 0) { +- log_debug_errno(r, "Failed to send signal message: %m"); ++ log_debug_errno(r, "Failed to send signal message: %s", error_str()); + return EXIT_FAILURE; + } + +--- src/libelogind/sd-bus/bus-kernel.c 2015-04-19 13:32:24.607347468 +0200 ++++ src/libelogind/sd-bus/bus-kernel.c 2017-03-04 16:53:10.410345905 +0100 +@@ -1161,7 +1161,7 @@ + + /* Anybody can send us invalid messages, let's just drop them. */ + if (r == -EBADMSG || r == -EPROTOTYPE) +- log_debug_errno(r, "Ignoring invalid synchronous reply: %m"); ++ log_debug_errno(r, "Ignoring invalid synchronous reply: %s", error_str()); + else + return r; + } +@@ -1369,7 +1369,7 @@ + + /* Anybody can send us invalid messages, let's just drop them. */ + if (r == -EBADMSG || r == -EPROTOTYPE) { +- log_debug_errno(r, "Ignoring invalid message: %m"); ++ log_debug_errno(r, "Ignoring invalid message: %s", error_str()); + r = 0; + } + +@@ -1765,14 +1765,14 @@ + + r = get_proc_cmdline_key("kdbus.attach_flags_mask=", &mask); + if (r < 0) +- return log_warning_errno(r, "Failed to read kernel command line: %m"); ++ return log_warning_errno(r, "Failed to read kernel command line: %s", error_str()); + + if (r == 0) { + sprintf(buf, "0x%" PRIx64 "\n", m); + r = write_string_file("/sys/module/kdbus/parameters/attach_flags_mask", buf); + if (r < 0) + return log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r, +- "Failed to write kdbus attach mask: %m"); ++ "Failed to write kdbus attach mask: %s", error_str()); + } + + return 0; +--- src/libelogind/sd-bus/bus-track.c 2015-04-19 13:32:24.611347468 +0200 ++++ src/libelogind/sd-bus/bus-track.c 2017-03-04 16:53:10.415345912 +0100 +@@ -308,7 +308,7 @@ + + r = track->handler(track, track->userdata); + if (r < 0) +- log_debug_errno(r, "Failed to process track handler: %m"); ++ log_debug_errno(r, "Failed to process track handler: %s", error_str()); + else if (r == 0) + bus_track_add_to_queue(track); + +--- src/libelogind/sd-bus/bus-util.c 2017-03-04 16:54:39.916484983 +0100 ++++ src/libelogind/sd-bus/bus-util.c 2017-03-04 16:53:10.425345927 +0100 +@@ -1294,11 +1294,11 @@ + #endif + + int bus_log_parse_error(int r) { +- return log_error_errno(r, "Failed to parse bus message: %m"); ++ return log_error_errno(r, "Failed to parse bus message: %s", error_str()); + } + + int bus_log_create_error(int r) { +- return log_error_errno(r, "Failed to create bus message: %m"); ++ return log_error_errno(r, "Failed to create bus message: %s", error_str()); + } + + int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { +@@ -1782,7 +1782,7 @@ + + q = bus_process_wait(d->bus); + if (q < 0) +- return log_error_errno(q, "Failed to wait for response: %m"); ++ return log_error_errno(q, "Failed to wait for response: %s", error_str()); + + if (d->result) { + q = check_wait_response(d, quiet); +@@ -1791,7 +1791,7 @@ + if (q < 0 && r == 0) + r = q; + +- log_debug_errno(q, "Got result %s/%m for job %s", strna(d->result), strna(d->name)); ++ log_debug_errno(q, "Got result %s/%s for job %s", strna(d->result), error_str(), strna(d->name)); + } + + free(d->name); +--- src/libelogind/sd-device/device-private.c 2015-04-19 13:32:24.611347468 +0200 ++++ src/libelogind/sd-device/device-private.c 2017-03-04 16:53:10.363345832 +0100 +@@ -381,43 +381,43 @@ + /* the caller must verify or trust this data (e.g., if it comes from the kernel) */ + r = device_set_syspath(device, path, false); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set syspath to '%s': %m", path); ++ return log_debug_errno(r, "sd-device: could not set syspath to '%s': %s", path, error_str()); + } else if (streq(key, "SUBSYSTEM")) { + r = device_set_subsystem(device, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set subsystem to '%s': %m", value); ++ return log_debug_errno(r, "sd-device: could not set subsystem to '%s': %s", value, error_str()); + } else if (streq(key, "DEVTYPE")) { + r = device_set_devtype(device, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set devtype to '%s': %m", value); ++ return log_debug_errno(r, "sd-device: could not set devtype to '%s': %s", value, error_str()); + } else if (streq(key, "DEVNAME")) { + r = device_set_devname(device, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set devname to '%s': %m", value); ++ return log_debug_errno(r, "sd-device: could not set devname to '%s': %s", value, error_str()); + } else if (streq(key, "USEC_INITIALIZED")) { + r = device_set_usec_initialized(device, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set usec-initialized to '%s': %m", value); ++ return log_debug_errno(r, "sd-device: could not set usec-initialized to '%s': %s", value, error_str()); + } else if (streq(key, "DRIVER")) { + r = device_set_driver(device, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set driver to '%s': %m", value); ++ return log_debug_errno(r, "sd-device: could not set driver to '%s': %s", value, error_str()); + } else if (streq(key, "IFINDEX")) { + r = device_set_ifindex(device, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set ifindex to '%s': %m", value); ++ return log_debug_errno(r, "sd-device: could not set ifindex to '%s': %s", value, error_str()); + } else if (streq(key, "DEVMODE")) { + r = device_set_devmode(device, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set devmode to '%s': %m", value); ++ return log_debug_errno(r, "sd-device: could not set devmode to '%s': %s", value, error_str()); + } else if (streq(key, "DEVUID")) { + r = device_set_devuid(device, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set devuid to '%s': %m", value); ++ return log_debug_errno(r, "sd-device: could not set devuid to '%s': %s", value, error_str()); + } else if (streq(key, "DEVGID")) { + r = device_set_devgid(device, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set devgid to '%s': %m", value); ++ return log_debug_errno(r, "sd-device: could not set devgid to '%s': %s", value, error_str()); + } else if (streq(key, "DEVLINKS")) { + char *devlinks, *next; + +@@ -428,7 +428,7 @@ + + r = device_add_devlink(device, devlinks); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not add devlink '%s': %m", devlinks); ++ return log_debug_errno(r, "sd-device: could not add devlink '%s': %s", devlinks, error_str()); + + devlinks = next + 1; + } +@@ -442,14 +442,14 @@ + + r = device_add_tag(device, tags); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not add tag '%s': %m", tags); ++ return log_debug_errno(r, "sd-device: could not add tag '%s': %s", tags, error_str()); + + tags = next + 1; + } + } else { + r = device_add_property_internal(device, key, value); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not add property '%s=%s': %m", key, value); ++ return log_debug_errno(r, "sd-device: could not add property '%s=%s': %s", key, value, error_str()); + } + + return 0; +@@ -572,7 +572,7 @@ + if (major) { + r = device_set_devnum(device, major, minor); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set devnum %s:%s: %m", major, minor); ++ return log_debug_errno(r, "sd-device: could not set devnum %s:%s: %s", major, minor, error_str()); + } + + r = device_verify(device, action, seqnum); +@@ -621,7 +621,7 @@ + if (major) { + r = device_set_devnum(device, major, minor); + if (r < 0) +- return log_debug_errno(r, "sd-device: could not set devnum %s:%s: %m", major, minor); ++ return log_debug_errno(r, "sd-device: could not set devnum %s:%s: %s", major, minor, error_str()); + } + + r = device_verify(device, action, seqnum); +--- src/libelogind/sd-device/sd-device.c 2017-03-04 16:54:39.917484985 +0100 ++++ src/libelogind/sd-device/sd-device.c 2017-03-04 16:53:10.435345943 +0100 +@@ -163,7 +163,7 @@ + /* not a symlink */ + syspath = canonicalize_file_name(_syspath); + if (!syspath) { +- log_debug("sd-device: could not canonicalize '%s': %m", _syspath); ++ log_debug("sd-device: could not canonicalize '%s': %s", _syspath, error_str()); + return -errno; + } + /* ignore errors due to the link not being a symlink */ +@@ -179,7 +179,7 @@ + path = strjoina(syspath, "/uevent"); + r = access(path, F_OK); + if (r < 0) { +- log_debug("sd-device: %s does not have an uevent file: %m", syspath); ++ log_debug("sd-device: %s does not have an uevent file: %s", syspath, error_str()); + return -errno; + } + } else { +--- src/libelogind/sd-event/sd-event.c 2015-04-19 13:32:24.611347468 +0200 ++++ src/libelogind/sd-event/sd-event.c 2017-03-04 16:53:10.448345963 +0100 +@@ -2164,9 +2164,9 @@ + + if (r < 0) { + if (s->description) +- log_debug_errno(r, "Event source '%s' returned error, disabling: %m", s->description); ++ log_debug_errno(r, "Event source '%s' returned error, disabling: %s", s->description, error_str()); + else +- log_debug_errno(r, "Event source %p returned error, disabling: %m", s); ++ log_debug_errno(r, "Event source %p returned error, disabling: %s", s, error_str()); + } + + if (s->n_ref == 0) +@@ -2202,9 +2202,9 @@ + + if (r < 0) { + if (s->description) +- log_debug_errno(r, "Prepare callback of event source '%s' returned error, disabling: %m", s->description); ++ log_debug_errno(r, "Prepare callback of event source '%s' returned error, disabling: %s", s->description, error_str()); + else +- log_debug_errno(r, "Prepare callback of event source %p returned error, disabling: %m", s); ++ log_debug_errno(r, "Prepare callback of event source %p returned error, disabling: %s", s, error_str()); + } + + if (s->n_ref == 0) +--- src/libelogind/sd-rtnl/rtnl-util.c 2015-04-19 13:32:24.615347468 +0200 ++++ src/libelogind/sd-rtnl/rtnl-util.c 2017-03-04 16:53:10.453345970 +0100 +@@ -165,9 +165,9 @@ + } + + int rtnl_log_parse_error(int r) { +- return log_error_errno(r, "Failed to parse netlink message: %m"); ++ return log_error_errno(r, "Failed to parse netlink message: %s", error_str()); + } + + int rtnl_log_create_error(int r) { +- return log_error_errno(r, "Failed to create netlink message: %m"); ++ return log_error_errno(r, "Failed to create netlink message: %s", error_str()); + } +--- src/libelogind/sd-rtnl/sd-rtnl.c 2015-04-19 13:32:24.615347468 +0200 ++++ src/libelogind/sd-rtnl/sd-rtnl.c 2017-03-04 16:53:10.460345981 +0100 +@@ -413,7 +413,7 @@ + + r = c->callback(rtnl, m, c->userdata); + if (r < 0) +- log_debug_errno(r, "sd-rtnl: timedout callback failed: %m"); ++ log_debug_errno(r, "sd-rtnl: timedout callback failed: %s", error_str()); + + free(c); + +@@ -446,7 +446,7 @@ + + r = c->callback(rtnl, m, c->userdata); + if (r < 0) +- log_debug_errno(r, "sd-rtnl: callback failed: %m"); ++ log_debug_errno(r, "sd-rtnl: callback failed: %s", error_str()); + + return 1; + } +@@ -468,7 +468,7 @@ + r = c->callback(rtnl, m, c->userdata); + if (r != 0) { + if (r < 0) +- log_debug_errno(r, "sd-rtnl: match callback failed: %m"); ++ log_debug_errno(r, "sd-rtnl: match callback failed: %s", error_str()); + + break; + } +--- src/login/inhibit.c 2017-03-04 16:54:39.925484998 +0100 ++++ src/login/inhibit.c 2017-03-04 16:53:10.430345935 +0100 +@@ -235,7 +235,7 @@ + + r = sd_bus_default_system(&bus); + if (r < 0) { +- log_error_errno(r, "Failed to connect to bus: %m"); ++ log_error_errno(r, "Failed to connect to bus: %s", error_str()); + return EXIT_FAILURE; + } + +@@ -266,7 +266,7 @@ + + pid = fork(); + if (pid < 0) { +- log_error_errno(errno, "Failed to fork: %m"); ++ log_error_errno(errno, "Failed to fork: %s", error_str()); + return EXIT_FAILURE; + } + +@@ -276,7 +276,7 @@ + close_all_fds(NULL, 0); + + execvp(argv[optind], argv + optind); +- log_error_errno(errno, "Failed to execute %s: %m", argv[optind]); ++ log_error_errno(errno, "Failed to execute %s: %s", argv[optind], error_str()); + _exit(EXIT_FAILURE); + } + +--- src/login/loginctl.c 2017-03-04 16:54:39.925484998 +0100 ++++ src/login/loginctl.c 2017-03-04 16:53:10.484346018 +0100 +@@ -408,7 +408,7 @@ + + r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i); + if (r < 0) +- return log_error_errno(r, "Could not get properties: %m"); ++ return log_error_errno(r, "Could not get properties: %s", error_str()); + + if (*new_line) + printf("\n"); +@@ -537,7 +537,7 @@ + + r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i); + if (r < 0) { +- log_error_errno(r, "Could not get properties: %m"); ++ log_error_errno(r, "Could not get properties: %s", error_str()); + goto finish; + } + +@@ -615,7 +615,7 @@ + + r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i); + if (r < 0) { +- log_error_errno(r, "Could not get properties: %m"); ++ log_error_errno(r, "Could not get properties: %s", error_str()); + goto finish; + } + +@@ -670,7 +670,7 @@ + + r = bus_print_all_properties(bus, "org.freedesktop.login1", path, arg_property, arg_all); + if (r < 0) +- log_error_errno(r, "Could not get properties: %m"); ++ log_error_errno(r, "Could not get properties: %s", error_str()); + + return r; + } +@@ -760,7 +760,7 @@ + + r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL); + if (r < 0) +- return log_error_errno(r, "Failed to look up user %s: %m", argv[i]); ++ return log_error_errno(r, "Failed to look up user %s: %s", argv[i], error_str()); + + r = sd_bus_call_method( + bus, +@@ -954,7 +954,7 @@ + else { + r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL); + if (r < 0) +- return log_error_errno(r, "Failed to look up user %s: %m", argv[i]); ++ return log_error_errno(r, "Failed to look up user %s: %s", argv[i], error_str()); + } + + r = sd_bus_call_method( +@@ -989,7 +989,7 @@ + + r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL); + if (r < 0) +- return log_error_errno(r, "Failed to look up user %s: %m", argv[i]); ++ return log_error_errno(r, "Failed to look up user %s: %s", argv[i], error_str()); + + r = sd_bus_call_method( + bus, +@@ -1026,7 +1026,7 @@ + + r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL); + if (r < 0) +- return log_error_errno(r, "Failed to look up user %s: %m", argv[i]); ++ return log_error_errno(r, "Failed to look up user %s: %s", argv[i], error_str()); + + r = sd_bus_call_method( + bus, +@@ -1638,7 +1638,7 @@ + + r = bus_open_transport(arg_transport, arg_host, false, &bus); + if (r < 0) { +- log_error_errno(r, "Failed to create bus connection: %m"); ++ log_error_errno(r, "Failed to create bus connection: %s", error_str()); + goto finish; + } + +--- src/login/logind-action.c 2017-03-04 16:54:39.909484972 +0100 ++++ src/login/logind-action.c 2017-03-04 16:53:10.496346036 +0100 +@@ -160,7 +160,7 @@ + static int run_helper(const char *helper) { + int pid = fork(); + if (pid < 0) { +- return log_error_errno(errno, "Failed to fork: %m"); ++ return log_error_errno(errno, "Failed to fork: %s", error_str()); + } + + if (pid == 0) { +@@ -169,7 +169,7 @@ + close_all_fds(NULL, 0); + + execlp(helper, helper, NULL); +- log_error_errno(errno, "Failed to execute %s: %m", helper); ++ log_error_errno(errno, "Failed to execute %s: %s", helper, error_str()); + _exit(EXIT_FAILURE); + } + +@@ -187,14 +187,14 @@ + if (k == 0) + return 0; + +- log_debug_errno(k, "Failed to write '%s' to /sys/power/disk: %m", +- *mode); ++ log_debug_errno(k, "Failed to write '%s' to /sys/power/disk: %s", ++ *mode, error_str()); + if (r == 0) + r = k; + } + + if (r < 0) +- log_error_errno(r, "Failed to write mode to /sys/power/disk: %m"); ++ log_error_errno(r, "Failed to write mode to /sys/power/disk: %s", error_str()); + + return r; + } +@@ -209,15 +209,15 @@ + k = write_string_stream(*f, *state); + if (k == 0) + return 0; +- log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", +- *state); ++ log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %s", ++ *state, error_str()); + if (r == 0) + r = k; + + fclose(*f); + *f = fopen("/sys/power/state", "we"); + if (!*f) +- return log_error_errno(errno, "Failed to open /sys/power/state: %m"); ++ return log_error_errno(errno, "Failed to open /sys/power/state: %s", error_str()); + } + + return r; +@@ -238,7 +238,7 @@ + * we can abort before modifying any state. */ + f = fopen("/sys/power/state", "we"); + if (!f) +- return log_error_errno(errno, "Failed to open /sys/power/state: %m"); ++ return log_error_errno(errno, "Failed to open /sys/power/state: %s", error_str()); + + /* Configure the hibernation mode */ + r = write_mode(modes); +--- src/login/logind-button.c 2015-04-19 13:32:24.639347469 +0200 ++++ src/login/logind-button.c 2017-03-04 16:53:10.490346027 +0100 +@@ -248,17 +248,17 @@ + + b->fd = open(p, O_RDWR|O_CLOEXEC|O_NOCTTY|O_NONBLOCK); + if (b->fd < 0) +- return log_warning_errno(errno, "Failed to open %s: %m", b->name); ++ return log_warning_errno(errno, "Failed to open %s: %s", b->name, error_str()); + + if (ioctl(b->fd, EVIOCGNAME(sizeof(name)), name) < 0) { +- log_error_errno(errno, "Failed to get input name: %m"); ++ log_error_errno(errno, "Failed to get input name: %s", error_str()); + r = -errno; + goto fail; + } + + r = sd_event_add_io(b->manager->event, &b->io_event_source, b->fd, EPOLLIN, button_dispatch, b); + if (r < 0) { +- log_error_errno(r, "Failed to add button event: %m"); ++ log_error_errno(r, "Failed to add button event: %s", error_str()); + goto fail; + } + +--- src/login/logind-core.c 2016-03-06 16:00:52.027398234 +0100 ++++ src/login/logind-core.c 2017-03-04 16:53:10.502346045 +0100 +@@ -500,7 +500,7 @@ + * assume that we are docked. */ + n = manager_count_displays(m); + if (n < 0) +- log_warning_errno(n, "Display counting failed: %m"); ++ log_warning_errno(n, "Display counting failed: %s", error_str()); + else if (n > 1) { + log_debug("Multiple (%i) displays connected.", n); + return true; +--- src/login/logind-dbus.c 2016-03-17 09:22:03.403779113 +0100 ++++ src/login/logind-dbus.c 2017-03-04 16:53:10.510346058 +0100 +@@ -1217,7 +1217,7 @@ + d = opendir("/etc/udev/rules.d"); + if (!d) { + if (errno != ENOENT) +- log_warning_errno(errno, "Failed to open /etc/udev/rules.d: %m"); ++ log_warning_errno(errno, "Failed to open /etc/udev/rules.d: %s", error_str()); + } else { + struct dirent *de; + +@@ -1233,7 +1233,7 @@ + continue; + + if (unlinkat(dirfd(d), de->d_name, 0) < 0) +- log_warning_errno(errno, "Failed to unlink %s: %m", de->d_name); ++ log_warning_errno(errno, "Failed to unlink %s: %s", de->d_name, error_str()); + } + } + +--- src/login/logind-inhibit.c 2015-04-19 13:32:24.643347470 +0200 ++++ src/login/logind-inhibit.c 2017-03-04 16:53:10.466345990 +0100 +@@ -137,7 +137,7 @@ + + finish: + if (r < 0) +- log_error_errno(r, "Failed to save inhibit data %s: %m", i->state_file); ++ log_error_errno(r, "Failed to save inhibit data %s: %s", i->state_file, error_str()); + + return r; + } +--- src/login/logind-seat.c 2015-08-23 11:10:58.890333172 +0200 ++++ src/login/logind-seat.c 2017-03-04 16:53:10.515346065 +0100 +@@ -149,7 +149,7 @@ + + finish: + if (r < 0) +- log_error_errno(r, "Failed to save seat data %s: %m", s->state_file); ++ log_error_errno(r, "Failed to save seat data %s: %s", s->state_file, error_str()); + + return r; + } +@@ -188,7 +188,7 @@ + !!s->active, s->active ? s->active->user->uid : 0); + + if (r < 0) +- log_error_errno(r, "Failed to apply ACLs: %m"); ++ log_error_errno(r, "Failed to apply ACLs: %s", error_str()); + + return r; + } +--- src/login/logind-session.c 2016-03-06 16:00:52.103398185 +0100 ++++ src/login/logind-session.c 2017-03-04 16:53:10.474346002 +0100 +@@ -278,7 +278,7 @@ + + finish: + if (r < 0) +- log_error_errno(r, "Failed to save session data %s: %m", s->state_file); ++ log_error_errno(r, "Failed to save session data %s: %s", s->state_file, error_str()); + + return r; + } +@@ -324,7 +324,7 @@ + NULL); + + if (r < 0) +- return log_error_errno(r, "Failed to read %s: %m", s->state_file); ++ return log_error_errno(r, "Failed to read %s: %s", s->state_file, error_str()); + + if (!s->user) { + uid_t u; +@@ -487,11 +487,11 @@ + /* First, create our own group */ + r = cg_create(SYSTEMD_CGROUP_CONTROLLER, s->id); + if (r < 0) +- return log_error_errno(r, "Failed to create cgroup %s: %m", s->id); ++ return log_error_errno(r, "Failed to create cgroup %s: %s", s->id, error_str()); + + r = cg_attach(SYSTEMD_CGROUP_CONTROLLER, s->id, s->leader); + if (r < 0) +- log_warning_errno(r, "Failed to attach PID %d to cgroup %s: %m", s->leader, s->id); ++ log_warning_errno(r, "Failed to attach PID %d to cgroup %s: %s", s->leader, s->id, error_str()); + + return 0; + } +@@ -899,7 +899,7 @@ + /* FIXME: verify that leader is in cgroup? */ + + if (kill(s->leader, signo) < 0) { +- return log_error_errno(errno, "Failed to kill process leader %d for session %s: %m", s->leader, s->id); ++ return log_error_errno(errno, "Failed to kill process leader %d for session %s: %s", s->leader, s->id, error_str()); + } + return 0; + } else { +@@ -923,7 +923,7 @@ + sprintf(path, "/dev/tty%u", s->vtnr); + s->vtfd = open(path, O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY); + if (s->vtfd < 0) +- return log_error_errno(errno, "cannot open VT %s of session %s: %m", path, s->id); ++ return log_error_errno(errno, "cannot open VT %s of session %s: %s", path, s->id, error_str()); + + return s->vtfd; + } +@@ -942,21 +942,21 @@ + r = fchown(vt, s->user->uid, -1); + if (r < 0) { + r = -errno; +- log_error_errno(errno, "Cannot change owner of /dev/tty%u: %m", s->vtnr); ++ log_error_errno(errno, "Cannot change owner of /dev/tty%u: %s", s->vtnr, error_str()); + goto error; + } + + r = ioctl(vt, KDSKBMODE, K_OFF); + if (r < 0) { + r = -errno; +- log_error_errno(errno, "Cannot set K_OFF on /dev/tty%u: %m", s->vtnr); ++ log_error_errno(errno, "Cannot set K_OFF on /dev/tty%u: %s", s->vtnr, error_str()); + goto error; + } + + r = ioctl(vt, KDSETMODE, KD_GRAPHICS); + if (r < 0) { + r = -errno; +- log_error_errno(errno, "Cannot set KD_GRAPHICS on /dev/tty%u: %m", s->vtnr); ++ log_error_errno(errno, "Cannot set KD_GRAPHICS on /dev/tty%u: %s", s->vtnr, error_str()); + goto error; + } + +@@ -969,7 +969,7 @@ + r = ioctl(vt, VT_SETMODE, &mode); + if (r < 0) { + r = -errno; +- log_error_errno(errno, "Cannot set VT_PROCESS on /dev/tty%u: %m", s->vtnr); ++ log_error_errno(errno, "Cannot set VT_PROCESS on /dev/tty%u: %s", s->vtnr, error_str()); + goto error; + } + +@@ -1026,7 +1026,7 @@ + session_device_pause_all(s); + r = ioctl(s->vtfd, VT_RELDISP, 1); + if (r < 0) +- log_debug_errno(errno, "Cannot release VT of session %s: %m", s->id); ++ log_debug_errno(errno, "Cannot release VT of session %s: %s", s->id, error_str()); + } + + bool session_is_controller(Session *s, const char *sender) { +--- src/login/logind-user.c 2016-03-06 16:00:52.031398232 +0100 ++++ src/login/logind-user.c 2017-03-04 16:53:10.529346087 +0100 +@@ -228,7 +228,7 @@ + + finish: + if (r < 0) +- log_error_errno(r, "Failed to save user data %s: %m", u->state_file); ++ log_error_errno(r, "Failed to save user data %s: %s", u->state_file, error_str()); + + return r; + } +@@ -250,7 +250,7 @@ + if (r == -ENOENT) + return 0; + +- log_error_errno(r, "Failed to read %s: %m", u->state_file); ++ log_error_errno(r, "Failed to read %s: %s", u->state_file, error_str()); + return r; + } + +@@ -283,7 +283,7 @@ + + r = mkdir_safe_label("/run/user", 0755, 0, 0); + if (r < 0) +- return log_error_errno(r, "Failed to create /run/user: %m"); ++ return log_error_errno(r, "Failed to create /run/user: %s", error_str()); + + if (!u->runtime_path) { + if (asprintf(&p, "/run/user/" UID_FMT, u->uid) < 0) +@@ -308,7 +308,7 @@ + r = mount("tmpfs", p, "tmpfs", MS_NODEV|MS_NOSUID, t); + if (r < 0) { + if (errno != EPERM) { +- r = log_error_errno(errno, "Failed to mount per-user tmpfs directory %s: %m", p); ++ r = log_error_errno(errno, "Failed to mount per-user tmpfs directory %s: %s", p, error_str()); + goto fail; + } + +@@ -318,7 +318,7 @@ + + r = chmod_and_chown(p, 0700, u->uid, u->gid); + if (r < 0) { +- log_error_errno(r, "Failed to change runtime directory ownership and mode: %m"); ++ log_error_errno(r, "Failed to change runtime directory ownership and mode: %s", error_str()); + goto fail; + } + } +@@ -376,18 +376,18 @@ + + r = rm_rf(u->runtime_path, false, false, false); + if (r < 0) +- log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path); ++ log_error_errno(r, "Failed to remove runtime directory %s: %s", u->runtime_path, error_str()); + + /* Ignore cases where the directory isn't mounted, as that's + * quite possible, if we lacked the permissions to mount + * something */ + r = umount2(u->runtime_path, MNT_DETACH); + if (r < 0 && errno != EINVAL && errno != ENOENT) +- log_error_errno(errno, "Failed to unmount user runtime directory %s: %m", u->runtime_path); ++ log_error_errno(errno, "Failed to unmount user runtime directory %s: %s", u->runtime_path, error_str()); + + r = rm_rf(u->runtime_path, false, true, false); + if (r < 0) +- log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path); ++ log_error_errno(r, "Failed to remove runtime directory %s: %s", u->runtime_path, error_str()); + + free(u->runtime_path); + u->runtime_path = NULL; +--- src/login/logind.c 2016-03-06 16:00:52.031398232 +0100 ++++ src/login/logind.c 2017-03-04 16:53:10.399345888 +0100 +@@ -302,7 +302,7 @@ + if (errno == ENOENT) + return 0; + +- log_error_errno(errno, "Failed to open /run/systemd/seats: %m"); ++ log_error_errno(errno, "Failed to open /run/systemd/seats: %s", error_str()); + return -errno; + } + +@@ -339,7 +339,7 @@ + if (errno == ENOENT) + return 0; + +- log_error_errno(errno, "Failed to open /var/lib/systemd/linger/: %m"); ++ log_error_errno(errno, "Failed to open /var/lib/systemd/linger/: %s", error_str()); + return -errno; + } + +@@ -351,7 +351,7 @@ + + k = manager_add_user_by_name(m, de->d_name, NULL); + if (k < 0) { +- log_notice_errno(k, "Couldn't add lingering user %s: %m", de->d_name); ++ log_notice_errno(k, "Couldn't add lingering user %s: %s", de->d_name, error_str()); + r = k; + } + } +@@ -375,7 +375,7 @@ + if (errno == ENOENT) + return 0; + +- log_error_errno(errno, "Failed to open /run/systemd/users: %m"); ++ log_error_errno(errno, "Failed to open /run/systemd/users: %s", error_str()); + return -errno; + } + +@@ -387,7 +387,7 @@ + + k = manager_add_user_by_name(m, de->d_name, &u); + if (k < 0) { +- log_error_errno(k, "Failed to add user by file name %s: %m", de->d_name); ++ log_error_errno(k, "Failed to add user by file name %s: %s", de->d_name, error_str()); + + r = k; + continue; +@@ -416,7 +416,7 @@ + if (errno == ENOENT) + return 0; + +- log_error_errno(errno, "Failed to open /run/systemd/sessions: %m"); ++ log_error_errno(errno, "Failed to open /run/systemd/sessions: %s", error_str()); + return -errno; + } + +@@ -435,7 +435,7 @@ + + k = manager_add_session(m, de->d_name, &s); + if (k < 0) { +- log_error_errno(k, "Failed to add session by file name %s: %m", de->d_name); ++ log_error_errno(k, "Failed to add session by file name %s: %s", de->d_name, error_str()); + + r = k; + continue; +@@ -463,7 +463,7 @@ + if (errno == ENOENT) + return 0; + +- log_error_errno(errno, "Failed to open /run/systemd/inhibit: %m"); ++ log_error_errno(errno, "Failed to open /run/systemd/inhibit: %s", error_str()); + return -errno; + } + +@@ -476,7 +476,7 @@ + + k = manager_add_inhibitor(m, de->d_name, &i); + if (k < 0) { +- log_notice_errno(k, "Couldn't add inhibitor %s: %m", de->d_name); ++ log_notice_errno(k, "Couldn't add inhibitor %s: %s", de->d_name, error_str()); + r = k; + continue; + } +@@ -580,11 +580,11 @@ + + r = sd_bus_default_system(&m->bus); + if (r < 0) +- return log_error_errno(r, "Failed to connect to system bus: %m"); ++ return log_error_errno(r, "Failed to connect to system bus: %s", error_str()); + + r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/login1", "org.freedesktop.login1.Manager", manager_vtable, m); + if (r < 0) +- return log_error_errno(r, "Failed to add manager object vtable: %m"); ++ return log_error_errno(r, "Failed to add manager object vtable: %s", error_str()); + + r = sd_bus_add_match(m->bus, NULL, + "type='signal'," +@@ -595,35 +595,35 @@ + + r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/seat", "org.freedesktop.login1.Seat", seat_vtable, seat_object_find, m); + if (r < 0) +- return log_error_errno(r, "Failed to add seat object vtable: %m"); ++ return log_error_errno(r, "Failed to add seat object vtable: %s", error_str()); + + r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/seat", seat_node_enumerator, m); + if (r < 0) +- return log_error_errno(r, "Failed to add seat enumerator: %m"); ++ return log_error_errno(r, "Failed to add seat enumerator: %s", error_str()); + + r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/session", "org.freedesktop.login1.Session", session_vtable, session_object_find, m); + if (r < 0) +- return log_error_errno(r, "Failed to add session object vtable: %m"); ++ return log_error_errno(r, "Failed to add session object vtable: %s", error_str()); + + r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/session", session_node_enumerator, m); + if (r < 0) +- return log_error_errno(r, "Failed to add session enumerator: %m"); ++ return log_error_errno(r, "Failed to add session enumerator: %s", error_str()); + + r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/user", "org.freedesktop.login1.User", user_vtable, user_object_find, m); + if (r < 0) +- return log_error_errno(r, "Failed to add user object vtable: %m"); ++ return log_error_errno(r, "Failed to add user object vtable: %s", error_str()); + + r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/user", user_node_enumerator, m); + if (r < 0) +- return log_error_errno(r, "Failed to add user enumerator: %m"); ++ return log_error_errno(r, "Failed to add user enumerator: %s", error_str()); + + r = sd_bus_request_name(m->bus, "org.freedesktop.login1", 0); + if (r < 0) +- return log_error_errno(r, "Failed to register name: %m"); ++ return log_error_errno(r, "Failed to register name: %s", error_str()); + + r = sd_bus_attach_event(m->bus, m->event, 0); + if (r < 0) +- return log_error_errno(r, "Failed to attach bus to event loop: %m"); ++ return log_error_errno(r, "Failed to attach bus to event loop: %s", error_str()); + + return 0; + } +@@ -681,7 +681,7 @@ + + r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 0, &m->cgroup_root); + if (r < 0) +- return log_error_errno(r, "Cannot determine cgroup we are running in: %m"); ++ return log_error_errno(r, "Cannot determine cgroup we are running in: %s", error_str()); + + /* Make sure to store away the root value without trailing + * slash, even for the root dir, so that we can easily prepend +@@ -692,14 +692,14 @@ + /* 2. Show data */ + r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, NULL, &path); + if (r < 0) +- return log_error_errno(r, "Cannot find cgroup mount point: %m"); ++ return log_error_errno(r, "Cannot find cgroup mount point: %s", error_str()); + + log_debug("Using cgroup controller " SYSTEMD_CGROUP_CONTROLLER ". File system hierarchy is at %s.", path); + + /* 3. Install agent */ + r = cg_install_release_agent(SYSTEMD_CGROUP_CONTROLLER, SYSTEMD_CGROUP_AGENT_PATH); + if (r < 0) +- log_warning_errno(r, "Failed to install release agent, ignoring: %m"); ++ log_warning_errno(r, "Failed to install release agent, ignoring: %s", error_str()); + else if (r > 0) + log_debug("Installed release agent."); + else +@@ -708,14 +708,14 @@ + /* 4. Make sure we are in the root cgroup */ + r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, 0); + if (r < 0) +- return log_error_errno(r, "Failed to create root cgroup hierarchy: %m"); ++ return log_error_errno(r, "Failed to create root cgroup hierarchy: %s", error_str()); + + /* 5. And pin it, so that it cannot be unmounted */ + safe_close(m->pin_cgroupfs_fd); + + m->pin_cgroupfs_fd = open(path, O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY|O_NONBLOCK); + if (m->pin_cgroupfs_fd < 0) +- return log_error_errno(errno, "Failed to open pin file: %m"); ++ return log_error_errno(errno, "Failed to open pin file: %s", error_str()); + + return 0; + } +@@ -740,7 +740,7 @@ + if (errno == ENOENT) + return 0; + +- log_error_errno(errno, "Failed to open /sys/class/tty/tty0/active: %m"); ++ log_error_errno(errno, "Failed to open /sys/class/tty/tty0/active: %s", error_str()); + return -errno; + } + +@@ -764,11 +764,11 @@ + + r = ignore_signals(SIGRTMIN + 1, -1); + if (r < 0) +- return log_error_errno(r, "Cannot ignore SIGRTMIN + 1: %m"); ++ return log_error_errno(r, "Cannot ignore SIGRTMIN + 1: %s", error_str()); + + r = sigprocmask_many(SIG_BLOCK, SIGRTMIN, -1); + if (r < 0) +- return log_error_errno(r, "Cannot block SIGRTMIN: %m"); ++ return log_error_errno(r, "Cannot block SIGRTMIN: %s", error_str()); + + r = sd_event_add_signal(m->event, NULL, SIGRTMIN, manager_vt_switch, m); + if (r < 0) +@@ -950,19 +950,19 @@ + elapse, USEC_PER_SEC*30, + manager_dispatch_idle_action, m); + if (r < 0) +- return log_error_errno(r, "Failed to add idle event source: %m"); ++ return log_error_errno(r, "Failed to add idle event source: %s", error_str()); + + r = sd_event_source_set_priority(m->idle_action_event_source, SD_EVENT_PRIORITY_IDLE+10); + if (r < 0) +- return log_error_errno(r, "Failed to set idle event source priority: %m"); ++ return log_error_errno(r, "Failed to set idle event source priority: %s", error_str()); + } else { + r = sd_event_source_set_time(m->idle_action_event_source, elapse); + if (r < 0) +- return log_error_errno(r, "Failed to set idle event timer: %m"); ++ return log_error_errno(r, "Failed to set idle event timer: %s", error_str()); + + r = sd_event_source_set_enabled(m->idle_action_event_source, SD_EVENT_ONESHOT); + if (r < 0) +- return log_error_errno(r, "Failed to enable idle event timer: %m"); ++ return log_error_errno(r, "Failed to enable idle event timer: %s", error_str()); + } + + return 0; +@@ -992,7 +992,7 @@ + /* Connect to udev */ + r = manager_connect_udev(m); + if (r < 0) +- return log_error_errno(r, "Failed to create udev watchers: %m"); ++ return log_error_errno(r, "Failed to create udev watchers: %s", error_str()); + + /* Connect to the bus */ + r = manager_connect_bus(m); +@@ -1002,36 +1002,36 @@ + /* Instantiate magic seat 0 */ + r = manager_add_seat(m, "seat0", &m->seat0); + if (r < 0) +- return log_error_errno(r, "Failed to add seat0: %m"); ++ return log_error_errno(r, "Failed to add seat0: %s", error_str()); + + r = manager_set_lid_switch_ignore(m, 0 + m->holdoff_timeout_usec); + if (r < 0) +- log_warning_errno(r, "Failed to set up lid switch ignore event source: %m"); ++ log_warning_errno(r, "Failed to set up lid switch ignore event source: %s", error_str()); + + /* Deserialize state */ + r = manager_enumerate_devices(m); + if (r < 0) +- log_warning_errno(r, "Device enumeration failed: %m"); ++ log_warning_errno(r, "Device enumeration failed: %s", error_str()); + + r = manager_enumerate_seats(m); + if (r < 0) +- log_warning_errno(r, "Seat enumeration failed: %m"); ++ log_warning_errno(r, "Seat enumeration failed: %s", error_str()); + + r = manager_enumerate_users(m); + if (r < 0) +- log_warning_errno(r, "User enumeration failed: %m"); ++ log_warning_errno(r, "User enumeration failed: %s", error_str()); + + r = manager_enumerate_sessions(m); + if (r < 0) +- log_warning_errno(r, "Session enumeration failed: %m"); ++ log_warning_errno(r, "Session enumeration failed: %s", error_str()); + + r = manager_enumerate_inhibitors(m); + if (r < 0) +- log_warning_errno(r, "Inhibitor enumeration failed: %m"); ++ log_warning_errno(r, "Inhibitor enumeration failed: %s", error_str()); + + r = manager_enumerate_buttons(m); + if (r < 0) +- log_warning_errno(r, "Button enumeration failed: %m"); ++ log_warning_errno(r, "Button enumeration failed: %s", error_str()); + + /* Remove stale objects before we start them */ + manager_gc(m, false); +@@ -1150,7 +1150,7 @@ + + r = manager_startup(m); + if (r < 0) { +- log_error_errno(r, "Failed to fully start up daemon: %m"); ++ log_error_errno(r, "Failed to fully start up daemon: %s", error_str()); + goto finish; + } + +--- src/login/pam_elogind.c 2015-08-15 22:14:07.531421465 +0200 ++++ src/login/pam_elogind.c 2017-03-04 16:53:10.534346094 +0100 +@@ -473,7 +473,7 @@ + if (session_fd >= 0) { + session_fd = fcntl(session_fd, F_DUPFD_CLOEXEC, 3); + if (session_fd < 0) { +- pam_syslog(handle, LOG_ERR, "Failed to dup session fd: %m"); ++ pam_syslog(handle, LOG_ERR, "Failed to dup session fd: %s", error_str()); + return PAM_SESSION_ERR; + } + +--- src/shared/base-filesystem.c 2015-04-19 13:32:24.655347470 +0200 ++++ src/shared/base-filesystem.c 2017-03-04 16:53:10.541346105 +0100 +@@ -54,7 +54,7 @@ + + fd = open(root, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); + if (fd < 0) +- return log_error_errno(errno, "Failed to open root file system: %m"); ++ return log_error_errno(errno, "Failed to open root file system: %s", error_str()); + + for (i = 0; i < ELEMENTSOF(table); i ++) { + if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) +@@ -89,14 +89,14 @@ + + r = symlinkat(target, fd, table[i].dir); + if (r < 0 && errno != EEXIST) +- return log_error_errno(errno, "Failed to create symlink at %s/%s: %m", root, table[i].dir); ++ return log_error_errno(errno, "Failed to create symlink at %s/%s: %s", root, table[i].dir, error_str()); + continue; + } + + RUN_WITH_UMASK(0000) + r = mkdirat(fd, table[i].dir, table[i].mode); + if (r < 0 && errno != EEXIST) +- return log_error_errno(errno, "Failed to create directory at %s/%s: %m", root, table[i].dir); ++ return log_error_errno(errno, "Failed to create directory at %s/%s: %s", root, table[i].dir, error_str()); + } + + return 0; +--- src/shared/capability.c 2015-04-19 13:32:24.655347470 +0200 ++++ src/shared/capability.c 2017-03-04 16:53:10.525346081 +0100 +@@ -237,26 +237,26 @@ + * which we want to avoid. */ + + if (setresgid(gid, gid, gid) < 0) +- return log_error_errno(errno, "Failed to change group ID: %m"); ++ return log_error_errno(errno, "Failed to change group ID: %s", error_str()); + + if (setgroups(0, NULL) < 0) +- return log_error_errno(errno, "Failed to drop auxiliary groups list: %m"); ++ return log_error_errno(errno, "Failed to drop auxiliary groups list: %s", error_str()); + + /* Ensure we keep the permitted caps across the setresuid() */ + if (prctl(PR_SET_KEEPCAPS, 1) < 0) +- return log_error_errno(errno, "Failed to enable keep capabilities flag: %m"); ++ return log_error_errno(errno, "Failed to enable keep capabilities flag: %s", error_str()); + + r = setresuid(uid, uid, uid); + if (r < 0) +- return log_error_errno(errno, "Failed to change user ID: %m"); ++ return log_error_errno(errno, "Failed to change user ID: %s", error_str()); + + if (prctl(PR_SET_KEEPCAPS, 0) < 0) +- return log_error_errno(errno, "Failed to disable keep capabilities flag: %m"); ++ return log_error_errno(errno, "Failed to disable keep capabilities flag: %s", error_str()); + + /* Drop all caps from the bounding set, except the ones we want */ + r = capability_bounding_set_drop(~keep_capabilities, true); + if (r < 0) +- return log_error_errno(r, "Failed to drop capabilities: %m"); ++ return log_error_errno(r, "Failed to drop capabilities: %s", error_str()); + + /* Now upgrade the permitted caps we still kept to effective caps */ + d = cap_init(); +@@ -277,12 +277,12 @@ + + if (cap_set_flag(d, CAP_EFFECTIVE, j, bits, CAP_SET) < 0 || + cap_set_flag(d, CAP_PERMITTED, j, bits, CAP_SET) < 0) { +- log_error_errno(errno, "Failed to enable capabilities bits: %m"); ++ log_error_errno(errno, "Failed to enable capabilities bits: %s", error_str()); + return -errno; + } + + if (cap_set_proc(d) < 0) +- return log_error_errno(errno, "Failed to increase capabilities: %m"); ++ return log_error_errno(errno, "Failed to increase capabilities: %s", error_str()); + } + + return 0; +--- src/shared/clean-ipc.c 2015-04-19 13:32:24.655347470 +0200 ++++ src/shared/clean-ipc.c 2017-03-04 16:53:10.545346111 +0100 +@@ -43,7 +43,7 @@ + if (errno == ENOENT) + return 0; + +- log_warning_errno(errno, "Failed to open /proc/sysvipc/shm: %m"); ++ log_warning_errno(errno, "Failed to open /proc/sysvipc/shm: %s", error_str()); + return -errno; + } + +@@ -77,7 +77,7 @@ + if (errno == EIDRM || errno == EINVAL) + continue; + +- log_warning_errno(errno, "Failed to remove SysV shared memory segment %i: %m", shmid); ++ log_warning_errno(errno, "Failed to remove SysV shared memory segment %i: %s", shmid, error_str()); + ret = -errno; + } + } +@@ -85,7 +85,7 @@ + return ret; + + fail: +- log_warning_errno(errno, "Failed to read /proc/sysvipc/shm: %m"); ++ log_warning_errno(errno, "Failed to read /proc/sysvipc/shm: %s", error_str()); + return -errno; + } + +@@ -100,7 +100,7 @@ + if (errno == ENOENT) + return 0; + +- log_warning_errno(errno, "Failed to open /proc/sysvipc/sem: %m"); ++ log_warning_errno(errno, "Failed to open /proc/sysvipc/sem: %s", error_str()); + return -errno; + } + +@@ -129,7 +129,7 @@ + if (errno == EIDRM || errno == EINVAL) + continue; + +- log_warning_errno(errno, "Failed to remove SysV semaphores object %i: %m", semid); ++ log_warning_errno(errno, "Failed to remove SysV semaphores object %i: %s", semid, error_str()); + ret = -errno; + } + } +@@ -137,7 +137,7 @@ + return ret; + + fail: +- log_warning_errno(errno, "Failed to read /proc/sysvipc/sem: %m"); ++ log_warning_errno(errno, "Failed to read /proc/sysvipc/sem: %s", error_str()); + return -errno; + } + +@@ -152,7 +152,7 @@ + if (errno == ENOENT) + return 0; + +- log_warning_errno(errno, "Failed to open /proc/sysvipc/msg: %m"); ++ log_warning_errno(errno, "Failed to open /proc/sysvipc/msg: %s", error_str()); + return -errno; + } + +@@ -182,7 +182,7 @@ + if (errno == EIDRM || errno == EINVAL) + continue; + +- log_warning_errno(errno, "Failed to remove SysV message queue %i: %m", msgid); ++ log_warning_errno(errno, "Failed to remove SysV message queue %i: %s", msgid, error_str()); + ret = -errno; + } + } +@@ -190,7 +190,7 @@ + return ret; + + fail: +- log_warning_errno(errno, "Failed to read /proc/sysvipc/msg: %m"); ++ log_warning_errno(errno, "Failed to read /proc/sysvipc/msg: %s", error_str()); + return -errno; + } + +@@ -210,7 +210,7 @@ + if (errno == ENOENT) + continue; + +- log_warning_errno(errno, "Failed to stat() POSIX shared memory segment %s: %m", de->d_name); ++ log_warning_errno(errno, "Failed to stat() POSIX shared memory segment %s: %s", de->d_name, error_str()); + ret = -errno; + continue; + } +@@ -224,7 +224,7 @@ + kid = xopendirat(dirfd(dir), de->d_name, O_NOFOLLOW|O_NOATIME); + if (!kid) { + if (errno != ENOENT) { +- log_warning_errno(errno, "Failed to enter shared memory directory %s: %m", de->d_name); ++ log_warning_errno(errno, "Failed to enter shared memory directory %s: %s", de->d_name, error_str()); + ret = -errno; + } + } else { +@@ -238,7 +238,7 @@ + if (errno == ENOENT) + continue; + +- log_warning_errno(errno, "Failed to remove POSIX shared memory directory %s: %m", de->d_name); ++ log_warning_errno(errno, "Failed to remove POSIX shared memory directory %s: %s", de->d_name, error_str()); + ret = -errno; + } + } else { +@@ -248,7 +248,7 @@ + if (errno == ENOENT) + continue; + +- log_warning_errno(errno, "Failed to remove POSIX shared memory segment %s: %m", de->d_name); ++ log_warning_errno(errno, "Failed to remove POSIX shared memory segment %s: %s", de->d_name, error_str()); + ret = -errno; + } + } +@@ -257,7 +257,7 @@ + return ret; + + fail: +- log_warning_errno(errno, "Failed to read /dev/shm: %m"); ++ log_warning_errno(errno, "Failed to read /dev/shm: %s", error_str()); + return -errno; + } + +@@ -269,7 +269,7 @@ + if (errno == ENOENT) + return 0; + +- log_warning_errno(errno, "Failed to open /dev/shm: %m"); ++ log_warning_errno(errno, "Failed to open /dev/shm: %s", error_str()); + return -errno; + } + +@@ -286,7 +286,7 @@ + if (errno == ENOENT) + return 0; + +- log_warning_errno(errno, "Failed to open /dev/mqueue: %m"); ++ log_warning_errno(errno, "Failed to open /dev/mqueue: %s", error_str()); + return -errno; + } + +@@ -301,7 +301,7 @@ + if (errno == ENOENT) + continue; + +- log_warning_errno(errno, "Failed to stat() MQ segment %s: %m", de->d_name); ++ log_warning_errno(errno, "Failed to stat() MQ segment %s: %s", de->d_name, error_str()); + ret = -errno; + continue; + } +@@ -316,7 +316,7 @@ + if (errno == ENOENT) + continue; + +- log_warning_errno(errno, "Failed to unlink POSIX message queue %s: %m", fn); ++ log_warning_errno(errno, "Failed to unlink POSIX message queue %s: %s", fn, error_str()); + ret = -errno; + } + } +@@ -324,7 +324,7 @@ + return ret; + + fail: +- log_warning_errno(errno, "Failed to read /dev/mqueue: %m"); ++ log_warning_errno(errno, "Failed to read /dev/mqueue: %s", error_str()); + return -errno; + } + +--- src/shared/conf-files.c 2015-04-19 13:32:24.655347470 +0200 ++++ src/shared/conf-files.c 2017-03-04 16:53:10.551346120 +0100 +@@ -115,8 +115,8 @@ + if (r == -ENOMEM) { + return r; + } else if (r < 0) +- log_debug_errno(r, "Failed to search for files in %s: %m", +- *p); ++ log_debug_errno(r, "Failed to search for files in %s: %s", ++ *p, error_str()); + } + + files = hashmap_get_strv(fh); +--- src/shared/conf-parser.c 2015-04-19 13:32:24.655347470 +0200 ++++ src/shared/conf-parser.c 2017-03-04 16:53:10.557346130 +0100 +@@ -348,7 +348,7 @@ + * since we return 0 to the caller. */ + if (warn || errno == ENOENT) + log_full(errno == ENOENT ? LOG_DEBUG : LOG_ERR, +- "Failed to open configuration file '%s': %m", filename); ++ "Failed to open configuration file '%s': %s", filename, error_str()); + return errno == ENOENT ? 0 : -errno; + } + } +@@ -363,7 +363,7 @@ + if (feof(f)) + break; + +- log_error_errno(errno, "Failed to read configuration file '%s': %m", filename); ++ log_error_errno(errno, "Failed to read configuration file '%s': %s", filename, error_str()); + return -errno; + } + +@@ -424,8 +424,8 @@ + + if (r < 0) { + if (warn) +- log_warning_errno(r, "Failed to parse file '%s': %m", +- filename); ++ log_warning_errno(r, "Failed to parse file '%s': %s", ++ filename, error_str()); + return r; + } + } +--- src/shared/log.c 2017-03-04 16:54:39.918484986 +0100 ++++ src/shared/log.c 2017-03-04 16:53:39.829390976 +0100 +@@ -1066,3 +1066,15 @@ + void log_set_upgrade_syslog_to_journal(bool b) { + upgrade_syslog_to_journal = b; + } ++ ++const char* error_str(void) { ++ static __thread char msg[512]; ++ int error = errno; ++ int res = strerror_r(error, msg, sizeof(msg)); ++ if (res < 0) ++ snprintf(msg, sizeof(msg), "strerror_r(%d,%p,%d) failed", error, msg, (int)sizeof(msg)); ++ /* Make sure to restore the previous error */ ++ if (error != 0) ++ errno = error; ++ return msg; ++} +--- src/shared/log.h 2015-04-19 13:32:24.659347470 +0200 ++++ src/shared/log.h 2017-03-04 16:53:16.547355307 +0100 +@@ -209,3 +209,5 @@ + void log_received_signal(int level, const struct signalfd_siginfo *si); + + void log_set_upgrade_syslog_to_journal(bool b); ++ ++const char* error_str(void); +--- src/shared/pager.c 2017-03-04 16:54:39.918484986 +0100 ++++ src/shared/pager.c 2017-03-04 16:53:10.375345851 +0100 +@@ -40,7 +40,7 @@ + } while (n > 0); + + if (n < 0) { +- log_error_errno(errno, "Internal pager failed: %m"); ++ log_error_errno(errno, "Internal pager failed: %s", error_str()); + _exit(EXIT_FAILURE); + } + +@@ -68,14 +68,14 @@ + columns(); + + if (pipe(fd) < 0) +- return log_error_errno(errno, "Failed to create pager pipe: %m"); ++ return log_error_errno(errno, "Failed to create pager pipe: %s", error_str()); + + parent_pid = getpid(); + + pager_pid = fork(); + if (pager_pid < 0) { + r = -errno; +- log_error_errno(errno, "Failed to fork pager: %m"); ++ log_error_errno(errno, "Failed to fork pager: %s", error_str()); + safe_close_pair(fd); + return r; + } +@@ -125,7 +125,7 @@ + + /* Return in the parent */ + if (dup2(fd[1], STDOUT_FILENO) < 0) +- return log_error_errno(errno, "Failed to duplicate pager pipe: %m"); ++ return log_error_errno(errno, "Failed to duplicate pager pipe: %s", error_str()); + + safe_close_pair(fd); + return 1; +@@ -173,20 +173,20 @@ + + pid = fork(); + if (pid < 0) +- return log_error_errno(errno, "Failed to fork: %m"); ++ return log_error_errno(errno, "Failed to fork: %s", error_str()); + + if (pid == 0) { + /* Child */ + if (null_stdio) { + r = make_null_stdio(); + if (r < 0) { +- log_error_errno(r, "Failed to kill stdio: %m"); ++ log_error_errno(r, "Failed to kill stdio: %s", error_str()); + _exit(EXIT_FAILURE); + } + } + + execvp(args[0], (char**) args); +- log_error_errno(errno, "Failed to execute man: %m"); ++ log_error_errno(errno, "Failed to execute man: %s", error_str()); + _exit(EXIT_FAILURE); + } + +--- src/shared/ptyfwd.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/ptyfwd.c 2017-03-04 16:53:10.538346100 +0100 +@@ -123,7 +123,7 @@ + + f->stdin_event_source = sd_event_source_unref(f->stdin_event_source); + } else { +- log_error_errno(errno, "read(): %m"); ++ log_error_errno(errno, "read(): %s", error_str()); + return sd_event_exit(f->event, EXIT_FAILURE); + } + } else if (k == 0) { +@@ -157,7 +157,7 @@ + + f->master_event_source = sd_event_source_unref(f->master_event_source); + } else { +- log_error_errno(errno, "write(): %m"); ++ log_error_errno(errno, "write(): %s", error_str()); + return sd_event_exit(f->event, EXIT_FAILURE); + } + } else { +@@ -187,7 +187,7 @@ + + f->master_event_source = sd_event_source_unref(f->master_event_source); + } else { +- log_error_errno(errno, "read(): %m"); ++ log_error_errno(errno, "read(): %s", error_str()); + return sd_event_exit(f->event, EXIT_FAILURE); + } + } else +@@ -206,7 +206,7 @@ + f->stdout_hangup = true; + f->stdout_event_source = sd_event_source_unref(f->stdout_event_source); + } else { +- log_error_errno(errno, "write(): %m"); ++ log_error_errno(errno, "write(): %s", error_str()); + return sd_event_exit(f->event, EXIT_FAILURE); + } + +--- src/shared/selinux-util.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/selinux-util.c 2017-03-04 16:53:10.519346071 +0100 +@@ -89,7 +89,7 @@ + label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0); + + if (!label_hnd) { +- log_enforcing("Failed to initialize SELinux context: %m"); ++ log_enforcing("Failed to initialize SELinux context: %s", error_str()); + r = security_getenforce() == 1 ? -errno : 0; + } else { + char timespan[FORMAT_TIMESPAN_MAX]; +@@ -159,7 +159,7 @@ + if (ignore_erofs && errno == EROFS) + return 0; + +- log_enforcing("Unable to fix SELinux security context of %s: %m", path); ++ log_enforcing("Unable to fix SELinux security context of %s: %s", path, error_str()); + if (security_getenforce() == 1) + return -errno; + } +@@ -178,7 +178,7 @@ + return 0; + + if (setfilecon(path, (security_context_t) label) < 0) { +- log_enforcing("Failed to set SELinux security context %s on path %s: %m", label, path); ++ log_enforcing("Failed to set SELinux security context %s on path %s: %s", label, path, error_str()); + if (security_getenforce() == 1) + return -errno; + } +@@ -337,7 +337,7 @@ + else { + r = setfscreatecon(filecon); + if (r < 0) { +- log_enforcing("Failed to set SELinux security context %s for %s: %m", filecon, path); ++ log_enforcing("Failed to set SELinux security context %s for %s: %s", filecon, path, error_str()); + r = -errno; + } + } +@@ -370,7 +370,7 @@ + assert(label); + + if (setsockcreatecon((security_context_t) label) < 0) { +- log_enforcing("Failed to set SELinux security context %s for sockets: %m", label); ++ log_enforcing("Failed to set SELinux security context %s for sockets: %s", label, error_str()); + + if (security_getenforce() == 1) + return -errno; +@@ -440,7 +440,7 @@ + r = setfscreatecon(fcon); + + if (r < 0 && errno != ENOENT) { +- log_enforcing("Failed to set SELinux security context %s for %s: %m", fcon, path); ++ log_enforcing("Failed to set SELinux security context %s for %s: %s", fcon, path, error_str()); + + if (security_getenforce() == 1) { + r = -errno; +--- src/shared/sleep-config.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/sleep-config.c 2017-03-04 16:53:10.574346156 +0100 +@@ -175,7 +175,7 @@ + f = fopen("/proc/swaps", "re"); + if (!f) { + log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, +- "Failed to retrieve open /proc/swaps: %m"); ++ "Failed to retrieve open /proc/swaps: %s", error_str()); + assert(errno > 0); + return -errno; + } +@@ -228,14 +228,14 @@ + + r = get_status_field("/proc/meminfo", "\nActive(anon):", &active); + if (r < 0) { +- log_error_errno(r, "Failed to retrieve Active(anon) from /proc/meminfo: %m"); ++ log_error_errno(r, "Failed to retrieve Active(anon) from /proc/meminfo: %s", error_str()); + return false; + } + + r = safe_atollu(active, &act); + if (r < 0) { +- log_error_errno(r, "Failed to parse Active(anon) from /proc/meminfo: %s: %m", +- active); ++ log_error_errno(r, "Failed to parse Active(anon) from /proc/meminfo: %s: %s", ++ active, error_str()); + return false; + } + +--- src/shared/smack-util.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/smack-util.c 2017-03-04 16:53:10.568346146 +0100 +@@ -199,7 +199,7 @@ + if (ignore_erofs && errno == EROFS) + return 0; + +- r = log_debug_errno(errno, "Unable to fix SMACK label of %s: %m", path); ++ r = log_debug_errno(errno, "Unable to fix SMACK label of %s: %s", path, error_str()); + } + #endif + +--- src/shared/socket-label.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/socket-label.c 2017-03-04 16:53:10.563346139 +0100 +@@ -86,13 +86,13 @@ + if (free_bind) { + one = 1; + if (setsockopt(fd, IPPROTO_IP, IP_FREEBIND, &one, sizeof(one)) < 0) +- log_warning_errno(errno, "IP_FREEBIND failed: %m"); ++ log_warning_errno(errno, "IP_FREEBIND failed: %s", error_str()); + } + + if (transparent) { + one = 1; + if (setsockopt(fd, IPPROTO_IP, IP_TRANSPARENT, &one, sizeof(one)) < 0) +- log_warning_errno(errno, "IP_TRANSPARENT failed: %m"); ++ log_warning_errno(errno, "IP_TRANSPARENT failed: %s", error_str()); + } + } + +@@ -155,10 +155,10 @@ + + r = socket_address_print(&a, &p); + if (r < 0) +- return log_error_errno(r, "socket_address_print(): %m"); ++ return log_error_errno(r, "socket_address_print(): %s", error_str()); + + if (fd < 0) +- log_error_errno(fd, "Failed to listen on %s: %m", p); ++ log_error_errno(fd, "Failed to listen on %s: %s", p, error_str()); + else + log_full(log_level, "Listening on %s", p); + } +--- src/shared/socket-util.c 2017-03-04 16:54:39.919484988 +0100 ++++ src/shared/socket-util.c 2017-03-04 16:53:10.580346165 +0100 +@@ -653,9 +653,9 @@ + + r = sockaddr_pretty(&sa->sa, salen, true, true, &ret); + if (r < 0) +- return log_error_errno(r, "sockadd_pretty() failed: %m"); ++ return log_error_errno(r, "sockadd_pretty() failed: %s", error_str()); + +- log_debug_errno(saved_errno, "getnameinfo(%s) failed: %m", ret); ++ log_debug_errno(saved_errno, "getnameinfo(%s) failed: %s", ret, error_str()); + } else { + ret = strdup(host); + if (!ret) +@@ -674,7 +674,7 @@ + assert(ret); + + if (getsockname(fd, &sa.sa, &salen) < 0) +- return log_error_errno(errno, "getsockname(%d) failed: %m", fd); ++ return log_error_errno(errno, "getsockname(%d) failed: %s", fd, error_str()); + + return socknameinfo_pretty(&sa, salen, ret); + } +--- src/shared/spawn-polkit-agent.c 2015-09-01 11:25:35.671430453 +0200 ++++ src/shared/spawn-polkit-agent.c 2017-03-04 16:53:10.585346173 +0100 +@@ -59,7 +59,7 @@ + safe_close(pipe_fd[1]); + + if (r < 0) +- log_error_errno(r, "Failed to fork TTY ask password agent: %m"); ++ log_error_errno(r, "Failed to fork TTY ask password agent: %s", error_str()); + else + /* Wait until the agent closes the fd */ + fd_wait_for_event(pipe_fd[0], POLLHUP, USEC_INFINITY); +--- src/shared/util.c 2017-03-04 16:54:39.921484991 +0100 ++++ src/shared/util.c 2017-03-04 16:53:10.607346206 +0100 +@@ -2218,7 +2218,7 @@ + + r = reset_terminal_fd(fd, true); + if (r < 0) +- log_warning_errno(r, "Failed to reset terminal: %m"); ++ log_warning_errno(r, "Failed to reset terminal: %s", error_str()); + + return fd; + +@@ -3839,7 +3839,7 @@ + + r = wait_for_terminate(pid, &status); + if (r < 0) +- return log_warning_errno(r, "Failed to wait for %s: %m", name); ++ return log_warning_errno(r, "Failed to wait for %s: %s", name, error_str()); + + if (status.si_code == CLD_EXITED) { + if (status.si_status != 0) +@@ -4126,7 +4126,7 @@ + if (errno == ENOENT) + continue; + +- return log_error_errno(errno, "Failed to open directory %s: %m", *directory); ++ return log_error_errno(errno, "Failed to open directory %s: %s", *directory, error_str()); + } + + FOREACH_DIRENT(de, d, break) { +@@ -4157,7 +4157,7 @@ + + pid = fork(); + if (pid < 0) { +- log_error_errno(errno, "Failed to fork: %m"); ++ log_error_errno(errno, "Failed to fork: %s", error_str()); + continue; + } else if (pid == 0) { + char *_argv[2]; +@@ -4172,7 +4172,7 @@ + argv[0] = path; + + execv(path, argv); +- return log_error_errno(errno, "Failed to execute %s: %m", path); ++ return log_error_errno(errno, "Failed to execute %s: %s", path, error_str()); + } + + log_debug("Spawned %s as " PID_FMT ".", path, pid); +@@ -4225,7 +4225,7 @@ + + executor_pid = fork(); + if (executor_pid < 0) { +- log_error_errno(errno, "Failed to fork: %m"); ++ log_error_errno(errno, "Failed to fork: %s", error_str()); + return; + + } else if (executor_pid == 0) { +@@ -5398,7 +5398,7 @@ + * keep an unused copy of stdin around. */ + fd = open("/dev/tty", O_WRONLY); + if (fd < 0) { +- log_error_errno(errno, "Failed to open /dev/tty: %m"); ++ log_error_errno(errno, "Failed to open /dev/tty: %s", error_str()); + _exit(EXIT_FAILURE); + } + +@@ -5613,11 +5613,11 @@ + + fd = acquire_terminal("/dev/console", false, true, true, USEC_INFINITY); + if (fd < 0) +- return log_error_errno(fd, "Failed to acquire terminal: %m"); ++ return log_error_errno(fd, "Failed to acquire terminal: %s", error_str()); + + r = make_stdio(fd); + if (r < 0) +- return log_error_errno(r, "Failed to duplicate terminal fd: %m"); ++ return log_error_errno(r, "Failed to duplicate terminal fd: %s", error_str()); + + return 0; + } +--- src/shared/watchdog.c 2015-04-19 13:32:24.667347471 +0200 ++++ src/shared/watchdog.c 2017-03-04 16:53:10.590346180 +0100 +@@ -45,7 +45,7 @@ + flags = WDIOS_DISABLECARD; + r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags); + if (r < 0) +- return log_warning_errno(errno, "Failed to disable hardware watchdog: %m"); ++ return log_warning_errno(errno, "Failed to disable hardware watchdog: %s", error_str()); + } else { + int sec, flags; + char buf[FORMAT_TIMESPAN_MAX]; +@@ -53,7 +53,7 @@ + sec = (int) ((watchdog_timeout + USEC_PER_SEC - 1) / USEC_PER_SEC); + r = ioctl(watchdog_fd, WDIOC_SETTIMEOUT, &sec); + if (r < 0) +- return log_warning_errno(errno, "Failed to set timeout to %is: %m", sec); ++ return log_warning_errno(errno, "Failed to set timeout to %is: %s", sec, error_str()); + + watchdog_timeout = (usec_t) sec * USEC_PER_SEC; + log_info("Set hardware watchdog to %s.", format_timespan(buf, sizeof(buf), watchdog_timeout, 0)); +@@ -61,11 +61,11 @@ + flags = WDIOS_ENABLECARD; + r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags); + if (r < 0) +- return log_warning_errno(errno, "Failed to enable hardware watchdog: %m"); ++ return log_warning_errno(errno, "Failed to enable hardware watchdog: %s", error_str()); + + r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0); + if (r < 0) +- return log_warning_errno(errno, "Failed to ping hardware watchdog: %m"); ++ return log_warning_errno(errno, "Failed to ping hardware watchdog: %s", error_str()); + } + + return 0; +@@ -120,7 +120,7 @@ + + r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0); + if (r < 0) +- return log_warning_errno(errno, "Failed to ping hardware watchdog: %m"); ++ return log_warning_errno(errno, "Failed to ping hardware watchdog: %s", error_str()); + + return 0; + } +@@ -138,7 +138,7 @@ + flags = WDIOS_DISABLECARD; + r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags); + if (r < 0) +- log_warning_errno(errno, "Failed to disable hardware watchdog: %m"); ++ log_warning_errno(errno, "Failed to disable hardware watchdog: %s", error_str()); + + /* To be sure, use magic close logic, too */ + for (;;) { +@@ -148,7 +148,7 @@ + break; + + if (errno != EINTR) { +- log_error_errno(errno, "Failed to disarm watchdog timer: %m"); ++ log_error_errno(errno, "Failed to disarm watchdog timer: %s", error_str()); + break; + } + } diff --git a/srcpkgs/elogind/files/parse-printf-format.c b/srcpkgs/elogind/files/parse-printf-format.c new file mode 100644 index 00000000000..4e6e1459029 --- /dev/null +++ b/srcpkgs/elogind/files/parse-printf-format.c @@ -0,0 +1,273 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright 2014 Emil Renner Berthing + + With parts from the musl C library + Copyright 2005-2014 Rich Felker, et al. + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +#include +#include + +#include "parse-printf-format.h" + +static const char *consume_nonarg(const char *fmt) +{ + do { + if (*fmt == '\0') + return fmt; + } while (*fmt++ != '%'); + return fmt; +} + +static const char *consume_num(const char *fmt) +{ + for (;*fmt >= '0' && *fmt <= '9'; fmt++) + /* do nothing */; + return fmt; +} + +static const char *consume_argn(const char *fmt, size_t *arg) +{ + const char *p = fmt; + size_t val = 0; + + if (*p < '1' || *p > '9') + return fmt; + do { + val = 10*val + (*p++ - '0'); + } while (*p >= '0' && *p <= '9'); + + if (*p != '$') + return fmt; + *arg = val; + return p+1; +} + +static const char *consume_flags(const char *fmt) +{ + while (1) { + switch (*fmt) { + case '#': + case '0': + case '-': + case ' ': + case '+': + case '\'': + case 'I': + fmt++; + continue; + } + return fmt; + } +} + +enum state { + BARE, + LPRE, + LLPRE, + HPRE, + HHPRE, + BIGLPRE, + ZTPRE, + JPRE, + STOP +}; + +enum type { + NONE, + PTR, + INT, + UINT, + ULLONG, + LONG, + ULONG, + SHORT, + USHORT, + CHAR, + UCHAR, + LLONG, + SIZET, + IMAX, + UMAX, + PDIFF, + UIPTR, + DBL, + LDBL, + MAXTYPE +}; + +static const short pa_types[MAXTYPE] = { + [NONE] = PA_INT, + [PTR] = PA_POINTER, + [INT] = PA_INT, + [UINT] = PA_INT, + [ULLONG] = PA_INT | PA_FLAG_LONG_LONG, + [LONG] = PA_INT | PA_FLAG_LONG, + [ULONG] = PA_INT | PA_FLAG_LONG, + [SHORT] = PA_INT | PA_FLAG_SHORT, + [USHORT] = PA_INT | PA_FLAG_SHORT, + [CHAR] = PA_CHAR, + [UCHAR] = PA_CHAR, + [LLONG] = PA_INT | PA_FLAG_LONG_LONG, + [SIZET] = PA_INT | PA_FLAG_LONG, + [IMAX] = PA_INT | PA_FLAG_LONG_LONG, + [UMAX] = PA_INT | PA_FLAG_LONG_LONG, + [PDIFF] = PA_INT | PA_FLAG_LONG_LONG, + [UIPTR] = PA_INT | PA_FLAG_LONG, + [DBL] = PA_DOUBLE, + [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE +}; + +#define S(x) [(x)-'A'] +#define E(x) (STOP + (x)) + +static const unsigned char states[]['z'-'A'+1] = { + { /* 0: bare types */ + S('d') = E(INT), S('i') = E(INT), + S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT), + S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), + S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), + S('c') = E(CHAR),S('C') = E(INT), + S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR), + S('m') = E(NONE), + S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE, + S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE + }, { /* 1: l-prefixed */ + S('d') = E(LONG), S('i') = E(LONG), + S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG), + S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), + S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), + S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR), + S('l') = LLPRE + }, { /* 2: ll-prefixed */ + S('d') = E(LLONG), S('i') = E(LLONG), + S('o') = E(ULLONG),S('u') = E(ULLONG), + S('x') = E(ULLONG),S('X') = E(ULLONG), + S('n') = E(PTR) + }, { /* 3: h-prefixed */ + S('d') = E(SHORT), S('i') = E(SHORT), + S('o') = E(USHORT),S('u') = E(USHORT), + S('x') = E(USHORT),S('X') = E(USHORT), + S('n') = E(PTR), + S('h') = HHPRE + }, { /* 4: hh-prefixed */ + S('d') = E(CHAR), S('i') = E(CHAR), + S('o') = E(UCHAR),S('u') = E(UCHAR), + S('x') = E(UCHAR),S('X') = E(UCHAR), + S('n') = E(PTR) + }, { /* 5: L-prefixed */ + S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL), + S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL), + S('n') = E(PTR) + }, { /* 6: z- or t-prefixed (assumed to be same size) */ + S('d') = E(PDIFF),S('i') = E(PDIFF), + S('o') = E(SIZET),S('u') = E(SIZET), + S('x') = E(SIZET),S('X') = E(SIZET), + S('n') = E(PTR) + }, { /* 7: j-prefixed */ + S('d') = E(IMAX), S('i') = E(IMAX), + S('o') = E(UMAX), S('u') = E(UMAX), + S('x') = E(UMAX), S('X') = E(UMAX), + S('n') = E(PTR) + } +}; + +size_t parse_printf_format(const char *fmt, size_t n, int *types) +{ + size_t i = 0; + size_t last = 0; + + memset(types, 0, n); + + while (1) { + size_t arg; + unsigned int state; + + fmt = consume_nonarg(fmt); + if (*fmt == '\0') + break; + if (*fmt == '%') { + fmt++; + continue; + } + arg = 0; + fmt = consume_argn(fmt, &arg); + /* flags */ + fmt = consume_flags(fmt); + /* width */ + if (*fmt == '*') { + size_t warg = 0; + fmt = consume_argn(fmt+1, &warg); + if (warg == 0) + warg = ++i; + if (warg > last) + last = warg; + if (warg <= n && types[warg-1] == NONE) + types[warg-1] = INT; + } else + fmt = consume_num(fmt); + /* precision */ + if (*fmt == '.') { + fmt++; + if (*fmt == '*') { + size_t parg = 0; + fmt = consume_argn(fmt+1, &parg); + if (parg == 0) + parg = ++i; + if (parg > last) + last = parg; + if (parg <= n && types[parg-1] == NONE) + types[parg-1] = INT; + } else { + if (*fmt == '-') + fmt++; + fmt = consume_num(fmt); + } + } + /* length modifier and conversion specifier */ + state = BARE; + do { + unsigned char c = *fmt++; + + if (c < 'A' || c > 'z') + continue; + state = states[state]S(c); + if (state == 0) + continue; + } while (state < STOP); + + if (state == E(NONE)) + continue; + + if (arg == 0) + arg = ++i; + if (arg > last) + last = arg; + if (arg <= n) + types[arg-1] = state - STOP; + } + + if (last > n) + last = n; + for (i = 0; i < last; i++) + types[i] = pa_types[types[i]]; + + return last; +} diff --git a/srcpkgs/elogind/files/parse-printf-format.h b/srcpkgs/elogind/files/parse-printf-format.h new file mode 100644 index 00000000000..e66b86c4422 --- /dev/null +++ b/srcpkgs/elogind/files/parse-printf-format.h @@ -0,0 +1,58 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright 2014 Emil Renner Berthing + + With parts from the GNU C Library + Copyright 1991-2014 Free Software Foundation, Inc. + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +#pragma once + +#include "config.h" + +#ifdef HAVE_PRINTF_H +#include +#else + +#include + +enum { /* C type: */ + PA_INT, /* int */ + PA_CHAR, /* int, cast to char */ + PA_WCHAR, /* wide char */ + PA_STRING, /* const char *, a '\0'-terminated string */ + PA_WSTRING, /* const wchar_t *, wide character string */ + PA_POINTER, /* void * */ + PA_FLOAT, /* float */ + PA_DOUBLE, /* double */ + PA_LAST +}; + +/* Flag bits that can be set in a type returned by `parse_printf_format'. */ +#define PA_FLAG_MASK 0xff00 +#define PA_FLAG_LONG_LONG (1 << 8) +#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG +#define PA_FLAG_LONG (1 << 9) +#define PA_FLAG_SHORT (1 << 10) +#define PA_FLAG_PTR (1 << 11) + +size_t parse_printf_format(const char *fmt, size_t n, int *types); + +#endif /* HAVE_PRINTF_H */ + diff --git a/srcpkgs/elogind/patches/001-fix-label-selinux.patch b/srcpkgs/elogind/patches/001-fix-label-selinux.patch new file mode 100644 index 00000000000..21250078478 --- /dev/null +++ b/srcpkgs/elogind/patches/001-fix-label-selinux.patch @@ -0,0 +1,64 @@ +--- src/shared/label.c 2015-04-19 13:32:24.659347470 +0200 ++++ src/shared/label.c 2017-03-04 13:41:05.953585324 +0100 +@@ -25,9 +25,11 @@ + #include "label.h" + + int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { +- int r, q; ++ int r = 0, q = 0; + ++#ifdef HAVE_SELINUX + r = mac_selinux_fix(path, ignore_enoent, ignore_erofs); ++#endif + q = mac_smack_fix(path, ignore_enoent, ignore_erofs); + + if (r < 0) +@@ -39,18 +41,22 @@ + } + + int mkdir_label(const char *path, mode_t mode) { +- int r; ++ int r = 0; + + assert(path); + ++#ifdef HAVE_SELINUX + r = mac_selinux_create_file_prepare(path, S_IFDIR); + if (r < 0) + return r; ++#endif + + if (mkdir(path, mode) < 0) + r = -errno; + ++#ifdef HAVE_SELINUX + mac_selinux_create_file_clear(); ++#endif + + if (r < 0) + return r; +@@ -59,19 +65,23 @@ + } + + int symlink_label(const char *old_path, const char *new_path) { +- int r; ++ int r = 0; + + assert(old_path); + assert(new_path); + ++#ifdef HAVE_SELINUX + r = mac_selinux_create_file_prepare(new_path, S_IFLNK); + if (r < 0) + return r; ++#endif + + if (symlink(old_path, new_path) < 0) + r = -errno; + ++#ifdef HAVE_SELINUX + mac_selinux_create_file_clear(); ++#endif + + if (r < 0) + return r; diff --git a/srcpkgs/elogind/patches/002-fix-logind-action-constify_args.patch b/srcpkgs/elogind/patches/002-fix-logind-action-constify_args.patch new file mode 100644 index 00000000000..0f417f7a89a --- /dev/null +++ b/srcpkgs/elogind/patches/002-fix-logind-action-constify_args.patch @@ -0,0 +1,25 @@ +--- src/login/logind-action.c 2015-08-29 11:16:20.584190227 +0200 ++++ src/login/logind-action.c 2017-03-04 13:55:29.722627380 +0100 +@@ -176,9 +176,9 @@ + return wait_for_terminate_and_warn(helper, pid, true); + } + +-static int write_mode(char **modes) { ++static int write_mode(const char **modes) { + int r = 0; +- char **mode; ++ const char **mode; + + STRV_FOREACH(mode, modes) { + int k; +@@ -199,8 +199,8 @@ + return r; + } + +-static int write_state(FILE **f, char **states) { +- char **state; ++static int write_state(FILE **f, const char **states) { ++ const char **state; + int r = 0; + + STRV_FOREACH(state, states) { diff --git a/srcpkgs/elogind/patches/003-musl-missing.patch b/srcpkgs/elogind/patches/003-musl-missing.patch new file mode 100644 index 00000000000..a7d8f900f8a --- /dev/null +++ b/srcpkgs/elogind/patches/003-musl-missing.patch @@ -0,0 +1,253 @@ +This library is a masterpiece of writing non-portable code. +The patches are trying to be minimally invasive and are, for +the most part, just simple macros replacing glibc extensions +with their POSIX counterparts. + +The file src/musl_missing.h is included whereever the code +expects functions and constants which are specific to glibc. + +--- src/libelogind/sd-bus/bus-message.c 2015-04-19 13:32:24.607347468 +0200 ++++ src/libelogind/sd-bus/bus-message.c 2017-03-04 12:12:45.277329646 +0100 +@@ -23,6 +23,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "util.h" + #include "utf8.h" + #include "strv.h" +--- src/libelogind/sd-bus/bus-objects.c 2015-04-19 13:32:24.611347468 +0200 ++++ src/libelogind/sd-bus/bus-objects.c 2017-03-04 12:12:52.469343136 +0100 +@@ -19,6 +19,7 @@ + along with systemd; If not, see . + ***/ + ++#include "musl_missing.h" + #include "strv.h" + #include "set.h" + #include "bus-internal.h" +--- src/libelogind/sd-bus/bus-util.c 2015-04-19 13:32:24.611347468 +0200 ++++ src/libelogind/sd-bus/bus-util.c 2017-03-04 12:13:00.357357928 +0100 +@@ -21,6 +21,7 @@ + + #include + ++#include "musl_missing.h" + #include "sd-daemon.h" + #include "sd-event.h" + #include "util.h" +--- src/libelogind/sd-bus/sd-bus.c 2016-03-06 16:00:52.027398234 +0100 ++++ src/libelogind/sd-bus/sd-bus.c 2017-03-04 12:13:08.163372562 +0100 +@@ -27,6 +27,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "util.h" + #include "macro.h" + #include "strv.h" +--- src/libelogind/sd-device/sd-device.c 2015-04-19 13:32:24.611347468 +0200 ++++ src/libelogind/sd-device/sd-device.c 2017-03-04 12:35:03.255797997 +0100 +@@ -22,6 +22,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "util.h" + #include "macro.h" + #include "path-util.h" +--- src/shared/arphrd-list.c 2017-03-04 15:31:15.633884536 +0100 ++++ src/shared/arphrd-list.c 2017-03-04 15:32:05.646967582 +0100 +@@ -22,6 +22,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "util.h" + #include "arphrd-list.h" + +--- src/shared/cgroup-util.c 2016-03-06 16:00:52.183398132 +0100 ++++ src/shared/cgroup-util.c 2017-03-04 13:22:38.379366996 +0100 +@@ -29,6 +29,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "cgroup-util.h" + #include "set.h" + #include "macro.h" +--- src/shared/import-util.c 2015-04-19 13:32:24.659347470 +0200 ++++ src/shared/import-util.c 2017-03-04 13:50:12.978234609 +0100 +@@ -19,6 +19,7 @@ + along with systemd; If not, see . + ***/ + ++#include "musl_missing.h" + #include "util.h" + #include "import-util.h" + +--- src/shared/log.c 2015-04-19 13:32:24.659347470 +0200 ++++ src/shared/log.c 2017-03-04 12:13:13.650382848 +0100 +@@ -29,6 +29,11 @@ + #include ++#if defined(__GLIBC__) + #include ++#else ++#include "musl_missing.h" ++#include "parse-printf-format.h" ++#endif + + #include "log.h" + #include "util.h" + #include "missing.h" +--- src/shared/mkdir.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/mkdir.c 2017-03-04 13:24:40.815495150 +0100 +@@ -22,6 +22,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "util.h" + #include "path-util.h" + #include "mkdir.h" +--- src/shared/pager.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/pager.c 2017-03-04 13:10:55.917202529 +0100 +@@ -25,6 +25,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "pager.h" + #include "util.h" + #include "macro.h" +--- src/shared/path-util.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/path-util.c 2017-03-04 12:13:29.919413335 +0100 +@@ -27,6 +27,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "macro.h" + #include "util.h" + #include "log.h" +--- src/shared/socket-util.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/socket-util.c 2017-03-04 13:13:24.833441863 +0100 +@@ -29,6 +29,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "macro.h" + #include "path-util.h" + #include "util.h" +--- src/shared/strbuf.c 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/strbuf.c 2017-03-04 12:44:52.010758521 +0100 +@@ -22,6 +22,7 @@ + #include + #include + ++#include "musl_missing.h" + #include "util.h" + #include "strbuf.h" + +--- src/shared/uid-range.c 2015-04-19 13:32:24.667347471 +0200 ++++ src/shared/uid-range.c 2017-03-04 13:46:38.443975396 +0100 +@@ -19,6 +19,7 @@ + along with systemd; If not, see . + ***/ + ++#include "musl_missing.h" + #include "util.h" + #include "uid-range.h" + +--- src/shared/util.c 2015-04-19 13:32:24.667347471 +0200 ++++ src/shared/util.c 2017-03-04 12:13:25.146404392 +0100 +@@ -74,6 +74,7 @@ + #include + #endif + ++#include "musl_missing.h" + #include "config.h" + #include "macro.h" + #include "util.h" +--- /dev/null 2017-02-27 11:29:25.507373858 +0100 ++++ src/musl_missing.h 2017-03-04 12:07:03.302685073 +0100 +@@ -0,0 +1,65 @@ ++/**************************************************************** ++ * musl_missing.h - work around glibc extensions for musl libc. ++ * ++ * Implements glibc functions missing in musl libc as macros. ++ * Is to be included where these functions are used. ++ * Also defines some glibc only constants as either 0 or ++ * as found in the corresponding glibc header file. ++ * ++ * Juergen Buchmueller for Void Linux ++ * Public Domain; no warranties whatsoever. Thank you Mr. P. ++ * ++ ****************************************************************/ ++ ++#if !defined(__GLIBC__) ++#include "config.h" ++#include ++#include ++#include ++ ++/* ++ * Possibly TODO according to http://man7.org/linux/man-pages/man3/getenv.3.html ++ * + test if the process's effective user ID does not match its real user ID or ++ * the process's effective group ID does not match its real group ID; ++ * typically this is the result of executing a set-user-ID or set- ++ * group-ID program. Is calling issetugid() sufficient here? ++ * + test if the effective capability bit was set on the executable file ++ * + test if the process has a nonempty permitted capability set ++ */ ++#define secure_getenv(name) \ ++ (issetugid() ? NULL : getenv(name)) ++ ++/* Poor man's basename */ ++#define basename(path) \ ++ (strrchr(path, '/') ? strrchr(path, '/')+1 : path) ++ ++/* strndupa may already be defined in another compatibility header */ ++#if !defined(strndupa) ++#define strndupa(src, n) \ ++ (__extension__ ({const char *in = (src); \ ++ size_t len = strnlen(in, (n)) + 1; \ ++ char *out = (char *) alloca(len); \ ++ out[len-1] = '\0'; \ ++ (char *) memcpy(out, in, len-1);}) \ ++ ) ++#endif ++ ++/* See http://man7.org/linux/man-pages/man3/canonicalize_file_name.3.html */ ++#define canonicalize_file_name(path) \ ++ realpath(path, NULL) ++ ++typedef int (*__compar_fn_t)(const void *, const void *); ++ ++/* GLOB_BRACE is another glibc extension - ignore it for musl libc */ ++#define GLOB_BRACE 0 ++ ++/* getnameinfo(3) glibc extensions are undefined in musl libc */ ++#define NI_IDN 0 ++#define NI_IDN_USE_STD3_ASCII_RULES 0 ++ ++/* Taken from glibc's net/if_arp.h */ ++#if !defined(ARPHRD_IEEE802154_PHY) ++#define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */ ++#endif ++ ++#endif /* !defined(__GLIBC__) */ +--- Makefile.am 2016-03-06 16:00:51.919398304 +0100 ++++ Makefile.am 2017-03-04 13:06:34.982792357 +0100 +@@ -482,7 +482,9 @@ + src/shared/import-util.c \ + src/shared/import-util.h \ + src/shared/sysctl-util.c \ +- src/shared/sysctl-util.h ++ src/shared/sysctl-util.h \ ++ src/shared/parse-printf-format.c \ ++ src/shared/parse-printf-format.h + + nodist_libelogind_shared_la_SOURCES = \ + src/shared/errno-from-name.h \ diff --git a/srcpkgs/elogind/patches/004-musl-program_invocation_short_name.patch b/srcpkgs/elogind/patches/004-musl-program_invocation_short_name.patch new file mode 100644 index 00000000000..2334c12a8bf --- /dev/null +++ b/srcpkgs/elogind/patches/004-musl-program_invocation_short_name.patch @@ -0,0 +1,55 @@ +Using the libc program_invocation_short_name results in a linker error: + /usr/bin/ld.gold: error: src/login/loginctl.o: cannot make copy relocation + for protected symbol 'program_invocation_short_name', defined in + /usr/lib/gcc/x86_64-linux-musl/6.3.0/../../../../lib/libc.so +Replace it with basename(argv[0]) which gives the same result. + +--- src/login/inhibit.c 2015-04-19 13:32:24.639347469 +0200 ++++ src/login/inhibit.c 2017-03-04 14:13:27.885132151 +0100 +@@ -124,7 +125,8 @@ + return 0; + } + +-static void help(void) { ++static void help(int argc, char* argv[]) { ++ char* short_name = basename(argv[0]); + printf("%s [OPTIONS...] {COMMAND} ...\n\n" + "Execute a process while inhibiting shutdown/sleep/idle.\n\n" + " -h --help Show this help\n" +@@ -137,7 +139,7 @@ + " --why=STRING A descriptive string why is being inhibited\n" + " --mode=MODE One of block or delay\n" + " --list List active inhibitors\n" +- , program_invocation_short_name); ++ , short_name); + } + + static int parse_argv(int argc, char *argv[]) { +@@ -172,7 +174,7 @@ + switch (c) { + + case 'h': +- help(); ++ help(argc, argv); + return 0; + + case ARG_VERSION: +--- src/login/loginctl.c 2015-09-01 13:12:13.079341932 +0200 ++++ src/login/loginctl.c 2017-03-04 14:07:33.971586311 +0100 +@@ -1395,6 +1394,7 @@ + } + + static int help(int argc, char *argv[], void *userdata) { ++ char* short_name = basename(argv[0]); + + printf("%s [OPTIONS...] {COMMAND} ...\n\n" + "Send control commands to or query the login manager.\n\n" +@@ -1446,7 +1446,7 @@ + " suspend Suspend the machine to memory\n" + " hibernate Suspend the machine to disk\n" + " hybrid-sleep Suspend the machine to memory and disk\n" +- , program_invocation_short_name); ++ , short_name); + + return 0; + } diff --git a/srcpkgs/elogind/patches/005-musl-selinux-util-sys_types_h.patch b/srcpkgs/elogind/patches/005-musl-selinux-util-sys_types_h.patch new file mode 100644 index 00000000000..3c738572e97 --- /dev/null +++ b/srcpkgs/elogind/patches/005-musl-selinux-util-sys_types_h.patch @@ -0,0 +1,10 @@ +--- src/shared/selinux-util.h 2015-04-19 13:32:24.663347471 +0200 ++++ src/shared/selinux-util.h 2017-03-04 13:44:22.577814237 +0100 +@@ -21,6 +21,7 @@ + along with systemd; If not, see . + ***/ + ++#include + #include + #include + diff --git a/srcpkgs/elogind/patches/006-musl-strerror_r.patch b/srcpkgs/elogind/patches/006-musl-strerror_r.patch new file mode 100644 index 00000000000..be74cd5219d --- /dev/null +++ b/srcpkgs/elogind/patches/006-musl-strerror_r.patch @@ -0,0 +1,15 @@ +--- src/libelogind/sd-bus/bus-error.c 2015-04-20 21:59:54.600440290 +0200 ++++ src/libelogind/sd-bus/bus-error.c 2017-03-04 12:29:27.793186294 +0100 +@@ -378,7 +378,12 @@ + return; + + errno = 0; ++#if defined(__GLIBC__) + x = strerror_r(error, m, k); ++#else ++ /* int strerror_r (int, char *, size_t); */ ++ x = strerror_r(error, m, k) < 0 ? strdup("strerror_r() failed") : m; ++#endif + if (errno == ERANGE || strlen(x) >= k - 1) { + free(m); + k *= 2; diff --git a/srcpkgs/elogind/patches/008-fix-loginctl_help.patch b/srcpkgs/elogind/patches/008-fix-loginctl_help.patch new file mode 100644 index 00000000000..fdd066ce5be --- /dev/null +++ b/srcpkgs/elogind/patches/008-fix-loginctl_help.patch @@ -0,0 +1,11 @@ +--- src/login/loginctl.c 2017-03-05 12:42:33.677495884 +0100 ++++ src/login/loginctl.c 2017-03-05 12:43:52.330545359 +0100 +@@ -1491,7 +1491,7 @@ + switch (c) { + + case 'h': +- help(0, NULL, NULL); ++ help(argc, argv, NULL); + return 0; + + case ARG_VERSION: diff --git a/srcpkgs/elogind/patches/009-fix-faccessat-flags.patch b/srcpkgs/elogind/patches/009-fix-faccessat-flags.patch new file mode 100644 index 00000000000..45d439d0661 --- /dev/null +++ b/srcpkgs/elogind/patches/009-fix-faccessat-flags.patch @@ -0,0 +1,13 @@ +--- src/shared/util.h.orig 2017-03-05 17:12:46.654974564 +0100 ++++ src/shared/util.h 2017-03-05 17:14:11.998704156 +0100 +@@ -1041,7 +1041,11 @@ union inotify_event_buffer { + uint8_t raw[INOTIFY_EVENT_MAX]; + }; + ++#ifdef __GLIBC__ + #define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) ++#else ++#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0) ++#endif + + int ptsname_malloc(int fd, char **ret); diff --git a/srcpkgs/elogind/template b/srcpkgs/elogind/template index 563f47b1290..5292f43237d 100644 --- a/srcpkgs/elogind/template +++ b/srcpkgs/elogind/template @@ -6,7 +6,7 @@ build_style=gnu-configure hostmakedepends="automake libxslt intltool libtool pkg-config gperf" makedepends="libcap-devel libmount-devel libseccomp-devel libblkid-devel pam-devel gettext-devel eudev-libudev-devel glib-devel" depends="dbus" -short_desc="standalone logind fork" +short_desc="Standalone logind fork" maintainer="Enno Boland " license="GPL-2, LGPL-2, MIT" homepage="https://github.com/andywingo/elogind" @@ -14,16 +14,22 @@ distfiles="https://wingolog.org/pub/elogind/elogind-$version.tar.xz" checksum=9dc150071a3f4c1ad1c989a7a143c2d41a2d571c643b92090e36a5d0396193c9 LDFLAGS="-lrt" conf_files="/etc/elogind/logind.conf" -case "$XBPS_TARGET_MACHINE" in -*-musl) - broken="https://build.voidlinux.eu/builders/x86_64-musl_builder/builds/1110/steps/shell_3/logs/stdio" - ;; -esac pre_configure() { vinstall $FILESDIR/elogind.wrapper 755 usr/libexec/elogind sed -i -e "s#^Exec=/bin/false#Exec=/usr/libexec/elogind/elogind.wrapper#" \ src/login/org.freedesktop.login1.service + # Copy an implementation of glibc printf.h for use with musl libc + cp -p ${FILESDIR}/parse-printf-format.{c,h} src/shared/ +} + +post_configure() { + case "$XBPS_TARGET_MACHINE" in + *-musl) # We do have an implementation of secure_getenv(3) through a macro... + sed -i config.h \ + -e 's;/\* #undef HAVE_SECURE_GETENV \*/;#define HAVE_SECURE_GETENV 1;' + ;; + esac } post_install() { @@ -32,6 +38,7 @@ post_install() { ln -sr $DESTDIR/usr/include/elogind $DESTDIR/usr/include/systemd vinstall ./src/systemd/sd-id128.h 644 usr/include vinstall ./src/systemd/_sd-common.h 644 usr/include + vlicense LICENSE.MIT } elogind-devel_package() {