diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | README | 1 | ||||
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | man/systemctl.xml | 1 | ||||
-rw-r--r-- | src/core/manager.c | 3 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 26 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.h | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-kernel.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-device/device-enumerator.c | 18 | ||||
-rw-r--r-- | src/libudev/libudev-enumerate.c | 21 | ||||
-rw-r--r-- | src/systemctl/systemctl.c | 2 | ||||
-rw-r--r-- | src/test/test-util.c | 2 |
13 files changed, 55 insertions, 50 deletions
diff --git a/Makefile.am b/Makefile.am index 2e2abaead6..7603b2c0e1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6549,9 +6549,7 @@ clean-local: $(CLEAN_LOCAL_HOOKS) rm -f $(abs_srcdir)/hwdb/usb.ids $(abs_srcdir)/hwdb/pci.ids $(abs_srcdir)/hwdb/oui.txt \ $(abs_srcdir)/hwdb/iab.txt -# disable gc-sections to check limited toolchains for link breakage DISTCHECK_CONFIGURE_FLAGS = \ - CFLAGS='-fno-lto' LDFLAGS='-Wl,--as-needed -Wl,--no-gc-sections' \ --with-dbuspolicydir=$$dc_install_base/$(dbuspolicydir) \ --with-dbussessionservicedir=$$dc_install_base/$(dbussessionservicedir) \ --with-dbussystemservicedir=$$dc_install_base/$(dbussystemservicedir) \ @@ -129,7 +129,6 @@ REQUIREMENTS: libmicrohttpd (optional) libpython (optional) libidn (optional) - gobject-introspection > 1.40.0 (optional) elfutils >= 158 (optional) make, gcc, and similar tools diff --git a/autogen.sh b/autogen.sh index 3027f83153..2d4acdfef1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -47,7 +47,7 @@ fi if [ ! -L /bin ]; then args="$args \ ---with-rootprefix= \ +--with-rootprefix=/ \ --with-rootlibdir=$(libdir /lib) \ " fi diff --git a/configure.ac b/configure.ac index deafcc195b..2625e0d15b 100644 --- a/configure.ac +++ b/configure.ac @@ -183,8 +183,6 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ -fdiagnostics-show-option \ -fno-strict-aliasing \ -fvisibility=hidden \ - -ffunction-sections \ - -fdata-sections \ -fstack-protector \ -fstack-protector-strong \ -fPIE \ @@ -208,10 +206,21 @@ AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*], [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])]) AC_SUBST([OUR_CPPFLAGS], "$with_cppflags $sanitizer_cppflags") +AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*], + [CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\ + -Wl,--gc-sections])], + [AC_MSG_RESULT([skipping --gc-sections, optimization not enabled])]) +AC_SUBST([OUR_CFLAGS], "$with_ldflags $sanitizer_cflags") + +AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*], + [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ + -ffunction-sections -fdata-sections])], + [AC_MSG_RESULT([skipping -ffunction/data-section, optimization not enabled])]) +AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags") + CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\ -Wl,--as-needed \ -Wl,--no-undefined \ - -Wl,--gc-sections \ -Wl,-z,relro \ -Wl,-z,now \ -pie \ @@ -1378,6 +1387,13 @@ AX_NORMALIZE_PATH([with_zshcompletiondir]) AC_ARG_WITH([rootprefix], AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), [], [with_rootprefix=${ac_default_prefix}]) +# --with-rootprefix= (empty) should default to "/" but AX_NORMALIZE_PATH +# defaults those to ".", solve that here for now until we can find a suitable +# fix for AX_NORMALIZE_PATH upstream at autoconf-archive. +# See: https://github.com/systemd/systemd/issues/54 +if test "x${with_rootprefix}" = "x"; then + with_rootprefix="/" +fi AX_NORMALIZE_PATH([with_rootprefix]) AC_ARG_WITH([rootlibdir], @@ -1542,7 +1558,6 @@ AC_MSG_RESULT([ dbus: ${have_dbus} nss-myhostname: ${have_myhostname} hwdb: ${enable_hwdb} - gintrospection: ${enable_introspection} terminal: ${have_terminal} kdbus: ${have_kdbus} Python: ${have_python} diff --git a/man/systemctl.xml b/man/systemctl.xml index 35f47de52c..409b6f0895 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -1733,6 +1733,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service <varname>$VISUAL</varname> are present or if it is set to an empty string or if their execution failed, systemctl will try to execute well known editors in this order: + <citerefentry project='die-net'><refentrytitle>editor</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry project='die-net'><refentrytitle>nano</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry project='die-net'><refentrytitle>vim</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry project='die-net'><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>. diff --git a/src/core/manager.c b/src/core/manager.c index ae473d05c2..a1c54339ea 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -741,9 +741,6 @@ static int manager_setup_kdbus(Manager *m) { if (!is_kdbus_available()) return -ESOCKTNOSUPPORT; - if (m->running_as == MANAGER_SYSTEM && detect_container(NULL) <= 0) - bus_kernel_fix_attach_mask(); - m->kdbus_fd = bus_kernel_create_bus( m->running_as == MANAGER_SYSTEM ? "system" : "user", m->running_as == MANAGER_SYSTEM, &p); diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index d5cc8100ce..417e4d5903 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -1770,32 +1770,6 @@ int bus_kernel_realize_attach_flags(sd_bus *bus) { return 0; } -int bus_kernel_fix_attach_mask(void) { - _cleanup_free_ char *mask = NULL; - uint64_t m = (uint64_t) -1; - char buf[2+16+2]; - int r; - - /* By default we don't want any kdbus metadata fields to be - * suppressed, hence we reset the kernel mask for it to - * (uint64_t) -1. If the module argument was overwritten by - * the kernel cmdline, we leave it as is. */ - - 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"); - - 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"); - } - - return 0; -} - int bus_kernel_get_bus_name(sd_bus *bus, char **name) { struct kdbus_cmd_info cmd = { .size = sizeof(struct kdbus_cmd_info), diff --git a/src/libsystemd/sd-bus/bus-kernel.h b/src/libsystemd/sd-bus/bus-kernel.h index b9f31ba790..bb4dff6d82 100644 --- a/src/libsystemd/sd-bus/bus-kernel.h +++ b/src/libsystemd/sd-bus/bus-kernel.h @@ -90,8 +90,6 @@ int bus_kernel_drop_one(int fd); int bus_kernel_realize_attach_flags(sd_bus *bus); -int bus_kernel_fix_attach_mask(void); - int bus_kernel_get_bus_name(sd_bus *bus, char **name); int bus_kernel_cmd_free(sd_bus *bus, uint64_t offset); diff --git a/src/libsystemd/sd-bus/test-bus-kernel.c b/src/libsystemd/sd-bus/test-bus-kernel.c index 8f4f60b65f..6506eaab2e 100644 --- a/src/libsystemd/sd-bus/test-bus-kernel.c +++ b/src/libsystemd/sd-bus/test-bus-kernel.c @@ -43,8 +43,6 @@ int main(int argc, char *argv[]) { assert_se(asprintf(&name, "deine-mutter-%u", (unsigned) getpid()) >= 0); - bus_kernel_fix_attach_mask(); - bus_ref = bus_kernel_create_bus(name, false, &bus_name); if (bus_ref == -ENOENT) return EXIT_TEST_SKIP; diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c index 3692d46e06..7fd77e9480 100644 --- a/src/libsystemd/sd-device/device-enumerator.c +++ b/src/libsystemd/sd-device/device-enumerator.c @@ -137,7 +137,6 @@ _public_ int sd_device_enumerator_add_match_sysattr(sd_device_enumerator *enumer assert_return(enumerator, -EINVAL); assert_return(_sysattr, -EINVAL); - assert_return(_value, -EINVAL); if (match) hashmap = &enumerator->match_sysattr; @@ -152,9 +151,11 @@ _public_ int sd_device_enumerator_add_match_sysattr(sd_device_enumerator *enumer if (!sysattr) return -ENOMEM; - value = strdup(_value); - if (!value) - return -ENOMEM; + if (_value) { + value = strdup(_value); + if (!value) + return -ENOMEM; + } r = hashmap_put(*hashmap, sysattr, value); if (r < 0) @@ -174,7 +175,6 @@ _public_ int sd_device_enumerator_add_match_property(sd_device_enumerator *enume assert_return(enumerator, -EINVAL); assert_return(_property, -EINVAL); - assert_return(_value, -EINVAL); r = hashmap_ensure_allocated(&enumerator->match_property, NULL); if (r < 0) @@ -184,9 +184,11 @@ _public_ int sd_device_enumerator_add_match_property(sd_device_enumerator *enume if (!property) return -ENOMEM; - value = strdup(_value); - if (!value) - return -ENOMEM; + if (_value) { + value = strdup(_value); + if (!value) + return -ENOMEM; + } r = hashmap_put(enumerator->match_property, property, value); if (r < 0) diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c index 255fbe808d..df088946df 100644 --- a/src/libudev/libudev-enumerate.c +++ b/src/libudev/libudev-enumerate.c @@ -196,6 +196,9 @@ _public_ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enume _public_ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { assert_return(udev_enumerate, -EINVAL); + if (!subsystem) + return 0; + return sd_device_enumerator_add_match_subsystem(udev_enumerate->enumerator, subsystem, true); } @@ -211,6 +214,9 @@ _public_ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enum _public_ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { assert_return(udev_enumerate, -EINVAL); + if (!subsystem) + return 0; + return sd_device_enumerator_add_match_subsystem(udev_enumerate->enumerator, subsystem, false); } @@ -227,6 +233,9 @@ _public_ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_en _public_ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { assert_return(udev_enumerate, -EINVAL); + if (!sysattr) + return 0; + return sd_device_enumerator_add_match_sysattr(udev_enumerate->enumerator, sysattr, value, true); } @@ -243,6 +252,9 @@ _public_ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumer _public_ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { assert_return(udev_enumerate, -EINVAL); + if (!sysattr) + return 0; + return sd_device_enumerator_add_match_sysattr(udev_enumerate->enumerator, sysattr, value, false); } @@ -259,6 +271,9 @@ _public_ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enum _public_ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) { assert_return(udev_enumerate, -EINVAL); + if (!property) + return 0; + return sd_device_enumerator_add_match_property(udev_enumerate->enumerator, property, value); } @@ -274,6 +289,9 @@ _public_ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enume _public_ int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) { assert_return(udev_enumerate, -EINVAL); + if (!tag) + return 0; + return sd_device_enumerator_add_match_tag(udev_enumerate->enumerator, tag); } @@ -335,6 +353,9 @@ _public_ int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev _public_ int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) { assert_return(udev_enumerate, -EINVAL); + if (!sysname) + return 0; + return sd_device_enumerator_add_match_sysname(udev_enumerate->enumerator, sysname); } diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index a7b8e54a9c..b3d90d2c33 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -5879,7 +5879,7 @@ static int run_editor(char **paths) { execvp(editor, (char* const*) args); } - FOREACH_STRING(p, "nano", "vim", "vi") { + FOREACH_STRING(p, "editor", "nano", "vim", "vi") { args[0] = p; execvp(p, (char* const*) args); /* We do not fail if the editor doesn't exist diff --git a/src/test/test-util.c b/src/test/test-util.c index 7a398fafbe..9d5516a18d 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -460,6 +460,8 @@ static void test_cunescape(void) { assert_se(cunescape("\\u0000", 0, &unescaped) < 0); assert_se(cunescape("\\u00DF\\U000000df\\u03a0\\U00000041", UNESCAPE_RELAX, &unescaped) >= 0); assert_se(streq_ptr(unescaped, "ßßΠA")); + free(unescaped); + unescaped = NULL; assert_se(cunescape("\\073", 0, &unescaped) >= 0); assert_se(streq_ptr(unescaped, ";")); |