[systemd-commits] 7 commits - rules/60-evdev.rules src/efi-boot-generator src/libsystemd src/python-systemd src/sysv-generator src/tmpfiles src/udev

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Sun Apr 12 08:33:00 PDT 2015


 rules/60-evdev.rules                        |    2 +-
 src/efi-boot-generator/efi-boot-generator.c |    6 ++++--
 src/libsystemd/sd-bus/bus-util.c            |   17 ++++++++---------
 src/python-systemd/_daemon.c                |    2 +-
 src/python-systemd/daemon.py                |    2 +-
 src/sysv-generator/sysv-generator.c         |    4 +---
 src/tmpfiles/tmpfiles.c                     |   15 +++------------
 src/udev/udev-builtin-keyboard.c            |   28 +++++++++++++---------------
 8 files changed, 32 insertions(+), 44 deletions(-)

New commits:
commit 9f1a574d50c1ffd19f18805cc8a3a433c4f2da37
Author: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
Date:   Wed Mar 25 17:00:09 2015 +0000

    python-systemd: fix is_socket_inet to cope with ports
    
    Just a couple of trivial oversights.

diff --git a/src/python-systemd/_daemon.c b/src/python-systemd/_daemon.c
index 65cfec7..7c5f1b2 100644
--- a/src/python-systemd/_daemon.c
+++ b/src/python-systemd/_daemon.c
@@ -225,7 +225,7 @@ static PyObject* is_socket_inet(PyObject *self, PyObject *args) {
                               &fd, &family, &type, &listening, &port))
                 return NULL;
 
-        if (port < 0 || port > INT16_MAX) {
+        if (port < 0 || port > UINT16_MAX) {
                 set_error(-EINVAL, NULL, "port must fit into uint16_t");
                 return NULL;
         }
diff --git a/src/python-systemd/daemon.py b/src/python-systemd/daemon.py
index 1c386bb..82011ca 100644
--- a/src/python-systemd/daemon.py
+++ b/src/python-systemd/daemon.py
@@ -26,7 +26,7 @@ def is_socket(fileobj, family=_AF_UNSPEC, type=0, listening=-1):
 
 def is_socket_inet(fileobj, family=_AF_UNSPEC, type=0, listening=-1, port=0):
     fd = _convert_fileobj(fileobj)
-    return _is_socket_inet(fd, family, type, listening)
+    return _is_socket_inet(fd, family, type, listening, port)
 
 def is_socket_unix(fileobj, type=0, listening=-1, path=None):
     fd = _convert_fileobj(fileobj)

commit 776c441941632c9bf0fb97a78e4127aff4a60e4e
Author: Tobias Hunger <tobias.hunger at gmail.com>
Date:   Sat Apr 11 02:13:31 2015 +0200

    efi-boot-generator: Continue if /boot does not exist
    
    /boot does not exist on a stateless system, so do not get
    confused by that.

diff --git a/src/efi-boot-generator/efi-boot-generator.c b/src/efi-boot-generator/efi-boot-generator.c
index 58c4cc2..4842286 100644
--- a/src/efi-boot-generator/efi-boot-generator.c
+++ b/src/efi-boot-generator/efi-boot-generator.c
@@ -68,8 +68,10 @@ int main(int argc, char *argv[]) {
                 return EXIT_SUCCESS;
         }
 
-        if (path_is_mount_point("/boot", true) <= 0 &&
-            dir_is_empty("/boot") <= 0) {
+        r = path_is_mount_point("/boot", true);
+        if (r == -ENOENT)
+                log_debug("/boot does not exist, continuing.");
+        else if (r <= 0 && dir_is_empty("/boot") <= 0) {
                 log_debug("/boot already populated, exiting.");
                 return EXIT_SUCCESS;
         }

commit a61cc460e87f00f30ae5ab5097565a264247487c
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sat Apr 11 19:39:30 2015 -0400

    bus-util: add articles to explanation messages
    
    We are talking about one member of a group of things (resource limits, signals,
    timeouts), without specifying which one. An indenfinite article is in order.
    
    When we are talking about the control process, it's a specific one, so the
    definite article is used.

diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
index abb4829..ed36614 100644
--- a/src/libsystemd/sd-bus/bus-util.c
+++ b/src/libsystemd/sd-bus/bus-util.c
@@ -1733,13 +1733,13 @@ static int bus_job_get_service_result(BusWaitForJobs *d, char **result) {
 static const struct {
         const char *result, *explanation;
 } explanations [] = {
-        { "resources", "configured resource limit was exceeded" },
-        { "timeout", "timeout was exceeded" },
-        { "exit-code", "control process exited with error code" },
-        { "signal", "fatal signal was delivered to the control process" },
-        { "core-dump", "fatal signal was delivered to the control process. Core dumped" },
-        { "watchdog", "service failed to send watchdog ping" },
-        { "start-limit", "start of the service was attempted too often too quickly" }
+        { "resources",   "a configured resource limit was exceeded" },
+        { "timeout",     "a timeout was exceeded" },
+        { "exit-code",   "the control process exited with error code" },
+        { "signal",      "a fatal signal was delivered to the control process" },
+        { "core-dump",   "a fatal signal was delivered causing the control process to dump core" },
+        { "watchdog",    "the service failed to send watchdog ping" },
+        { "start-limit", "start of the service was attempted too often" }
 };
 
 static void log_job_error_with_service_result(const char* service, const char *result) {
@@ -1767,8 +1767,7 @@ static void log_job_error_with_service_result(const char* service, const char *r
 
         /* For some results maybe additional explanation is required */
         if (streq_ptr(result, "start-limit"))
-                log_info("To force a start please invoke \"systemctl reset-failed %s\" followed by \"systemctl start %s\" again.",
-                         strna(service_shell_quoted),
+                log_info("To force a start use \"systemctl reset-failed %1$s\" followed by \"systemctl start %1$s\" again.",
                          strna(service_shell_quoted));
 }
 

commit f8bc41822ba19905707a97f9d87262f2c2b6e5fa
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sat Apr 11 12:00:27 2015 -0400

    sysv-generator: free LookupPaths also on error
    
    Followup for 7a03974a6f.

diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index e5141c7..4ab8f61 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -921,7 +921,7 @@ finish:
 
 int main(int argc, char *argv[]) {
         int r, q;
-        LookupPaths lp;
+        _cleanup_lookup_paths_free_ LookupPaths lp = {};
         Hashmap *all_services;
         SysvStub *service;
         Iterator j;
@@ -980,7 +980,5 @@ int main(int argc, char *argv[]) {
                         continue;
         }
 
-        lookup_paths_free(&lp);
-
         return EXIT_SUCCESS;
 }

commit c89280f811a0dc0a2cb071cb83072375345f4bd2
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sat Apr 11 11:38:34 2015 -0400

    udev-builtin-keyboard: make error messages more standard
    
    - No need to add "Error, " prefix, we already have that as metadata.
    - Also use double quotes for path names, as in most other places.
    - Remove stray newline at end of message.
    - Downgrade error messages after which we continue to warnings.

diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
index 2a71ea5..c7f7f84 100644
--- a/src/udev/udev-builtin-keyboard.c
+++ b/src/udev/udev-builtin-keyboard.c
@@ -80,7 +80,7 @@ static void map_keycode(int fd, const char *devnode, int scancode, const char *k
                 /* check if it's a numeric code already */
                 keycode_num = strtoul(keycode, &endptr, 0);
                 if (endptr[0] !='\0') {
-                        log_error("Error, unknown key identifier '%s'", keycode);
+                        log_error("Unknown key identifier '%s'", keycode);
                         return;
                 }
         }
@@ -123,8 +123,7 @@ static void override_abs(int fd, const char *devnode,
 
         rc = ioctl(fd, EVIOCGABS(evcode), &absinfo);
         if (rc < 0) {
-                log_error_errno(errno, "Error, unable to EVIOCGABS device '%s'",
-                                devnode);
+                log_error_errno(errno, "Unable to EVIOCGABS device \"%s\"", devnode);
                 return;
         }
 
@@ -134,18 +133,17 @@ static void override_abs(int fd, const char *devnode,
         next = parse_token(next, &absinfo.fuzz);
         next = parse_token(next, &absinfo.flat);
         if (!next) {
-                log_error("Error, unable to parse EV_ABS override '%s' for '%s'\n",
-                          value, devnode);
+                log_error("Unable to parse EV_ABS override '%s' for '%s'", value, devnode);
                 return;
         }
 
-        log_debug("keyboard: override %x with %d/%d/%d/%d/%d", evcode,
-                  absinfo.minimum, absinfo.maximum, absinfo.resolution,
-                  absinfo.fuzz, absinfo.flat);
+        log_debug("keyboard: %x overriden with %"PRIi32"/%"PRIi32"/%"PRIi32"/%"PRIi32"/%"PRIi32" for \"%s\"",
+                  evcode,
+                  absinfo.minimum, absinfo.maximum, absinfo.resolution, absinfo.fuzz, absinfo.flat,
+                  devnode);
         rc = ioctl(fd, EVIOCSABS(evcode), &absinfo);
         if (rc < 0)
-                log_error_errno(errno, "Error, unable to update device '%s'",
-                                devnode);
+                log_error_errno(errno, "Unable to EVIOCSABS device \"%s\"", devnode);
 }
 
 static int open_device(const char *devnode) {
@@ -153,9 +151,9 @@ static int open_device(const char *devnode) {
 
         fd = open(devnode, O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
         if (fd < 0)
-                log_error_errno(errno, "Error, opening device '%s': %m", devnode);
+                return log_error_errno(errno, "Error opening device \"%s\": %m", devnode);
 
-        return fd < 0 ? -errno : fd;
+        return fd;
 }
 
 static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], bool test) {
@@ -167,7 +165,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
 
         node = udev_device_get_devnode(dev);
         if (!node) {
-                log_error("Error, no device node for '%s'", udev_device_get_syspath(dev));
+                log_error("No device node for \"%s\"", udev_device_get_syspath(dev));
                 return EXIT_FAILURE;
         }
 
@@ -183,7 +181,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
                         /* KEYBOARD_KEY_<hex scan code>=<key identifier string> */
                         scancode = strtoul(key + 13, &endptr, 16);
                         if (endptr[0] != '\0') {
-                                log_error("Error, unable to parse scan code from '%s'", key);
+                                log_warning("Unable to parse scan code from \"%s\"", key);
                                 continue;
                         }
 
@@ -214,7 +212,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
                         /* EVDEV_ABS_<EV_ABS code>=<min>:<max>:<res>:<fuzz>:<flat> */
                         evcode = strtoul(key + 10, &endptr, 16);
                         if (endptr[0] != '\0') {
-                                log_error("Error, unable to parse EV_ABS code from '%s'", key);
+                                log_warning("Unable to parse EV_ABS code from \"%s\"", key);
                                 continue;
                         }
 

commit c7e3c3ecac63e772dab4f767b18b7574c496e56c
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sat Apr 11 11:05:39 2015 -0400

    rules: finish incomplete rename
    
    Fixup for 51c0c2869845a058268d54c3111d55d0dd485704.

diff --git a/rules/60-evdev.rules b/rules/60-evdev.rules
index e81966f..ade7e7f 100644
--- a/rules/60-evdev.rules
+++ b/rules/60-evdev.rules
@@ -10,7 +10,7 @@ IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=evdev:", \
 # AT keyboard matching by the machine's DMI data
 ENV{ID_INPUT_KEY}=="?*", DRIVERS=="atkbd", \
   IMPORT{builtin}="hwdb 'evdev:atkbd:$attr{[dmi/id]modalias}'", \
-  RUN{builtin}+="keyboard", GOTO="keyboard_end"
+  RUN{builtin}+="keyboard", GOTO="evdev_end"
 
 # device matching the input device name and the machine's DMI data
 KERNELS=="input*", IMPORT{builtin}="hwdb 'evdev:name:$attr{name}:$attr{[dmi/id]modalias}'", \

commit dd449aca6182ff49aa11701e47928c9df36be16a
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Fri Apr 10 18:57:05 2015 -0400

    tmpfiles: use qsort_safe

diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index ef13dcb..16114b2 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1635,17 +1635,6 @@ static int item_compare(const void *a, const void *b) {
         return (int) x->type - (int) y->type;
 }
 
-static void item_array_sort(ItemArray *a) {
-
-        /* Sort an item array, to enforce stable ordering in which we
-         * apply things. */
-
-        if (a->count <= 1)
-                return;
-
-        qsort(a->items, a->count, sizeof(Item), item_compare);
-}
-
 static bool item_compatible(Item *a, Item *b) {
         assert(a);
         assert(b);
@@ -1980,7 +1969,9 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
                 return log_oom();
 
         memcpy(existing->items + existing->count++, &i, sizeof(i));
-        item_array_sort(existing);
+
+        /* Sort item array, to enforce stable ordering of application */
+        qsort_safe(existing->items, existing->count, sizeof(Item), item_compare);
 
         zero(i);
         return 0;



More information about the systemd-commits mailing list