[systemd-commits] 86 commits - docs/.gitignore .gitignore hwdb/70-touchpad.hwdb Makefile.am Makefile-man.am man/journalctl.xml man/machinectl.xml man/networkctl.xml man/sd_notify.xml man/sysctl.d.xml man/systemctl.xml man/systemd.exec.xml man/systemd.service.xml man/systemd.time.xml man/udev.xml rules/42-usb-hid-pm.rules rules/60-persistent-storage.rules rules/61-accelerometer.rules rules/70-touchpad.rules src/basic src/bootchart src/bus-proxyd src/core src/escape src/journal src/libsystemd src/login src/network src/nspawn src/shared src/sysv-generator src/timedate src/udev test/rule-syntax-check.py test/sysv-generator-test.py tools/make-man-rules.py

David Herrmann dvdhrm at kemper.freedesktop.org
Sat Jul 4 03:25:16 PDT 2015


 .gitignore                                   |    1 
 Makefile-man.am                              |   12 -
 Makefile.am                                  |   24 --
 docs/.gitignore                              |    1 
 hwdb/70-touchpad.hwdb                        |   43 ---
 man/journalctl.xml                           |    4 
 man/machinectl.xml                           |    2 
 man/networkctl.xml                           |    2 
 man/sd_notify.xml                            |    2 
 man/sysctl.d.xml                             |   21 +
 man/systemctl.xml                            |   34 ++-
 man/systemd.exec.xml                         |    5 
 man/systemd.service.xml                      |    5 
 man/systemd.time.xml                         |    2 
 man/udev.xml                                 |    9 
 rules/42-usb-hid-pm.rules                    |   36 ---
 rules/60-persistent-storage.rules            |    2 
 rules/61-accelerometer.rules                 |    3 
 rules/70-touchpad.rules                      |   12 -
 src/basic/socket-label.c                     |    9 
 src/basic/socket-util.h                      |    1 
 src/basic/util.c                             |    9 
 src/bootchart/store.c                        |   86 +++++--
 src/bootchart/svg.c                          |    9 
 src/bus-proxyd/proxy.c                       |   24 --
 src/core/dbus.c                              |   46 ++--
 src/core/kmod-setup.c                        |    2 
 src/core/main.c                              |    4 
 src/core/socket.c                            |    7 
 src/escape/escape.c                          |    2 
 src/journal/journald-server.c                |    2 
 src/libsystemd/sd-bus/bus-kernel.c           |   11 
 src/libsystemd/sd-bus/busctl.c               |    1 
 src/libsystemd/sd-netlink/netlink-internal.h |   25 +-
 src/libsystemd/sd-netlink/netlink-message.c  |  174 +++++++--------
 src/login/71-seat.rules.in                   |    5 
 src/login/logind-dbus.c                      |   30 ++
 src/login/logind.c                           |    6 
 src/login/logind.h                           |    2 
 src/network/networkd-link.c                  |    3 
 src/network/networkd-netdev.c                |   13 +
 src/network/networkd.c                       |    2 
 src/nspawn/nspawn.c                          |   22 -
 src/shared/install.c                         |    2 
 src/sysv-generator/sysv-generator.c          |   32 +-
 src/timedate/timedatectl.c                   |   11 
 src/udev/accelerometer/Makefile              |    1 
 src/udev/accelerometer/accelerometer.c       |  303 ---------------------------
 src/udev/udev-event.c                        |   50 ++--
 src/udev/udev-rules.c                        |   65 -----
 src/udev/udev.h                              |    3 
 src/udev/udevd.c                             |   68 +++---
 test/rule-syntax-check.py                    |    2 
 test/sysv-generator-test.py                  |   19 +
 tools/make-man-rules.py                      |   12 -
 55 files changed, 494 insertions(+), 789 deletions(-)

New commits:
commit a0c8526a7376a7ef9692a3db6700e574fc714e7c
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Sat Jul 4 12:19:32 2015 +0200

    core: fix coding style in agent-handling
    
    Avoid late bail-out based on a condition. This makes code hard to read.
    Instead, reverse the forwarding-condition.

diff --git a/src/core/dbus.c b/src/core/dbus.c
index 6679eba..057653a 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -108,19 +108,15 @@ static int signal_agent_released(sd_bus_message *message, void *userdata, sd_bus
 
         manager_notify_cgroup_empty(m, cgroup);
 
-        /* only forward to system bus if running as system instance */
-        if (m->running_as != MANAGER_SYSTEM || !m->system_bus)
-                return 0;
-
-        r = sd_bus_message_rewind(message, 1);
-        if (r < 0)
-                goto exit;
-
-        r = sd_bus_send(m->system_bus, message, NULL);
+        /* if running as system-instance, forward under our name */
+        if (m->running_as == MANAGER_SYSTEM && m->system_bus) {
+                r = sd_bus_message_rewind(message, 1);
+                if (r >= 0)
+                        r = sd_bus_send(m->system_bus, message, NULL);
+                if (r < 0)
+                        log_warning_errno(r, "Failed to forward Released message: %m");
+        }
 
-exit:
-        if (r < 0)
-                log_warning_errno(r, "Failed to forward Released message: %m");
         return 0;
 }
 

commit 0a069ce62de904ae9cbaf23d026ac380b02e50e4
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Sat Jul 4 12:14:45 2015 +0200

    core: harden cgroups-agent forwarding
    
    On dbus1, we receive systemd1.Agent signals via the private socket, hence
    it's trusted. However, on kdbus we receive it on the system bus. We must
    make sure it's sent by UID=0, otherwise unprivileged users can fake it.
    
    Furthermore, never forward broadcasts we sent ourself. This might happen
    on kdbus, as we forward the message on the same bus we received it on,
    thus ending up in an endless loop.

diff --git a/src/core/dbus.c b/src/core/dbus.c
index 86886e6..6679eba 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -69,13 +69,37 @@ int bus_send_queued_message(Manager *m) {
 }
 
 static int signal_agent_released(sd_bus_message *message, void *userdata, sd_bus_error *error) {
+        _cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
+        const char *cgroup, *me;
         Manager *m = userdata;
-        const char *cgroup;
+        uid_t sender_uid;
+        sd_bus *bus;
         int r;
 
         assert(message);
         assert(m);
 
+        /* ignore recursive events sent by us on the system/user bus */
+        bus = sd_bus_message_get_bus(message);
+        if (!sd_bus_is_server(bus)) {
+                r = sd_bus_get_unique_name(bus, &me);
+                if (r < 0)
+                        return r;
+
+                if (streq_ptr(sd_bus_message_get_sender(message), me))
+                        return 0;
+        }
+
+        /* only accept org.freedesktop.systemd1.Agent from UID=0 */
+        r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_EUID, &creds);
+        if (r < 0)
+                return r;
+
+        r = sd_bus_creds_get_euid(creds, &sender_uid);
+        if (r < 0 || sender_uid != 0)
+                return 0;
+
+        /* parse 'cgroup-empty' notification */
         r = sd_bus_message_read(message, "s", &cgroup);
         if (r < 0) {
                 bus_log_parse_error(r);

commit 1d44f7584a713ab24e1ead541a8c85e176b99fd2
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Sat Jul 4 12:11:22 2015 +0200

    busctl: flush stdout after dumping data
    
    Running `busctl monitor` currently buffers data for several seconds /
    kilobytes before writing stdout. This is highly confusing if you dump in a
    file, ^C busctl and then end up with a file with data of the last few
    _seconds_ missing.
    
    Fix this by explicitly flushing after each signal.

diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 39caa4e..5011c27 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -1137,6 +1137,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL
 
                 if (m) {
                         dump(m, stdout);
+                        fflush(stdout);
 
                         if (sd_bus_message_is_signal(m, "org.freedesktop.DBus.Local", "Disconnected") > 0) {
                                 log_info("Connection terminated, exiting.");

commit 2812dcba85435c59203268ab54901a72c6c24a69
Merge: 42ec2c2 ac89205
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 3 20:08:14 2015 +0200

    Merge pull request #484 from xnox/persistent-journal
    
    journal: in persistent mode create /var/log/journal, with all parents.


commit 42ec2c20eacaab3c6f244d3c7784a5908f64d07a
Merge: ed3fd04 391567f
Author: Daniel Mack <github at zonque.org>
Date:   Fri Jul 3 13:04:58 2015 -0400

    Merge pull request #478 from systemd/revert-429-nspawn-userns-uid-shift-autodetection-fix
    
    Revert "nspawn: determine_uid_shift before forking"


commit ac892057c2ddd8f06323c73ebd80423cc3ec7190
Author: Dimitri John Ledkov <dimitri.j.ledkov at intel.com>
Date:   Fri Jul 3 11:34:12 2015 +0100

    journal: in persistent mode create /var/log/journal, with all parents.
    
    systemd-journald races with systemd-tmpfiles-setup, and hence both are
    started at about the same time. On a bare-bones system (e.g. with
    empty /var, or even non-existent /var), systemd-tmpfiles will create
    /var/log. But it can happen too late, that is systemd-journald already
    attempted to mkdir /var/log/journal, ignoring the error. Thus failing
    to create /var/log/journal. One option, without modifiying the
    dependency graph is to create /var/log/journal directory with parents,
    when persistent storage has been requested.

diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index f740298..46358e1 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -943,7 +943,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
                  * the machine path */
 
                 if (s->storage == STORAGE_PERSISTENT)
-                        (void) mkdir("/var/log/journal/", 0755);
+                        (void) mkdir_p("/var/log/journal/", 0755);
 
                 fn = strjoina("/var/log/journal/", ids);
                 (void) mkdir(fn, 0755);

commit ed3fd0493160522b5878ef261bcee6f2d7d37ba5
Merge: 200edc2 2ee5363
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 3 12:54:22 2015 +0200

    Merge pull request #480 from rinrinne/fix-message
    
    Fix error message for enumerate addresses


commit 391567f479f56c2ae7c2beb9eb5305f5c02f5d82
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 3 12:30:53 2015 +0200

    Revert "nspawn: determine_uid_shift before forking"

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 7fa098b..df341a6 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -4313,6 +4313,10 @@ static int outer_child(
         if (r < 0)
                 return r;
 
+        r = determine_uid_shift(directory);
+        if (r < 0)
+                return r;
+
         /* Turn directory into bind mount */
         if (mount(directory, directory, NULL, MS_BIND|MS_REC, NULL) < 0)
                 return log_error_errno(errno, "Failed to make bind mount: %m");
@@ -4491,10 +4495,6 @@ int main(int argc, char *argv[]) {
         if (r < 0)
                 goto finish;
 
-        r = determine_uid_shift(arg_directory);
-        if (r < 0)
-                return r;
-
         if (geteuid() != 0) {
                 log_error("Need to be root.");
                 r = -EPERM;

commit 2ee5363b7409b9eaace61e17d8abbc44d5b36055
Author: rinrinne <rinrin.ne at gmail.com>
Date:   Fri Jul 3 19:13:35 2015 +0900

    Fix error message for enumerate addresses
    
    Error message for enumerating addresses was not 'addresses' but 'links'.
    This patch fixes it.

diff --git a/src/network/networkd.c b/src/network/networkd.c
index 9fe8a5f..e625904 100644
--- a/src/network/networkd.c
+++ b/src/network/networkd.c
@@ -103,7 +103,7 @@ int main(int argc, char *argv[]) {
 
         r = manager_rtnl_enumerate_addresses(m);
         if (r < 0) {
-                log_error_errno(r, "Could not enumerate links: %m");
+                log_error_errno(r, "Could not enumerate addresses: %m");
                 goto out;
         }
 

commit 200edc2bcfdf3845ee8ee5c71306dfbe20dc28d3
Merge: a92a81d 715d759
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 3 10:11:33 2015 +0200

    Merge pull request #473 from richardmaw-codethink/machinectl-import-earlier-than-3-15
    
    util: fall back in rename_noreplace when renameat2 isn't implemented


commit a92a81d86a85fc3e8f8632eb6a3daed6e8001612
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Mon Jun 29 09:42:11 2015 +0200

    login: add rule for qemu's pci-bridge-seat
    
    Qemu provides a separate pci-bridge exclusively for multi-seat setups.
    The normal pci-pci bridge ("-device pci-bridge") has 1b36:0001. The new
    pci-bridge-seat was specifically added to simplify guest-side
    multiseat configuration.  It is identical to the normal pci-pci bridge,
    except that it has a different id (1b36:000a) so we can match it and
    configure multiseating automatically.
    
    Make sure we always treat this as separate seat if we detect this, just
    like other "Pluggable" devices.
    
    (David: write commit-message)

diff --git a/src/login/71-seat.rules.in b/src/login/71-seat.rules.in
index ab7b66f..47d68b8 100644
--- a/src/login/71-seat.rules.in
+++ b/src/login/71-seat.rules.in
@@ -17,6 +17,11 @@ SUBSYSTEM=="usb", ATTR{bDeviceClass}=="09", TAG+="seat"
 # 'Plugable' USB hub, sound, network, graphics adapter
 SUBSYSTEM=="usb", ATTR{idVendor}=="2230", ATTR{idProduct}=="000[13]", ENV{ID_AUTOSEAT}="1"
 
+# qemu (version 2.4+) has a PCI-PCI bridge (-device pci-bridge-seat) to group
+# evices belonging to one seat. See:
+#     http://git.qemu.org/?p=qemu.git;a=blob;f=docs/multiseat.txt
+SUBSYSTEM=="pci", ATTR{vendor}=="0x1b36", ATTR{device}=="0x000a", TAG+="seat", ENV{ID_AUTOSEAT}="1"
+
 # Mimo 720, with integrated USB hub, displaylink graphics, and e2i
 # touchscreen. This device carries no proper VID/PID in the USB hub,
 # but it does carry good ID data in the graphics component, hence we

commit 715d7599051602471d4a54bbc00639d32ddaaae2
Author: Richard Maw <richard.maw at codethink.co.uk>
Date:   Thu Jul 2 13:04:34 2015 +0000

    util: fall back in rename_noreplace when renameat2 isn't implemented
    
    According to README we only need 3.7, and while it may also make sense
    to bump that requirement when appropriate, it's trivial to fall back
    when renameat2 is not available.

diff --git a/src/basic/util.c b/src/basic/util.c
index 727be56..a574c9c 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -5925,10 +5925,9 @@ int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char
         if (ret >= 0)
                 return 0;
 
-        /* Even though renameat2() exists since Linux 3.15, btrfs added
-         * support for it later. If it is not implemented, fallback to another
-         * method. */
-        if (errno != EINVAL)
+        /* renameat2() exists since Linux 3.15, btrfs added support for it later.
+         * If it is not implemented, fallback to another method. */
+        if (!IN_SET(errno, EINVAL, ENOSYS))
                 return -errno;
 
         /* The link()/unlink() fallback does not work on directories. But

commit 92c4eaf76d8ba4a9ef6d8d2dfe50f19a4d114828
Merge: 4ef9c85 9407bc2
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Jul 2 09:41:32 2015 -0400

    Merge pull request #472 from keszybz/documentation-updates2
    
    Documentation updates


commit 4ef9c8527c65bef22ca0809012d9bc99a0abd121
Merge: 512d86c ff9c82c
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Jul 2 09:25:59 2015 -0400

    Merge pull request #470 from marineam/escape
    
    escape: fix exit code


commit 512d86c92a68f0422d1fff1efae2086c5b4b84e0
Merge: 0c9cc10 e4f42f9
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Jul 2 09:24:04 2015 -0400

    Merge pull request #427 from keszybz/man-list-fixes
    
    Update Makefile-man.am after recent changes and fix regeneration of Makefile-man.am
    Fixes fallout from https://github.com/systemd/systemd/pull/282.


commit 9407bc2d03b6405754807b6f38c8ca95b4fc1f40
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Mon Jun 29 20:34:45 2015 -0400

    man: update sysctl example about netfilter
    
    It turns out that since kernel 3.18 netfilter on bridged packets
    is off anyway, so the example should be reworded (and the module
    name updated).

diff --git a/man/sysctl.d.xml b/man/sysctl.d.xml
index 8a13179..e5b2bc0 100644
--- a/man/sysctl.d.xml
+++ b/man/sysctl.d.xml
@@ -123,11 +123,12 @@
     </example>
 
     <example>
-      <title>Disable packet filter on bridged packets (method one)</title>
+      <title>Apply settings available only when a certain module is loaded (method one)</title>
       <para><filename>/etc/udev/rules.d/99-bridge.rules</filename>:
       </para>
 
-      <programlisting>ACTION=="add", SUBSYSTEM=="module", KERNEL=="bridge", RUN+="/usr/lib/systemd/systemd-sysctl --prefix=/net/bridge"
+      <programlisting>ACTION=="add", SUBSYSTEM=="module", KERNEL=="br_netfilter", \
+      RUN+="/usr/lib/systemd/systemd-sysctl --prefix=/net/bridge"
 </programlisting>
 
       <para><filename>/etc/sysctl.d/bridge.conf</filename>:
@@ -137,14 +138,20 @@
 net.bridge.bridge-nf-call-iptables = 0
 net.bridge.bridge-nf-call-arptables = 0
 </programlisting>
+
+      <para>This method applies settings when the module is
+      loaded. Please note that unless the <filename>br_netfilter</filename>
+      module is loaded, bridged packets will not be filtered by
+      netfilter (starting with kernel 3.18), so simply not loading the
+      module is suffient to avoid filtering.</para>
     </example>
 
     <example>
-      <title>Disable packet filter on bridged packets (method two)</title>
+      <title>Apply settings available only when a certain module is loaded (method two)</title>
       <para><filename>/etc/modules-load.d/bridge.conf</filename>:
       </para>
 
-      <programlisting>bridge</programlisting>
+      <programlisting>br_netfilter</programlisting>
 
       <para><filename>/etc/sysctl.d/bridge.conf</filename>:
       </para>
@@ -153,6 +160,12 @@ net.bridge.bridge-nf-call-arptables = 0
 net.bridge.bridge-nf-call-iptables = 0
 net.bridge.bridge-nf-call-arptables = 0
 </programlisting>
+
+      <para>This method forces the module to be always loaded. Please
+      note that unless the <filename>br_netfilter</filename> module is
+      loaded, bridged packets will not be filtered with netfilter
+      (starting with kernel 3.18), so simply not loading the module is
+      suffient to avoid filtering.</para>
     </example>
   </refsect1>
 

commit ea539eb65950bea7a9734424e660ef84f6f30e6c
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Mon Jun 29 20:19:56 2015 -0400

    man: information about available properties
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1144496

diff --git a/man/systemctl.xml b/man/systemctl.xml
index e18ef6f..66a0900 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -114,12 +114,30 @@
 
         <listitem>
           <para>When showing unit/job/manager properties with the
-          <command>show</command> command, limit display to certain
-          properties as specified as argument. If not specified, all
-          set properties are shown. The argument should be a
+          <command>show</command> command, limit display to properties
+          specified in the argument. The argument should be a
           comma-separated list of property names, such as
-          <literal>MainPID</literal>. If specified more than once, all
-          properties with the specified names are shown.</para>
+          <literal>MainPID</literal>. Unless specified, all known
+          properties are shown. If specified more than once, all
+          properties with the specified names are shown. Shell
+          completion is implemented for property names.</para>
+
+          <para>For the manager itself,
+          <command>systemctl show</command> will show all available
+          properties. Those properties are documented in
+          <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+          </para>
+
+          <para>Properties for units vary by unit type, so showing any
+          unit (even a non-existent one) is a way to list properties
+          pertaining to this type. Similarly showing any job will list
+          properties pertaining to all jobs. Properties for units are
+          documented in
+          <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+          and the pages for individual unit types
+          <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+          <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+          etc.</para>
         </listitem>
       </varlistentry>
 

commit 0c9cc10dcca6cc260b293c2732e7a4833280272e
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Thu Jul 2 12:14:27 2015 +0200

    sd-bus: don't leak kdbus notifications
    
    When we get notifications from the kernel, we always turn them into
    synthetic dbus1 messages. This means, we do *not* consume the kdbus
    message, and as such have to free the offset.
    
    Right now, the translation-helpers told the caller that they consumed the
    message, which is wrong. Fix this by explicitly releasing all kernel
    messages that are translated.

diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index f08db2d..e3fac01 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -1385,15 +1385,16 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority) {
                         r = 0;
                 }
 
-        } else if (k->payload_type == KDBUS_PAYLOAD_KERNEL)
+                if (r <= 0)
+                        close_kdbus_msg(bus, k);
+        } else if (k->payload_type == KDBUS_PAYLOAD_KERNEL) {
                 r = bus_kernel_translate_message(bus, k);
-        else {
+                close_kdbus_msg(bus, k);
+        } else {
                 log_debug("Ignoring message with unknown payload type %llu.", (unsigned long long) k->payload_type);
                 r = 0;
-        }
-
-        if (r <= 0)
                 close_kdbus_msg(bus, k);
+        }
 
         return r < 0 ? r : 1;
 }

commit ff9c82cc399c37dd3d3fad4ec116b33c9efe70ea
Author: Michael Marineau <michael.marineau at coreos.com>
Date:   Wed Jul 1 23:46:42 2015 -0700

    escape: fix exit code
    
    r == 0 indicates success, not failure

diff --git a/src/escape/escape.c b/src/escape/escape.c
index 9ccb015..3414533 100644
--- a/src/escape/escape.c
+++ b/src/escape/escape.c
@@ -236,5 +236,5 @@ int main(int argc, char *argv[]) {
         fputc('\n', stdout);
 
 finish:
-        return r <= 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }

commit 138879ccad87148cc5d805471183789a6ad688c6
Merge: c9b9e8e 62e2d5b
Author: Daniel Mack <github at zonque.org>
Date:   Wed Jul 1 19:26:01 2015 -0400

    Merge pull request #409 from teg/networkd-enslave-segfault
    
    fix segfault when cancelling enslaving of links by netdevs


commit c9b9e8e9e2fa14fc3d4dd93240eb7d0b3df8732e
Merge: 02e9cc6 ab59f41
Author: Daniel Mack <github at zonque.org>
Date:   Wed Jul 1 19:01:28 2015 -0400

    Merge pull request #466 from rivanvx/master
    
    timedatectl: trim non-local RTC warning to 80 chars wide


commit ab59f4123a6f9c32953e522cc9afc5fc610d59ca
Author: Vedran Miletić <rivanvx at gmail.com>
Date:   Thu Jul 2 00:13:31 2015 +0200

    timedatectl: trim non-local RTC warning to 80 chars wide

diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 195d5f3..25c2595 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -154,11 +154,12 @@ static void print_status_info(const StatusInfo *i) {
 
         if (i->rtc_local)
                 fputs("\n" ANSI_HIGHLIGHT_ON
-                      "Warning: The system is configured to read the RTC time in the local time zone. This\n"
-                      "         mode can not be fully supported. It will create various problems with time\n"
-                      "         zone changes and daylight saving time adjustments. The RTC time is never updated,\n"
-                      "         it relies on external facilities to maintain it. If at all possible, use\n"
-                      "         RTC in UTC by calling 'timedatectl set-local-rtc 0'" ANSI_HIGHLIGHT_OFF ".\n", stdout);
+                      "Warning: The system is configured to read the RTC time in the local time zone.\n"
+                      "         This mode can not be fully supported. It will create various problems\n"
+                      "         with time zone changes and daylight saving time adjustments. The RTC\n"
+                      "         time is never updated, it relies on external facilities to maintain it.\n"
+                      "         If at all possible, use RTC in UTC by calling\n"
+                      "         'timedatectl set-local-rtc 0'" ANSI_HIGHLIGHT_OFF ".\n", stdout);
 }
 
 static int show_status(sd_bus *bus, char **args, unsigned n) {

commit 02e9cc6207456ec2576628be506cd1c90fdc2fb8
Merge: 38b541c 54255c6
Author: Daniel Mack <github at zonque.org>
Date:   Wed Jul 1 16:52:02 2015 -0400

    Merge pull request #459 from ctrochalakis/reuse-port-before-bind
    
    socket: Set SO_REUSEPORT before bind()


commit 38b541c4f25830af1429f2dc903c81a3c8c1877f
Merge: b6b3475 5833143
Author: Daniel Mack <github at zonque.org>
Date:   Wed Jul 1 13:45:33 2015 -0400

    Merge pull request #419 from eworm-de/man-protecthome
    
    man: ProtectHome= protects /root as well


commit b6b34755339b7ce7181d0986f761ca2af3d5497e
Merge: 78d3e04 077fc5e
Author: Daniel Mack <github at zonque.org>
Date:   Wed Jul 1 13:42:16 2015 -0400

    Merge pull request #463 from dvdhrm/udev-run
    
    udev: destroy manager before cleaning environment


commit 077fc5e2602effd9b0f46d8ae95271de2b5f2997
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Jul 1 19:25:30 2015 +0200

    udev: destroy manager before cleaning environment
    
    Due to our _cleanup_ usage for the udev manager, it will be destroyed
    after the "exit:" label has finished. Therefore, it is the last
    destruction done in main(). This has two side-effects:
      - mac_selinux is destroyed before the udev manager is, possible causing
        use-after-free if the manager-cleanup accesses selinux data
      - log_close() is called *before* the manager is destroyed, possibly
        re-opening the log if you use --debug (and thus not re-applying the
        --debug option)
    
    Avoid this by moving the manager-handling into a new function called
    run(). This function will be left before we enter the "exit:" label in
    main(), hence, the manager object will be destroyed early.

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index cf15ddf..0b05913 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1608,8 +1608,42 @@ static int manager_new(Manager **ret, int fd_ctrl, int fd_uevent, const char *cg
         return 0;
 }
 
-int main(int argc, char *argv[]) {
+static int run(int fd_ctrl, int fd_uevent, const char *cgroup) {
         _cleanup_(manager_freep) Manager *manager = NULL;
+        int r;
+
+        r = manager_new(&manager, fd_ctrl, fd_uevent, cgroup);
+        if (r < 0) {
+                r = log_error_errno(r, "failed to allocate manager object: %m");
+                goto exit;
+        }
+
+        r = udev_rules_apply_static_dev_perms(manager->rules);
+        if (r < 0)
+                log_error_errno(r, "failed to apply permissions on static device nodes: %m");
+
+        (void) sd_notify(false,
+                         "READY=1\n"
+                         "STATUS=Processing...");
+
+        r = sd_event_loop(manager->event);
+        if (r < 0) {
+                log_error_errno(r, "event loop failed: %m");
+                goto exit;
+        }
+
+        sd_event_get_exit_code(manager->event, &r);
+
+exit:
+        sd_notify(false,
+                  "STOPPING=1\n"
+                  "STATUS=Shutting down...");
+        if (manager)
+                udev_ctrl_cleanup(manager->ctrl);
+        return r;
+}
+
+int main(int argc, char *argv[]) {
         _cleanup_free_ char *cgroup = NULL;
         int r, fd_ctrl, fd_uevent;
 
@@ -1714,35 +1748,9 @@ int main(int argc, char *argv[]) {
                 write_string_file("/proc/self/oom_score_adj", "-1000");
         }
 
-        r = manager_new(&manager, fd_ctrl, fd_uevent, cgroup);
-        if (r < 0) {
-                r = log_error_errno(r, "failed to allocate manager object: %m");
-                goto exit;
-        }
-
-        r = udev_rules_apply_static_dev_perms(manager->rules);
-        if (r < 0)
-                log_error_errno(r, "failed to apply permissions on static device nodes: %m");
-
-        (void) sd_notify(false,
-                         "READY=1\n"
-                         "STATUS=Processing...");
-
-        r = sd_event_loop(manager->event);
-        if (r < 0) {
-                log_error_errno(r, "event loop failed: %m");
-                goto exit;
-        }
-
-        sd_event_get_exit_code(manager->event, &r);
+        r = run(fd_ctrl, fd_uevent, cgroup);
 
 exit:
-        sd_notify(false,
-                  "STOPPING=1\n"
-                  "STATUS=Shutting down...");
-
-        if (manager)
-                udev_ctrl_cleanup(manager->ctrl);
         mac_selinux_finish();
         log_close();
         return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;

commit 78d3e041a57b0c790b7c0b01906d9eb19a031029
Author: Kay Sievers <kay at vrfy.org>
Date:   Wed Jul 1 19:20:59 2015 +0200

    udevd: force --debug mode to stderr
    
    https://github.com/systemd/systemd/issues/462

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index cf15ddf..617bf2f 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1625,8 +1625,10 @@ int main(int argc, char *argv[]) {
         if (r < 0)
                 log_warning_errno(r, "failed to parse kernel command line, ignoring: %m");
 
-        if (arg_debug)
+        if (arg_debug) {
+                log_set_target(LOG_TARGET_CONSOLE);
                 log_set_max_level(LOG_DEBUG);
+        }
 
         if (getuid() != 0) {
                 r = log_error_errno(EPERM, "root privileges required");

commit 3723263f4989ebeb087cf0a1259884de962bc85e
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Jul 1 18:31:18 2015 +0200

    bus-proxy: never apply policy when sending signals
    
    Unlike dbus-daemon, the bus-proxy does not know the receiver of a
    broadcast (as the kernel has exclusive access on the bus connections).
    Hence, and "destination=" matches in dbus1 policies cannot be applied.
    
    But kdbus does not place any restrictions on *SENDING* broadcasts, anyway.
    The kernel never returns EPERM to KDBUS_CMD_SEND if KDBUS_MSG_SIGNAL is
    set. Instead, receiver policies are checked. Hence, stop checking sender
    policies for signals in bus-proxy and leave it up to the kernel.
    
    This fixes some network-manager bus-proxy issues where NM uses weird
    dst-based matches against interface-based matches. As we cannot perform
    dst-based matches, our bus-proxy cannot properly implement this policy.

diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index 28ab1c9..1dc5517 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -494,7 +494,16 @@ static int process_policy_unlocked(sd_bus *from, sd_bus *to, sd_bus_message *m,
                 }
 
                 /* First check if we (the sender) can send to this name */
-                if (policy_check_send(policy, our_ucred->uid, our_ucred->gid, m->header->type, NULL, destination_names, m->path, m->interface, m->member, true, &n)) {
+                if (sd_bus_message_is_signal(m, NULL, NULL)) {
+                        /* If we forward a signal from dbus-1 to kdbus, we have
+                         * no idea who the recipient is. Therefore, we cannot
+                         * apply any dbus-1 policies that match on receiver
+                         * credentials. We know sd-bus always sets
+                         * KDBUS_MSG_SIGNAL, so the kernel applies policies to
+                         * the message. Therefore, skip policy checks in this
+                         * case. */
+                        return 0;
+                } else if (policy_check_send(policy, our_ucred->uid, our_ucred->gid, m->header->type, NULL, destination_names, m->path, m->interface, m->member, true, &n)) {
                         if (n) {
                                 /* If we made a receiver decision, then remember which
                                  * name's policy we used, and to which unique ID it
@@ -512,19 +521,8 @@ static int process_policy_unlocked(sd_bus *from, sd_bus *to, sd_bus_message *m,
                                         return r;
                         }
 
-                        if (sd_bus_message_is_signal(m, NULL, NULL)) {
-                                /* If we forward a signal from dbus-1 to kdbus,
-                                 * we have no idea who the recipient is.
-                                 * Therefore, we cannot apply any dbus-1
-                                 * receiver policies that match on receiver
-                                 * credentials. We know sd-bus always sets
-                                 * KDBUS_MSG_SIGNAL, so the kernel applies
-                                 * receiver policies to the message. Therefore,
-                                 * skip policy checks in this case. */
-                                return 0;
-                        } else if (policy_check_recv(policy, destination_uid, destination_gid, m->header->type, owned_names, NULL, m->path, m->interface, m->member, true)) {
+                        if (policy_check_recv(policy, destination_uid, destination_gid, m->header->type, owned_names, NULL, m->path, m->interface, m->member, true))
                                 return 0;
-                        }
                 }
 
                 /* Return an error back to the caller */

commit 0204c4bd69f694b527643ace9d434befce80085c
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Jul 1 15:05:01 2015 +0200

    login: re-use VT-sessions if they already exist
    
    Right now, if you start a session via 'su' or 'sudo' from within a
    session, we make sure to re-use the existing session instead of creating a
    new one. We detect this by reading the session of the requesting PID.
    
    However, with gnome-terminal running as a busname-unit, and as such
    running outside the session of the user, this will no longer work.
    Therefore, this patch makes sure to return the existing session of a VT if
    you start a new one.
    
    This has the side-effect, that you will re-use a session which your PID is
    not part of. This works fine, but will break assumptions if the parent
    session dies (and as such close your session even though you think you're
    part of it). However, this should be perfectly fine. If you run multiple
    logins on the same session, you should really know what you're doing. The
    current way of silently accepting it but choosing the last registered
    session is just weird.

diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 640ae92..659ce18 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -690,6 +690,8 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus
         }
 
         manager_get_session_by_pid(m, leader, &session);
+        if (!session && vtnr > 0)
+                session = (vtnr < m->seat0->position_count) ? m->seat0->positions[vtnr] : NULL;
         if (session) {
                 _cleanup_free_ char *path = NULL;
                 _cleanup_close_ int fifo_fd = -1;

commit e15b0388654518a138400de8da6cf7c5ce5d8fad
Merge: 0b2ec8a 4e53561
Author: Daniel Mack <github at zonque.org>
Date:   Wed Jul 1 10:34:40 2015 -0400

    Merge pull request #460 from xnox/bootchart-warning
    
    bootchart: do not report warning when disk is missing model.


commit 4e5356169ac2ef7f22e5a101d86009f706b0ff7b
Author: Dimitri John Ledkov <dimitri.j.ledkov at intel.com>
Date:   Wed Jul 1 14:49:15 2015 +0100

    bootchart: do not report warning when disk is missing model.
    
    In VMs / virtio drives there is no model. Also don't print "Disk:
    (null)" in output if no model is available.

diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index 0ac1f55..a7ef653 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -172,7 +172,7 @@ static int svg_title(FILE *of, const char *build, int pscount, double log_start,
 
                 r = read_one_line_file(filename, &model);
                 if (r < 0)
-                        log_warning("Error reading disk model for %s: %m\n", rootbdev);
+                        log_info("Error reading disk model for %s: %m\n", rootbdev);
         }
 
         /* various utsname parameters */
@@ -208,7 +208,8 @@ static int svg_title(FILE *of, const char *build, int pscount, double log_start,
         fprintf(of, "<text class=\"t2\" x=\"20\" y=\"50\">System: %s %s %s %s</text>\n",
                 uts.sysname, uts.release, uts.version, uts.machine);
         fprintf(of, "<text class=\"t2\" x=\"20\" y=\"65\">CPU: %s</text>\n", cpu);
-        fprintf(of, "<text class=\"t2\" x=\"20\" y=\"80\">Disk: %s</text>\n", model);
+        if (model)
+                fprintf(of, "<text class=\"t2\" x=\"20\" y=\"80\">Disk: %s</text>\n", model);
         fprintf(of, "<text class=\"t2\" x=\"20\" y=\"95\">Boot options: %s</text>\n", cmdline);
         fprintf(of, "<text class=\"t2\" x=\"20\" y=\"110\">Build: %s</text>\n", build);
         fprintf(of, "<text class=\"t2\" x=\"20\" y=\"125\">Log start time: %.03fs</text>\n", log_start);

commit 54255c64e6d223deb7d3863e426e78c443fda37c
Author: Christos Trochalakis <yatiohi at ideopolis.gr>
Date:   Wed Jul 1 14:39:53 2015 +0300

    socket: Set SO_REUSEPORT before bind()
    
    bind() fails if it is called before setting SO_REUSEPORT and another
    process is already binded to the same addess.
    
    A new reuse_port option has been introduced to socket_address_listen()
    to set the option as part of socket initialization.

diff --git a/src/basic/socket-label.c b/src/basic/socket-label.c
index cbe3ff2..144e6fd 100644
--- a/src/basic/socket-label.c
+++ b/src/basic/socket-label.c
@@ -38,6 +38,7 @@ int socket_address_listen(
                 int backlog,
                 SocketAddressBindIPv6Only only,
                 const char *bind_to_device,
+                bool reuse_port,
                 bool free_bind,
                 bool transparent,
                 mode_t directory_mode,
@@ -83,6 +84,12 @@ int socket_address_listen(
                         if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, bind_to_device, strlen(bind_to_device)+1) < 0)
                                 return -errno;
 
+                if (reuse_port) {
+                        one = 1;
+                        if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one)) < 0)
+                                log_warning_errno(errno, "SO_REUSEPORT failed: %m");
+                }
+
                 if (free_bind) {
                         one = 1;
                         if (setsockopt(fd, IPPROTO_IP, IP_FREEBIND, &one, sizeof(one)) < 0)
@@ -146,7 +153,7 @@ int make_socket_fd(int log_level, const char* address, int flags) {
         }
 
         fd = socket_address_listen(&a, flags, SOMAXCONN, SOCKET_ADDRESS_DEFAULT,
-                                   NULL, false, false, 0755, 0644, NULL);
+                                   NULL, false, false, false, 0755, 0644, NULL);
         if (fd < 0 || log_get_max_level() >= log_level) {
                 _cleanup_free_ char *p = NULL;
 
diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h
index 538cf59..6b0ce78 100644
--- a/src/basic/socket-util.h
+++ b/src/basic/socket-util.h
@@ -80,6 +80,7 @@ int socket_address_listen(
                 int backlog,
                 SocketAddressBindIPv6Only only,
                 const char *bind_to_device,
+                bool reuse_port,
                 bool free_bind,
                 bool transparent,
                 mode_t directory_mode,
diff --git a/src/core/socket.c b/src/core/socket.c
index d3178e6..693cbc6 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -922,12 +922,6 @@ static void socket_apply_socket_options(Socket *s, int fd) {
                 if (setsockopt(fd, SOL_TCP, TCP_CONGESTION, s->tcp_congestion, strlen(s->tcp_congestion)+1) < 0)
                         log_unit_warning_errno(UNIT(s), errno, "TCP_CONGESTION failed: %m");
 
-        if (s->reuse_port) {
-                int b = s->reuse_port;
-                if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &b, sizeof(b)) < 0)
-                        log_unit_warning_errno(UNIT(s), errno, "SO_REUSEPORT failed: %m");
-        }
-
         if (s->smack_ip_in) {
                 r = mac_smack_apply_ip_in_fd(fd, s->smack_ip_in);
                 if (r < 0)
@@ -1183,6 +1177,7 @@ static int socket_open_fds(Socket *s) {
                                         s->backlog,
                                         s->bind_ipv6_only,
                                         s->bind_to_device,
+                                        s->reuse_port,
                                         s->free_bind,
                                         s->transparent,
                                         s->directory_mode,

commit 0b2ec8a3bfdd6118b3b4958d236ee203ad420f28
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Jul 1 13:02:58 2015 +0200

    sysv-generator: fix coding-style
    
    Fix weird coding-style:
     - proper white-space
     - no if (func() >= 0) bail-outs
     - fix braces
     - avoid 'r' for anything but errno
     - init _cleanup_ variables unconditionally, even if not needed

diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 0d246b1..45b1193 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -240,22 +240,21 @@ static bool usage_contains_reload(const char *line) {
 }
 
 static char *sysv_translate_name(const char *name) {
-        char *r;
-        _cleanup_free_ char *c;
+        _cleanup_free_ char *c = NULL;
+        char *res;
 
         c = strdup(name);
         if (!c)
-            return NULL;
+                return NULL;
 
-        r = endswith(c, ".sh");
-        if (r) {
-            *r = '\0';
-        }
+        res = endswith(c, ".sh");
+        if (res)
+                *res = 0;
 
-        if (unit_name_mangle(c, UNIT_NAME_NOGLOB, &r) >= 0)
-            return r;
-        else
-            return NULL;
+        if (unit_name_mangle(c, UNIT_NAME_NOGLOB, &res) < 0)
+                return NULL;
+
+        return res;
 }
 
 static int sysv_translate_facility(const char *name, const char *filename, char **_r) {
@@ -377,8 +376,7 @@ static int handle_provides(SysvStub *s, unsigned line, const char *full_text, co
                                 if (r < 0)
                                         return log_oom();
                         }
-                }
-                else if (t == _UNIT_TYPE_INVALID)
+                } else if (t == _UNIT_TYPE_INVALID)
                         log_warning("Unit name '%s' is invalid", m);
                 else
                         log_warning("Unknown unit type for unit '%s'", m);

commit e04658277d531763a5cbbb6e212041a35e0d9ff4
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Jul 1 12:54:58 2015 +0200

    Revert "kmod-setup: don't print warning on -ENOSYS"
    
    This partially reverts commit 78d298bbc57e412574ea35e6e66f562d97fd9ebc.
    The changed coding-style is kept, but the ENOENT->ENOSYS conversion is
    reverted.
    
    kmod was fixed upstream to no longer return ENOSYS. Also see:
        https://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/?id=114ec87c85c35a2bd3682f9f891e494127be6fb5
    
    The kmod fix is marked for backport, so no reason to bump the kmod
    version we depend on.

diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
index e7a6bdc..fc6d2f4 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -116,7 +116,7 @@ int kmod_setup(void) {
                 else if (r == KMOD_PROBE_APPLY_BLACKLIST)
                         log_info("Module '%s' is blacklisted", kmod_module_get_name(mod));
                 else {
-                        bool print_warning = kmod_table[i].warn_if_unavailable || (r < 0 && r != -ENOSYS);
+                        bool print_warning = kmod_table[i].warn_if_unavailable || (r < 0 && r != -ENOENT);
 
                         log_full_errno(print_warning ? LOG_WARNING : LOG_DEBUG, r,
                                        "Failed to insert module '%s': %m", kmod_module_get_name(mod));

commit 52a321d839b366d40fdd72bbb6c494016fa3d608
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Wed Jul 1 07:34:23 2015 +0200

    sysv-generator test: Fix random ordering failure
    
    test_simple_escaped() sometimes fails with
    
    AssertionError: Lists differ: ['foo\\x2b.service', 'foo-admin.service'] != ['foo-admin.service', 'foo\\x2b.service']
    
    We don't need to assume any order here, so compare them as a set, not a list.

diff --git a/test/sysv-generator-test.py b/test/sysv-generator-test.py
index 23d6646..721e53a 100644
--- a/test/sysv-generator-test.py
+++ b/test/sysv-generator-test.py
@@ -196,7 +196,7 @@ class SysvGeneratorTest(unittest.TestCase):
         self.add_sysv('foo+', {})
         self.add_sysv('foo-admin', {})
         err, results = self.run_generator()
-        self.assertEqual(list(results), ['foo-admin.service', 'foo\\x2b.service'])
+        self.assertEqual(set(results), {'foo-admin.service', 'foo\\x2b.service'})
         self.assertNotIn('Overwriting', err)
 
     def test_simple_enabled_some(self):

commit 64ea3f926dfd43b52d7ef0399e44ce00587b5993
Merge: dfab39b bbf3520
Author: Kay Sievers <kay at vrfy.org>
Date:   Tue Jun 30 22:32:45 2015 +0200

    Merge pull request #411 from teg/udev-simplify-exec-envp
    
    udev: event - simplify udev_event_spawn() logic


commit dfab39b0179222b4d2f07e2814a8e9f327d42262
Merge: a7e950b 8c2a073
Author: David Herrmann <dh.herrmann at googlemail.com>
Date:   Tue Jun 30 22:15:55 2015 +0200

    Merge pull request #398 from teg/netlink-container-rework
    
    netlink container rework
    
    Allocate containers as separate structs instead of individual arrays for each member field.


commit a7e950bdd9d6ffb1acd139b7eb30da9b91505e9d
Merge: 94f5683 f2b8052
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Tue Jun 30 20:33:15 2015 +0200

    Merge pull request #434 from kaysievers/wip
    
    udev: remove WAIT_FOR key


commit f2b8052fb648b788936dd3e85be6a9aca90fbb2f
Author: Kay Sievers <kay at vrfy.org>
Date:   Tue Jun 30 19:54:37 2015 +0200

    udev: remove WAIT_FOR key
    
    This facility was never a proper solution, but only papered over
    real bugs in the kernel. There are no known sysfs "timing bugs"
    since a long time.

diff --git a/man/udev.xml b/man/udev.xml
index 4c2e13e..2e1655b 100644
--- a/man/udev.xml
+++ b/man/udev.xml
@@ -522,15 +522,6 @@
         </varlistentry>
 
         <varlistentry>
-          <term><varname>WAIT_FOR</varname></term>
-          <listitem>
-            <para>Wait for a file to become available or until a timeout of
-            10 seconds expires. The path is relative to the sysfs device;
-            if no path is specified, this waits for an attribute to appear.</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
           <term><varname>OPTIONS</varname></term>
           <listitem>
             <para>Rule and device options:</para>
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 8ebc061..86531a2 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -682,41 +682,6 @@ static int import_parent_into_properties(struct udev_device *dev, const char *fi
         return 0;
 }
 
-#define WAIT_LOOP_PER_SECOND                50
-static int wait_for_file(struct udev_device *dev, const char *file, int timeout) {
-        char filepath[UTIL_PATH_SIZE];
-        char devicepath[UTIL_PATH_SIZE];
-        struct stat stats;
-        int loop = timeout * WAIT_LOOP_PER_SECOND;
-
-        /* a relative path is a device attribute */
-        devicepath[0] = '\0';
-        if (file[0] != '/') {
-                strscpyl(devicepath, sizeof(devicepath), udev_device_get_syspath(dev), NULL);
-                strscpyl(filepath, sizeof(filepath), devicepath, "/", file, NULL);
-                file = filepath;
-        }
-
-        while (--loop) {
-                const struct timespec duration = { 0, 1000 * 1000 * 1000 / WAIT_LOOP_PER_SECOND };
-
-                /* lookup file */
-                if (stat(file, &stats) == 0) {
-                        log_debug("file '%s' appeared after %i loops", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1);
-                        return 0;
-                }
-                /* make sure, the device did not disappear in the meantime */
-                if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) {
-                        log_debug("device disappeared while waiting for '%s'", file);
-                        return -2;
-                }
-                log_debug("wait for '%s' for %i mseconds", file, 1000 / WAIT_LOOP_PER_SECOND);
-                nanosleep(&duration, NULL);
-        }
-        log_debug("waiting for '%s' failed", file);
-        return -1;
-}
-
 static int attr_subst_subdir(char *attr, size_t len) {
         bool found = false;
 
@@ -1397,15 +1362,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                         continue;
                 }
 
-                if (streq(key, "WAIT_FOR") || streq(key, "WAIT_FOR_SYSFS")) {
-                        if (op == OP_REMOVE) {
-                                log_error("invalid WAIT_FOR/WAIT_FOR_SYSFS operation");
-                                goto invalid;
-                        }
-                        rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL);
-                        continue;
-                }
-
                 if (streq(key, "LABEL")) {
                         if (op == OP_REMOVE) {
                                 log_error("invalid LABEL operation");
@@ -1999,16 +1955,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
                         if (match_key(rules, cur, udev_device_get_driver(event->dev)) != 0)
                                 goto nomatch;
                         break;
-                case TK_M_WAITFOR: {
-                        char filename[UTIL_PATH_SIZE];
-                        int found;
-
-                        udev_event_apply_format(event, rules_str(rules, cur->key.value_off), filename, sizeof(filename));
-                        found = (wait_for_file(event->dev, filename, 10) == 0);
-                        if (!found && (cur->key.op != OP_NOMATCH))
-                                goto nomatch;
-                        break;
-                }
                 case TK_M_ATTR:
                         if (match_attr(rules, event->dev, event, cur) != 0)
                                 goto nomatch;
diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py
index 80bbe65..e43a3da 100644
--- a/test/rule-syntax-check.py
+++ b/test/rule-syntax-check.py
@@ -35,7 +35,7 @@ else:
 
 no_args_tests = re.compile('(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$')
 args_tests = re.compile('(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$')
-no_args_assign = re.compile('(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|LABEL|GOTO|WAIT_FOR|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$')
+no_args_assign = re.compile('(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|LABEL|GOTO|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$')
 args_assign = re.compile('(ATTR|ENV|IMPORT|RUN){([a-zA-Z0-9/_.*%-]+)}\s*(=|\+=)\s*"([^"]*)"$')
 
 result = 0

commit 5833143708733a3fc9e6935922bf11d7d27cb768
Author: Christian Hesse <mail at eworm.de>
Date:   Tue Jun 30 19:12:20 2015 +0200

    man: ProtectHome= protects /root as well

diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index 6487772..45a4422 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -858,9 +858,10 @@
 
         <listitem><para>Takes a boolean argument or
         <literal>read-only</literal>. If true, the directories
-        <filename>/home</filename> and <filename>/run/user</filename>
+        <filename>/home</filename>, <filename>/root</filename> and
+        <filename>/run/user</filename>
         are made inaccessible and empty for processes invoked by this
-        unit. If set to <literal>read-only</literal>, the two
+        unit. If set to <literal>read-only</literal>, the three
         directories are made read-only instead. It is recommended to
         enable this setting for all long-running services (in
         particular network-facing ones), to ensure they cannot get

commit 94f568316080a3c28f5c03bc8a39fc4281af0975
Merge: b7a049d c91d0fd
Author: Tom Gundersen <teg at jklm.no>
Date:   Tue Jun 30 18:39:39 2015 +0200

    Merge pull request #430 from gmacario/fix-issue404-v2
    
    bootchart: Ensure that /proc/schedstat is read entirely (v2)


commit b7a049dba57de92bff27917d5125b719c0e43295
Merge: 2f280f1 7fe2bb8
Author: Tom Gundersen <teg at jklm.no>
Date:   Tue Jun 30 18:24:14 2015 +0200

    Merge pull request #429 from richardmaw-codethink/nspawn-userns-uid-shift-autodetection-fix
    
    nspawn: determine_uid_shift before forking


commit 2f280f17d9ac6e82c596f2f22b37dd622e13c092
Merge: 96f9102 3c59d4f
Author: Tom Gundersen <teg at jklm.no>
Date:   Tue Jun 30 18:16:02 2015 +0200

    Merge pull request #428 from richardmaw-codethink/nspawn-userns-remount-fail
    
    nspawn: Don't remount with fewer options


commit c91d0fd2f433af7f314558c59026248a79695ab5
Author: Gianpaolo Macario <gianpaolo_macario at mentor.com>
Date:   Tue Jun 30 15:09:02 2015 +0000

    bootchart: Ensure that /proc/schedstat is read entirely
    
    On multi-core systems file /proc/schedstat may be
    larger than 4096 bytes and pread() will only read part of it.
    
    Fix issue https://github.com/systemd/systemd/issues/404

diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index 00439f0..caa97b9 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -37,6 +37,7 @@
 #include "store.h"
 #include "bootchart.h"
 #include "cgroup-util.h"
+#include "fileio.h"
 
 /*
  * Alloc a static 4k buffer for stdio - primarily used to increase
@@ -97,13 +98,14 @@ int log_sample(DIR *proc,
                int *cpus) {
 
         static int vmstat = -1;
-        static int schedstat = -1;
+        _cleanup_free_ char *buf_schedstat = NULL;
         char buf[4096];
         char key[256];
         char val[256];
         char rt[256];
         char wt[256];
         char *m;
+        int r;
         int c;
         int p;
         int mod;
@@ -156,27 +158,13 @@ vmstat_next:
                         break;
         }
 
-        if (schedstat < 0) {
-                /* overall CPU utilization */
-                schedstat = openat(procfd, "schedstat", O_RDONLY|O_CLOEXEC);
-                if (schedstat < 0)
-                        return log_error_errno(errno, "Failed to open /proc/schedstat (requires CONFIG_SCHEDSTATS=y in kernel config): %m");
-        }
+        /* Parse "/proc/schedstat" for overall CPU utilization */
+        r = read_full_file("/proc/schedstat", &buf_schedstat, NULL);
+        if (r < 0)
+            return log_error_errno(r, "Unable to read schedstat: %m");
 
-        n = pread(schedstat, buf, sizeof(buf) - 1, 0);
-        if (n <= 0) {
-                schedstat = safe_close(schedstat);
-                if (n < 0)
-                        return -errno;
-                return -ENODATA;
-        }
-
-        buf[n] = '\0';
-
-        m = buf;
+        m = buf_schedstat;
         while (m) {
-                int r;
-
                 if (sscanf(m, "%s %*s %*s %*s %*s %*s %*s %s %s", key, rt, wt) < 3)
                         goto schedstat_next;
 
@@ -238,7 +226,6 @@ schedstat_next:
                         _cleanup_fclose_ FILE *st = NULL;
                         char t[32];
                         struct ps_struct *parent;
-                        int r;
 
                         ps->next_ps = new0(struct ps_struct, 1);
                         if (!ps->next_ps)
@@ -427,7 +414,6 @@ schedstat_next:
                                 return -errno;
                         }
                         FOREACH_DIRENT(ent, taskdir, break) {
-                                int r;
                                 int tid = -1;
                                 _cleanup_close_ int tid_schedstat = -1;
                                 long long delta_rt;

commit 96f9102ce0c0d4152e67b01007706fcd56c9b4a2
Merge: 8914ea0 10f00ff
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jun 30 10:58:35 2015 -0400

    Merge pull request #424 from endocode/iaguis/shutdown-log-null
    
    core: handle --log-target=null when calling systemd-shutdown


commit 7fe2bb84c49233ca4da76c0df377819b93571f9c
Author: Richard Maw <richard.maw at codethink.co.uk>
Date:   Tue Jun 30 13:41:41 2015 +0000

    nspawn: determine_uid_shift before forking
    
    It is needed in one branch of the fork, but calculated in another
    branch.
    
    Failing to do this means using --private-users without specifying a uid
    shift always fails because it tries to shift the uid to UID_INVALID.

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 4cf2d14..e0437e7 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -4313,10 +4313,6 @@ static int outer_child(
         if (r < 0)
                 return r;
 
-        r = determine_uid_shift(directory);
-        if (r < 0)
-                return r;
-
         /* Turn directory into bind mount */
         if (mount(directory, directory, NULL, MS_BIND|MS_REC, NULL) < 0)
                 return log_error_errno(errno, "Failed to make bind mount: %m");
@@ -4495,6 +4491,10 @@ int main(int argc, char *argv[]) {
         if (r < 0)
                 goto finish;
 
+        r = determine_uid_shift(arg_directory);
+        if (r < 0)
+                return r;
+
         if (geteuid() != 0) {
                 log_error("Need to be root.");
                 r = -EPERM;

commit 3c59d4f21f714838ce0c28b2a4ff305e56a4a342
Author: Richard Maw <richard.maw at codethink.co.uk>
Date:   Tue Jun 30 13:21:14 2015 +0000

    nspawn: Don't remount with fewer options
    
    When we do a MS_BIND mount, it inherits the flags of its parent mount.
    When we do a remount, it sets the flags to exactly what is specified.
    If we are in a user namespace then these mount points have their flags
    locked, so you can't reduce the protection.
    
    As a consequence, the default setup of mount_all doesn't work with user
    namespaces. However if we ensure we add the mount flags of the parent
    mount when remounting, then we aren't removing mount options, so we
    aren't trying to unlock an option that we aren't allowed to.

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 4cf2d14..df341a6 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1074,18 +1074,18 @@ static int mount_all(const char *dest, bool userns) {
         } MountPoint;
 
         static const MountPoint mount_table[] = {
-                { "proc",      "/proc",          "proc",   NULL,        MS_NOSUID|MS_NOEXEC|MS_NODEV,                true,  true  },
-                { "/proc/sys", "/proc/sys",      NULL,     NULL,        MS_BIND,                                     true,  true  },   /* Bind mount first */
-                { NULL,        "/proc/sys",      NULL,     NULL,        MS_BIND|MS_RDONLY|MS_REMOUNT,                true,  true  },   /* Then, make it r/o */
-                { "sysfs",     "/sys",           "sysfs",  NULL,        MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV,      true,  false },
-                { "tmpfs",     "/sys/fs/cgroup", "tmpfs",  "mode=755",  MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME, true,  false },
-                { "tmpfs",     "/dev",           "tmpfs",  "mode=755",  MS_NOSUID|MS_STRICTATIME,                    true,  false },
-                { "tmpfs",     "/dev/shm",       "tmpfs",  "mode=1777", MS_NOSUID|MS_NODEV|MS_STRICTATIME,           true,  false },
-                { "tmpfs",     "/run",           "tmpfs",  "mode=755",  MS_NOSUID|MS_NODEV|MS_STRICTATIME,           true,  false },
-                { "tmpfs",     "/tmp",           "tmpfs",  "mode=1777", MS_STRICTATIME,                              true,  false },
+                { "proc",      "/proc",          "proc",   NULL,        MS_NOSUID|MS_NOEXEC|MS_NODEV,                              true,  true  },
+                { "/proc/sys", "/proc/sys",      NULL,     NULL,        MS_BIND,                                                   true,  true  },   /* Bind mount first */
+                { NULL,        "/proc/sys",      NULL,     NULL,        MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT, true,  true  },   /* Then, make it r/o */
+                { "sysfs",     "/sys",           "sysfs",  NULL,        MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV,                    true,  false },
+                { "tmpfs",     "/sys/fs/cgroup", "tmpfs",  "mode=755",  MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME,               true,  false },
+                { "tmpfs",     "/dev",           "tmpfs",  "mode=755",  MS_NOSUID|MS_STRICTATIME,                                  true,  false },
+                { "tmpfs",     "/dev/shm",       "tmpfs",  "mode=1777", MS_NOSUID|MS_NODEV|MS_STRICTATIME,                         true,  false },
+                { "tmpfs",     "/run",           "tmpfs",  "mode=755",  MS_NOSUID|MS_NODEV|MS_STRICTATIME,                         true,  false },
+                { "tmpfs",     "/tmp",           "tmpfs",  "mode=1777", MS_STRICTATIME,                                            true,  false },
 #ifdef HAVE_SELINUX
-                { "/sys/fs/selinux", "/sys/fs/selinux", NULL, NULL,     MS_BIND,                                     false, false },  /* Bind mount first */
-                { NULL,              "/sys/fs/selinux", NULL, NULL,     MS_BIND|MS_RDONLY|MS_REMOUNT,                false, false },  /* Then, make it r/o */
+                { "/sys/fs/selinux", "/sys/fs/selinux", NULL, NULL,     MS_BIND,                                                   false, false },  /* Bind mount first */
+                { NULL,              "/sys/fs/selinux", NULL, NULL,     MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT, false, false },  /* Then, make it r/o */
 #endif
         };
 

commit e4f42f9d1eb609a515ad1434512d5ad3d96c9b72
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Tue Jun 30 09:56:44 2015 -0400

    build-sys: use wildcard glob in update-man-list again
    
    The idea is that after adding a new man page, make update-man-list
    will be used to regenerate part of the makefile. So the data already
    present in the makefile cannot be used to do that.
    
    Also, renames filter out generated xml files in make-man-rules.py
    itself in order to make Makefile.am a bit simpler, and rename files
    to dist_files to better reflect new meaning.

diff --git a/Makefile.am b/Makefile.am
index 7ac3c1d..0fa4cf4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -708,10 +708,14 @@ noinst_DATA += \
 CLEANFILES += \
 	man/index.html
 
+XML_GLOB = $(wildcard $(top_srcdir)/man/*.xml)
 NON_INDEX_XML_FILES = $(filter-out man/systemd.index.xml,$(XML_FILES))
 SOURCE_XML_FILES = ${patsubst %,$(top_srcdir)/%,$(filter-out man/systemd.directives.xml,$(NON_INDEX_XML_FILES))}
 
-update-man-list: $(top_srcdir)/tools/make-man-rules.py $(SOURCE_XML_FILES)
+# This target should only be run manually. It recreates Makefile-man.am
+# file in the source directory based on all man/*.xml files. Run it after
+# adding, removing, or changing the conditional in a man page.
+update-man-list: $(top_srcdir)/tools/make-man-rules.py $(XML_GLOB)
 	$(AM_V_GEN)$(PYTHON) $^ > $(top_srcdir)/Makefile-man.tmp
 	$(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp $(top_srcdir)/Makefile-man.am
 	@echo "Makefile-man.am has been regenerated"
diff --git a/tools/make-man-rules.py b/tools/make-man-rules.py
index e75bfff..5e61917 100644
--- a/tools/make-man-rules.py
+++ b/tools/make-man-rules.py
@@ -62,7 +62,7 @@ FOOTER = '''\
 # Really, do not edit this file.
 
 EXTRA_DIST += \\
-	{files}
+	{dist_files}
 '''
 
 def man(page, number):
@@ -106,7 +106,7 @@ def create_rules(xml_files):
 def mjoin(files):
     return ' \\\n\t'.join(sorted(files) or '#')
 
-def make_makefile(rules, files):
+def make_makefile(rules, dist_files):
     return HEADER + '\n'.join(
         (CONDITIONAL if conditional else SECTION).format(
             manpages=mjoin(set(rulegroup.values())),
@@ -119,9 +119,11 @@ def make_makefile(rules, files):
                                 if k != v),
             conditional=conditional)
         for conditional,rulegroup in sorted(rules.items())
-        ) + FOOTER.format(files=mjoin(sorted(files)))
+        ) + FOOTER.format(dist_files=mjoin(sorted(dist_files)))
 
 if __name__ == '__main__':
     rules = create_rules(sys.argv[1:])
-    files = (xml(file) for file in sys.argv[1:])
-    print(make_makefile(rules, files), end='')
+    dist_files = (xml(file) for file in sys.argv[1:]
+                  if not file.endswith(".directives.xml") and
+                     not file.endswith(".index.xml"))
+    print(make_makefile(rules, dist_files), end='')

commit c9aca734385aa388f60aff1ac13de89cf6f166e1
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Tue Jun 30 09:29:48 2015 -0400

    build-sys: update Makefile-man
    
    Follow up for e6de49abfd28098c65b8a0be05bb84cf6cf780ae.

diff --git a/Makefile-man.am b/Makefile-man.am
index 734a923..74a1f4c 100644
--- a/Makefile-man.am
+++ b/Makefile-man.am
@@ -23,7 +23,6 @@ MANPAGES += \
 	man/localtime.5 \
 	man/machine-id.5 \
 	man/machine-info.5 \
-	man/networkctl.1 \
 	man/os-release.5 \
 	man/sd-daemon.3 \
 	man/sd-id128.3 \
@@ -144,7 +143,6 @@ MANPAGES += \
 	man/systemd.time.7 \
 	man/systemd.timer.5 \
 	man/systemd.unit.5 \
-	man/sysusers.d.5 \
 	man/telinit.8 \
 	man/tmpfiles.d.5 \
 	man/udev.7 \
@@ -1538,6 +1536,7 @@ endif
 
 if ENABLE_NETWORKD
 MANPAGES += \
+	man/networkctl.1 \
 	man/systemd-networkd-wait-online.service.8 \
 	man/systemd-networkd.service.8 \
 	man/systemd.netdev.5 \
@@ -1605,6 +1604,15 @@ man/systemd-rfkill.html: man/systemd-rfkill at .service.html
 
 endif
 
+if ENABLE_SYSUSERS
+MANPAGES += \
+	man/sysusers.d.5
+MANPAGES_ALIAS += \
+	#
+
+
+endif
+
 if ENABLE_TIMEDATED
 MANPAGES += \
 	man/systemd-timedated.service.8 \

commit 10f00ff17b9c9b55dc77c99797d27cb819fa5fdf
Author: Iago López Galeiras <iago at endocode.com>
Date:   Tue Jun 30 15:08:49 2015 +0200

    core: handle --log-target=null when calling systemd-shutdown
    
    When shutting down, if systemd was started with --log-target=null,
    systemd-shutdown was being called with --log-target=console.

diff --git a/src/core/main.c b/src/core/main.c
index 332453a..523f0ce 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1995,6 +1995,10 @@ finish:
                         command_line[pos++] = "kmsg";
                         break;
 
+                case LOG_TARGET_NULL:
+                        command_line[pos++] = "null";
+                        break;
+
                 case LOG_TARGET_CONSOLE:
                 default:
                         command_line[pos++] = "console";

commit 8914ea0e90f2c9316dcccb6402ff86339eb195e1
Merge: 745b8fc 264581a
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Jun 29 23:30:14 2015 +0200

    Merge pull request #412 from fsateler/sysv-invalid-names-v2
    
    sysv-generator: detect invalid names and escape them V2


commit 745b8fcca9428668b6dd482cbc0468b8dfe2bab0
Merge: 2ab4c7c 1d3eaa9
Author: Daniel Mack <github at zonque.org>
Date:   Mon Jun 29 22:23:25 2015 +0200

    Merge pull request #413 from jaystrictor/manpages
    
    man: remove repeated word "the" and polish


commit 1d3eaa93616a2e9f6568b754a65c884766bac6c4
Author: Jay Strict <jay.strict at posteo.de>
Date:   Mon Jun 29 21:20:02 2015 +0200

    man: remove repeated word "the" and polish

diff --git a/man/journalctl.xml b/man/journalctl.xml
index 08de0ff..ca93364 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -111,9 +111,9 @@
       <para>All users are granted access to their private per-user
       journals. However, by default, only root and users who are
       members of a few special groups are granted access to the system
-      journal and the journals of other users. Members of the the
+      journal and the journals of other users. Members of the groups
       <literal>systemd-journal</literal>, <literal>adm</literal>, and
-      <literal>wheel</literal> groups can read all journal files. Note
+      <literal>wheel</literal> can read all journal files. Note
       that the two latter groups traditionally have additional
       privileges specified by the distribution. Members of the
       <literal>wheel</literal> group can often perform administrative
diff --git a/man/machinectl.xml b/man/machinectl.xml
index cf17349..4b87870 100644
--- a/man/machinectl.xml
+++ b/man/machinectl.xml
@@ -628,7 +628,7 @@
         <para>Image verification is identical for raw and tar images
         (see above).</para>
 
-        <para>If the the downloaded image is in
+        <para>If the downloaded image is in
         <filename>.qcow2</filename> format it is converted into a raw
         image file before it is made available.</para>
 
diff --git a/man/networkctl.xml b/man/networkctl.xml
index 884d200..388afbe 100644
--- a/man/networkctl.xml
+++ b/man/networkctl.xml
@@ -64,7 +64,7 @@
     state of the network links as seen by
     <command>systemd-networkd</command>.  Please refer to
     <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-    for an introduction to the the basic concepts, functionality, and
+    for an introduction to the basic concepts, functionality, and
     configuration syntax.</para>
   </refsect1>
 
diff --git a/man/sd_notify.xml b/man/sd_notify.xml
index 87e59c9..14030f5 100644
--- a/man/sd_notify.xml
+++ b/man/sd_notify.xml
@@ -197,7 +197,7 @@
         <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
         for information how to enable this functionality and
         <citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>
-        for the details of how the service can check if the the
+        for the details of how the service can check whether the
         watchdog is enabled. </para></listitem>
       </varlistentry>
 

commit 264581a2f1599a27de577549dc75fccefef6a579
Author: Felipe Sateler <fsateler at debian.org>
Date:   Sat Jun 27 21:00:32 2015 -0300

    sysv-generator: escape names when translating from sysv name
    
    While the LSB suggests only [A-Za-z0-9], that doesn't prevent admins
    from doing the wrong thing. Lets not generate invalid names in
    that case.

diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index c9dd3b6..0d246b1 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -241,19 +241,21 @@ static bool usage_contains_reload(const char *line) {
 
 static char *sysv_translate_name(const char *name) {
         char *r;
+        _cleanup_free_ char *c;
 
-        r = new(char, strlen(name) + strlen(".service") + 1);
-        if (!r)
-                return NULL;
+        c = strdup(name);
+        if (!c)
+            return NULL;
 
-        if (endswith(name, ".sh"))
-                /* Drop .sh suffix */
-                strcpy(stpcpy(r, name) - 3, ".service");
-        else
-                /* Normal init script name */
-                strcpy(stpcpy(r, name), ".service");
+        r = endswith(c, ".sh");
+        if (r) {
+            *r = '\0';
+        }
 
-        return r;
+        if (unit_name_mangle(c, UNIT_NAME_NOGLOB, &r) >= 0)
+            return r;
+        else
+            return NULL;
 }
 
 static int sysv_translate_facility(const char *name, const char *filename, char **_r) {
diff --git a/test/sysv-generator-test.py b/test/sysv-generator-test.py
index af0493b..23d6646 100644
--- a/test/sysv-generator-test.py
+++ b/test/sysv-generator-test.py
@@ -190,6 +190,15 @@ class SysvGeneratorTest(unittest.TestCase):
         self.assert_enabled('foo.service', ['multi-user', 'graphical'])
         self.assertNotIn('Overwriting', err)
 
+    def test_simple_escaped(self):
+        '''simple service without dependencies, that requires escaping the name'''
+
+        self.add_sysv('foo+', {})
+        self.add_sysv('foo-admin', {})
+        err, results = self.run_generator()
+        self.assertEqual(list(results), ['foo-admin.service', 'foo\\x2b.service'])
+        self.assertNotIn('Overwriting', err)
+
     def test_simple_enabled_some(self):
         '''simple service without dependencies, enabled in some runlevels'''
 
@@ -276,6 +285,16 @@ class SysvGeneratorTest(unittest.TestCase):
                              'foo.service')
         self.assertNotIn('Overwriting', err)
 
+    def test_provides_escaped(self):
+        '''a script that Provides: a name that requires escaping'''
+
+        self.add_sysv('foo', {'Provides': 'foo foo+'})
+        err, results = self.run_generator()
+        self.assertEqual(list(results), ['foo.service'])
+        self.assertEqual(os.readlink(os.path.join(self.out_dir, 'foo\\x2b.service')),
+                'foo.service')
+        self.assertNotIn('Overwriting', err)
+
     def test_same_provides_in_multiple_scripts(self):
         '''multiple init.d scripts provide the same name'''
 

commit 2c09a745eba5f463e12b498a2f62a5036253c55c
Author: Felipe Sateler <fsateler at debian.org>
Date:   Sat Jun 27 21:02:53 2015 -0300

    sysv-generator: detect invalid provided unit names
    
    Do not assume that a non-service unit type is a target.

diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 9ae518a..c9dd3b6 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -340,6 +340,7 @@ static int handle_provides(SysvStub *s, unsigned line, const char *full_text, co
 
         FOREACH_WORD_QUOTED(word, z, text, state_) {
                 _cleanup_free_ char *n = NULL, *m = NULL;
+                UnitType t;
 
                 n = strndup(word, z);
                 if (!n)
@@ -351,12 +352,13 @@ static int handle_provides(SysvStub *s, unsigned line, const char *full_text, co
                 if (r == 0)
                         continue;
 
-                if (unit_name_to_type(m) == UNIT_SERVICE) {
+                t = unit_name_to_type(m);
+                if (t == UNIT_SERVICE) {
                         log_debug("Adding Provides: alias '%s' for '%s'", m, s->name);
                         r = add_alias(s->name, m);
                         if (r < 0)
                                 log_warning_errno(r, "[%s:%u] Failed to add LSB Provides name %s, ignoring: %m", s->path, line, m);
-                } else {
+                } else if (t == UNIT_TARGET) {
                         /* NB: SysV targets which are provided by a
                          * service are pulled in by the services, as
                          * an indication that the generic service is
@@ -374,6 +376,10 @@ static int handle_provides(SysvStub *s, unsigned line, const char *full_text, co
                                         return log_oom();
                         }
                 }
+                else if (t == _UNIT_TYPE_INVALID)
+                        log_warning("Unit name '%s' is invalid", m);
+                else
+                        log_warning("Unknown unit type for unit '%s'", m);
         }
         if (!isempty(state_))
                 log_error("[%s:%u] Trailing garbage in Provides, ignoring.", s->path, line);

commit 2ab4c7c9f3fd127f13fd4b91924d5432693fadc6
Merge: 1cf34d7 72590bc
Author: Daniel Mack <github at zonque.org>
Date:   Mon Jun 29 20:02:14 2015 +0200

    Merge pull request #410 from teg/docs-gitignore
    
    docs: remove stale .gitignore


commit bbf35206735f97cf3fcda8d26982b35b0cad20a9
Author: Tom Gundersen <teg at jklm.no>
Date:   Sun Jun 28 23:42:52 2015 +0200

    udev: event - simplify udev_event_spawn() logic
    
    Push the extraction of the envp + argv as close as possible to their use, to avoid code
    duplication. As a sideeffect fix logging when delaing execution.

diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 1092071..4761222 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -721,19 +721,13 @@ int udev_event_spawn(struct udev_event *event,
                      usec_t timeout_usec,
                      usec_t timeout_warn_usec,
                      bool accept_failure,
-                     const char *cmd, char **envp,
+                     const char *cmd,
                      char *result, size_t ressize) {
         int outpipe[2] = {-1, -1};
         int errpipe[2] = {-1, -1};
         pid_t pid;
-        char arg[UTIL_PATH_SIZE];
-        char *argv[128];
-        char program[UTIL_PATH_SIZE];
         int err = 0;
 
-        strscpy(arg, sizeof(arg), cmd);
-        udev_build_argv(event->udev, arg, NULL, argv);
-
         /* pipes from child to parent */
         if (result != NULL || log_get_max_level() >= LOG_INFO) {
                 if (pipe2(outpipe, O_NONBLOCK) != 0) {
@@ -750,15 +744,14 @@ int udev_event_spawn(struct udev_event *event,
                 }
         }
 
-        /* allow programs in /usr/lib/udev/ to be called without the path */
-        if (argv[0][0] != '/') {
-                strscpyl(program, sizeof(program), UDEVLIBEXECDIR "/", argv[0], NULL);
-                argv[0] = program;
-        }
-
         pid = fork();
         switch(pid) {
         case 0:
+        {
+                char arg[UTIL_PATH_SIZE];
+                char *argv[128];
+                char program[UTIL_PATH_SIZE];
+
                 /* child closes parent's ends of pipes */
                 if (outpipe[READ_END] >= 0) {
                         close(outpipe[READ_END]);
@@ -769,12 +762,22 @@ int udev_event_spawn(struct udev_event *event,
                         errpipe[READ_END] = -1;
                 }
 
+                strscpy(arg, sizeof(arg), cmd);
+                udev_build_argv(event->udev, arg, NULL, argv);
+
+                /* allow programs in /usr/lib/udev/ to be called without the path */
+                if (argv[0][0] != '/') {
+                        strscpyl(program, sizeof(program), UDEVLIBEXECDIR "/", argv[0], NULL);
+                        argv[0] = program;
+                }
+
                 log_debug("starting '%s'", cmd);
 
-                spawn_exec(event, cmd, argv, envp,
+                spawn_exec(event, cmd, argv, udev_device_get_properties_envp(event->dev),
                            outpipe[WRITE_END], errpipe[WRITE_END]);
 
-                _exit(2 );
+                _exit(2);
+        }
         case -1:
                 log_error_errno(errno, "fork of '%s' failed: %m", cmd);
                 err = -1;
@@ -934,26 +937,21 @@ void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_
         struct udev_list_entry *list_entry;
 
         udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) {
+                char command[UTIL_PATH_SIZE];
                 const char *cmd = udev_list_entry_get_name(list_entry);
                 enum udev_builtin_cmd builtin_cmd = udev_list_entry_get_num(list_entry);
 
-                if (builtin_cmd < UDEV_BUILTIN_MAX) {
-                        char command[UTIL_PATH_SIZE];
+                udev_event_apply_format(event, cmd, command, sizeof(command));
 
-                        udev_event_apply_format(event, cmd, command, sizeof(command));
+                if (builtin_cmd < UDEV_BUILTIN_MAX)
                         udev_builtin_run(event->dev, builtin_cmd, command, false);
-                } else {
-                        char program[UTIL_PATH_SIZE];
-                        char **envp;
-
+                else {
                         if (event->exec_delay > 0) {
-                                log_debug("delay execution of '%s'", program);
+                                log_debug("delay execution of '%s'", command);
                                 sleep(event->exec_delay);
                         }
 
-                        udev_event_apply_format(event, cmd, program, sizeof(program));
-                        envp = udev_device_get_properties_envp(event->dev);
-                        udev_event_spawn(event, timeout_usec, timeout_warn_usec, false, program, envp, NULL, 0);
+                        udev_event_spawn(event, timeout_usec, timeout_warn_usec, false, command, NULL, 0);
                 }
         }
 }
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 8ebc061..c3e2e21 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -634,14 +634,11 @@ static int import_program_into_properties(struct udev_event *event,
                                           usec_t timeout_usec,
                                           usec_t timeout_warn_usec,
                                           const char *program) {
-        struct udev_device *dev = event->dev;
-        char **envp;
         char result[UTIL_LINE_SIZE];
         char *line;
         int err;
 
-        envp = udev_device_get_properties_envp(dev);
-        err = udev_event_spawn(event, timeout_usec, timeout_warn_usec, true, program, envp, result, sizeof(result));
+        err = udev_event_spawn(event, timeout_usec, timeout_warn_usec, true, program, result, sizeof(result));
         if (err < 0)
                 return err;
 
@@ -654,7 +651,7 @@ static int import_program_into_properties(struct udev_event *event,
                         pos[0] = '\0';
                         pos = &pos[1];
                 }
-                import_property_from_string(dev, line);
+                import_property_from_string(event->dev, line);
                 line = pos;
         }
         return 0;
@@ -2119,19 +2116,17 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
                 }
                 case TK_M_PROGRAM: {
                         char program[UTIL_PATH_SIZE];
-                        char **envp;
                         char result[UTIL_LINE_SIZE];
 
                         free(event->program_result);
                         event->program_result = NULL;
                         udev_event_apply_format(event, rules_str(rules, cur->key.value_off), program, sizeof(program));
-                        envp = udev_device_get_properties_envp(event->dev);
                         log_debug("PROGRAM '%s' %s:%u",
                                   program,
                                   rules_str(rules, rule->rule.filename_off),
                                   rule->rule.filename_line);
 
-                        if (udev_event_spawn(event, timeout_usec, timeout_warn_usec, true, program, envp, result, sizeof(result)) < 0) {
+                        if (udev_event_spawn(event, timeout_usec, timeout_warn_usec, true, program, result, sizeof(result)) < 0) {
                                 if (cur->key.op != OP_NOMATCH)
                                         goto nomatch;
                         } else {
diff --git a/src/udev/udev.h b/src/udev/udev.h
index 3dca72e..d17fc8c 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -85,8 +85,7 @@ int udev_event_spawn(struct udev_event *event,
                      usec_t timeout_usec,
                      usec_t timeout_warn_usec,
                      bool accept_failure,
-                     const char *cmd, char **envp,
-                     char *result, size_t ressize);
+                     const char *cmd, char *result, size_t ressize);
 void udev_event_execute_rules(struct udev_event *event,
                               usec_t timeout_usec, usec_t timeout_warn_usec,
                               struct udev_list *properties_list,

commit 72590bcb4ef56db29b9d5c45a0e76a5b18e62908
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Jun 29 19:45:10 2015 +0200

    docs: remove stale .gitignore
    
    This is no longer useful as the udev docs are gone.

diff --git a/docs/.gitignore b/docs/.gitignore
deleted file mode 100644
index ac7af2e..0000000
--- a/docs/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/html/

commit 1cf34d7118e93f0734a52d0eb09f238cf9962b85
Merge: ab49ae5 853382d
Author: Daniel Mack <github at zonque.org>
Date:   Mon Jun 29 18:58:19 2015 +0200

    Merge pull request #408 from ColdPie1/fix_resp
    
    man: Remove instances of pseudo-English "resp."


commit 853382da70f69c115170f2e44273d81f876d2a66
Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Fri Jun 26 11:02:00 2015 -0500

    man: Remove instances of pseudo-English "resp."
    
    Me again :) Just noticed one of these in a manpage and did another pass
    to clean them up.  See 16dad32e437fdf2ffca03cc60a083d84bd31886f for
    explanation, though the link needs updating:
    <http://transblawg.eu/2004/02/26/resp-and-other-non-existent-english-wordsnicht-existente-englische-worter/>

diff --git a/man/systemctl.xml b/man/systemctl.xml
index 409b6f0..e18ef6f 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -1181,9 +1181,9 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
           <replaceable>NAME</replaceable>...</command></term>
 
           <listitem>
-            <para>Adds <literal>Wants=</literal> resp. <literal>Requires=</literal>
-            dependency to the specified <replaceable>TARGET</replaceable> for
-            one or more units. </para>
+            <para>Adds <literal>Wants=</literal> or <literal>Requires=</literal>
+            dependency, respectively, to the specified
+            <replaceable>TARGET</replaceable> for one or more units. </para>
 
             <para>This command honors <option>--system</option>,
             <option>--user</option>, <option>--runtime</option> and
diff --git a/man/systemd.time.xml b/man/systemd.time.xml
index da07297..6435835 100644
--- a/man/systemd.time.xml
+++ b/man/systemd.time.xml
@@ -125,7 +125,7 @@
     (<literal>Wednesday</literal>) English language form (case does
     not matter), and is not subject to the locale choice of the user.
     Either the date, or the time part may be omitted, in which case
-    the current date or 00:00:00, resp., is assumed. The seconds
+    the current date or 00:00:00, respectively, is assumed. The seconds
     component of the time may also be omitted, in which case ":00" is
     assumed. Year numbers may be specified in full or may be
     abbreviated (omitting the century).</para>

commit ab49ae5ba6fdf9834dfeb3be0358a77b933869fb
Merge: 0bf134a 0051ebf
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Jun 29 16:02:33 2015 +0200

    Merge pull request #387 from kaysievers/wip
    
    udev: Remove accelerometer helper


commit 62e2d5bbabf0e6a5a262e9e1bed184552d98b0d9
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Jun 29 14:24:40 2015 +0200

    networkd: netdev - avoid hanging transactions in failure cases
    
    If a link is attempted t obe enslaved by a netdev that has already failed, we
    must fail immediately and not save the callback for later, as it will then
    never get triggered.

diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 16243a5..dff81a5 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1360,8 +1360,7 @@ static int link_joined(Link *link) {
         return link_enter_set_addresses(link);
 }
 
-static int netdev_join_handler(sd_netlink *rtnl, sd_netlink_message *m,
-                               void *userdata) {
+static int netdev_join_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
         _cleanup_link_unref_ Link *link = userdata;
         int r;
 
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 73d3b6b..6949b40 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -96,6 +96,7 @@ static void netdev_cancel_callbacks(NetDev *netdev) {
                 }
 
                 LIST_REMOVE(callbacks, netdev->callbacks, callback);
+                link_unref(callback->link);
                 free(callback);
         }
 }
@@ -177,6 +178,8 @@ int netdev_get(Manager *manager, const char *name, NetDev **ret) {
 static int netdev_enter_failed(NetDev *netdev) {
         netdev->state = NETDEV_STATE_FAILED;
 
+        netdev_cancel_callbacks(netdev);
+
         return 0;
 }
 
@@ -266,12 +269,20 @@ int netdev_enslave(NetDev *netdev, Link *link, sd_netlink_message_handler_t call
         int r;
 
         assert(netdev);
+        assert(netdev->manager);
+        assert(netdev->manager->rtnl);
         assert(IN_SET(netdev->kind, NETDEV_KIND_BRIDGE, NETDEV_KIND_BOND));
 
         if (netdev->state == NETDEV_STATE_READY) {
                 r = netdev_enslave_ready(netdev, link, callback);
                 if (r < 0)
                         return r;
+        } else if (IN_SET(netdev->state, NETDEV_STATE_LINGER, NETDEV_STATE_FAILED)) {
+                _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
+
+                r = rtnl_message_new_synthetic_error(-ENODEV, 0, &m);
+                if (r >= 0)
+                        callback(netdev->manager->rtnl, m, link);
         } else {
                 /* the netdev is not yet read, save this request for when it is */
                 netdev_join_callback *cb;

commit b024a9cfb1bee0aa8e143f46db11a4c2a58fb798
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Jun 29 14:23:17 2015 +0200

    networkd: fix segfault when cancelling callbacks
    
    This only happens when something has gone wrong, so is not easy to hit. However,
    if a bridge (say) is configured on a system without bridge support we will hit
    this.
    
    Fixes issue #299.

diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index ece9ecc..73d3b6b 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -92,7 +92,7 @@ static void netdev_cancel_callbacks(NetDev *netdev) {
                         assert(netdev->manager);
                         assert(netdev->manager->rtnl);
 
-                        callback->callback(netdev->manager->rtnl, m, link);
+                        callback->callback(netdev->manager->rtnl, m, callback->link);
                 }
 
                 LIST_REMOVE(callbacks, netdev->callbacks, callback);

commit 0bf134a734cdde8c1a7a62256e8664fa01125608
Merge: a611cd7 ba27fb2
Author: Kay Sievers <kay at vrfy.org>
Date:   Mon Jun 29 10:59:35 2015 +0200

    Merge pull request #403 from cedricde/patch-1
    
    Process persistent storage rules for cciss devices


commit ba27fb2111b0b7cb73043ba159456d8933a59f8f
Author: Cédric Delmas <cedricde at users.noreply.github.com>
Date:   Mon Jun 29 09:54:58 2015 +0200

    Process cciss devices
    
    Do not skip the persistent storage rules for cciss devices

diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
index 71b8e46..90b62cc 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -6,7 +6,7 @@
 ACTION=="remove", GOTO="persistent_storage_end"
 
 SUBSYSTEM!="block", GOTO="persistent_storage_end"
-KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*", GOTO="persistent_storage_end"
+KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*", GOTO="persistent_storage_end"
 
 # ignore partitions that span the entire disk
 TEST=="whole_disk", GOTO="persistent_storage_end"

commit a611cd740675c1a1a886cd57617a846dfdd8493c
Merge: eeec69e 843f6bf
Author: Daniel Mack <github at zonque.org>
Date:   Mon Jun 29 05:43:26 2015 +0200

    Merge pull request #402 from systemd-mailing-devs/1435512180-3659-1-git-send-email-ebiggers3 at gmail.com
    
    util: fix incorrect escape sequence in string_is_safe()


commit eeec69e0e01a87379c0a09c925b22900d0ef2d3c
Merge: e88113b ae87a4a
Author: Daniel Mack <github at zonque.org>
Date:   Mon Jun 29 05:03:38 2015 +0200

    Merge pull request #399 from gmacario/fix-issue341-v2
    
    bootchart: reset list_sample_data head before generating SVG


commit e88113bd442a76524b529d558be7acefba394678
Merge: 281d4a7 341db20
Author: Tom Gundersen <teg at jklm.no>
Date:   Sun Jun 28 23:10:46 2015 +0200

    Merge pull request #388 from fsateler/doc-pidfile-removal
    
    systemd.service.xml: document that systemd removes the PIDFile


commit 843f6bf4ef2c27c20f16da8ec0c5d4aaaad919bb
Author: Eric Biggers <ebiggers3 at gmail.com>
Date:   Sun Jun 28 12:23:00 2015 -0500

    util: fix incorrect escape sequence in string_is_safe()

diff --git a/src/basic/util.c b/src/basic/util.c
index 727be56..906e4ab 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -3627,7 +3627,7 @@ bool string_is_safe(const char *p) {
                 if (*t > 0 && *t < ' ')
                         return false;
 
-                if (strchr("\\\"\'\0x7f", *t))
+                if (strchr("\\\"\'\x7f", *t))
                         return false;
         }
 

commit ae87a4a9291e7277b9fe08c97345166118f98623
Author: Gianpaolo Macario <gianpaolo_macario at mentor.com>
Date:   Sat Jun 27 07:17:07 2015 +0000

    bootchart: reset list_sample_data head before generating SVG
    
    Until commit 1f2ecb0 ("bootchart: kill a bunch of global variables")
    variable "head" was declared global and this action was performed by svg_header.
    Now that "head" is local and passed to each function called by svg_do(...)
    move the code at the beginning of svg_do(...) to restore the correct behaviour.

diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index f442200..0ac1f55 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -76,8 +76,6 @@ static void svg_header(FILE *of, struct list_sample_data *head, double graph_sta
 
         assert(head);
 
-        sampledata = head;
-        LIST_FIND_TAIL(link, sampledata, head);
         sampledata_last = head;
         LIST_FOREACH_BEFORE(link, sampledata, head) {
                 sampledata_last = sampledata;
@@ -1296,6 +1294,8 @@ int svg_do(FILE *of,
         double offset = 7;
         int r, c;
 
+        sampledata = head;
+        LIST_FIND_TAIL(link, sampledata, head);
         ps = ps_first;
 
         /* count initcall thread count first */

commit 8c2a0730f4ac59590072436c497a48d7fffdfcad
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Jun 26 12:02:53 2015 +0200

    sd-netlink: message - remove unused next_rta_offset field
    
    This was a left-over from before we supported containers.

diff --git a/src/libsystemd/sd-netlink/netlink-internal.h b/src/libsystemd/sd-netlink/netlink-internal.h
index 5773f61..b8a3668 100644
--- a/src/libsystemd/sd-netlink/netlink-internal.h
+++ b/src/libsystemd/sd-netlink/netlink-internal.h
@@ -111,7 +111,6 @@ struct sd_netlink_message {
         struct nlmsghdr *hdr;
         struct netlink_container containers[RTNL_CONTAINER_DEPTH];
         unsigned n_containers; /* number of containers */
-        size_t next_rta_offset; /* offset from hdr to next rta */
         bool sealed:1;
         bool broadcast:1;
 

commit f663aeb80be485817c9d9071b49c64122fb11f19
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Jun 26 00:02:55 2015 +0200

    netlink: rework containers
    
    Instead of representing containers as several arrays, make a new
    netlink_container struct and keep one array of these structs. We
    also introduce netlink_attribute structs that in the future will
    hold meta-information about each atribute.

diff --git a/src/libsystemd/sd-netlink/netlink-internal.h b/src/libsystemd/sd-netlink/netlink-internal.h
index 31bc1d3..5773f61 100644
--- a/src/libsystemd/sd-netlink/netlink-internal.h
+++ b/src/libsystemd/sd-netlink/netlink-internal.h
@@ -92,18 +92,26 @@ struct sd_netlink {
         sd_event *event;
 };
 
+struct netlink_attribute {
+        size_t offset; /* offset from hdr to attirubte */
+};
+
+struct netlink_container {
+        const struct NLTypeSystem *type_system; /* the type system of the container */
+        size_t offset; /* offset from hdr to the start of the container */
+        struct netlink_attribute *attributes;
+        unsigned short n_attributes; /* number of attributes in container */
+};
+
 struct sd_netlink_message {
         RefCount n_ref;
 
         sd_netlink *rtnl;
 
         struct nlmsghdr *hdr;
-        const struct NLTypeSystem *(container_type_system[RTNL_CONTAINER_DEPTH]); /* the type of the container and all its parents */
-        size_t container_offsets[RTNL_CONTAINER_DEPTH]; /* offset from hdr to each container's start */
+        struct netlink_container containers[RTNL_CONTAINER_DEPTH];
         unsigned n_containers; /* number of containers */
         size_t next_rta_offset; /* offset from hdr to next rta */
-        size_t *rta_offset_tb[RTNL_CONTAINER_DEPTH];
-        unsigned short rta_tb_size[RTNL_CONTAINER_DEPTH];
         bool sealed:1;
         bool broadcast:1;
 
diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c
index 23f369c..13573dc 100644
--- a/src/libsystemd/sd-netlink/netlink-message.c
+++ b/src/libsystemd/sd-netlink/netlink-message.c
@@ -34,7 +34,7 @@
 #include "netlink-internal.h"
 #include "netlink-types.h"
 
-#define GET_CONTAINER(m, i) ((i) < (m)->n_containers ? (struct rtattr*)((uint8_t*)(m)->hdr + (m)->container_offsets[i]) : NULL)
+#define GET_CONTAINER(m, i) ((i) < (m)->n_containers ? (struct rtattr*)((uint8_t*)(m)->hdr + (m)->containers[i].offset) : NULL)
 #define PUSH_CONTAINER(m, new) (m)->container_offsets[(m)->n_containers ++] = (uint8_t*)(new) - (uint8_t*)(m)->hdr;
 
 #define RTA_TYPE(rta) ((rta)->rta_type & NLA_TYPE_MASK)
@@ -88,7 +88,7 @@ int message_new(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t type) {
 
         m->hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
 
-        type_get_type_system(nl_type, &m->container_type_system[0]);
+        type_get_type_system(nl_type, &m->containers[0].type_system);
         m->hdr->nlmsg_len = size;
         m->hdr->nlmsg_type = type;
 
@@ -129,7 +129,7 @@ sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m) {
                 free(m->hdr);
 
                 for (i = 0; i <= m->n_containers; i++)
-                        free(m->rta_offset_tb[i]);
+                        free(m->containers[i].attributes);
 
                 sd_netlink_message_unref(m->next);
 
@@ -223,7 +223,7 @@ static int message_attribute_has_type(sd_netlink_message *m, size_t *out_size, u
 
         assert(m);
 
-        r = type_system_get_type(m->container_type_system[m->n_containers], &type, attribute_type);
+        r = type_system_get_type(m->containers[m->n_containers].type_system, &type, attribute_type);
         if (r < 0)
                 return r;
 
@@ -406,18 +406,18 @@ int sd_netlink_message_open_container(sd_netlink_message *m, unsigned short type
                 if (r < 0)
                         return r;
 
-                r = type_system_get_type_system_union(m->container_type_system[m->n_containers], &type_system_union, type);
+                r = type_system_get_type_system_union(m->containers[m->n_containers].type_system, &type_system_union, type);
                 if (r < 0)
                         return r;
 
                 r = type_system_union_protocol_get_type_system(type_system_union,
-                                                               &m->container_type_system[m->n_containers + 1],
+                                                               &m->containers[m->n_containers + 1].type_system,
                                                                family);
                 if (r < 0)
                         return r;
         } else {
-                r = type_system_get_type_system(m->container_type_system[m->n_containers],
-                                                &m->container_type_system[m->n_containers + 1],
+                r = type_system_get_type_system(m->containers[m->n_containers].type_system,
+                                                &m->containers[m->n_containers + 1].type_system,
                                                 type);
                 if (r < 0)
                         return r;
@@ -427,7 +427,7 @@ int sd_netlink_message_open_container(sd_netlink_message *m, unsigned short type
         if (r < 0)
                 return r;
 
-        m->container_offsets[m->n_containers ++] = r;
+        m->containers[m->n_containers ++].offset = r;
 
         return 0;
 }
@@ -439,12 +439,12 @@ int sd_netlink_message_open_container_union(sd_netlink_message *m, unsigned shor
         assert_return(m, -EINVAL);
         assert_return(!m->sealed, -EPERM);
 
-        r = type_system_get_type_system_union(m->container_type_system[m->n_containers], &type_system_union, type);
+        r = type_system_get_type_system_union(m->containers[m->n_containers].type_system, &type_system_union, type);
         if (r < 0)
                 return r;
 
         r = type_system_union_get_type_system(type_system_union,
-                                              &m->container_type_system[m->n_containers + 1],
+                                              &m->containers[m->n_containers + 1].type_system,
                                               key);
         if (r < 0)
                 return r;
@@ -458,7 +458,7 @@ int sd_netlink_message_open_container_union(sd_netlink_message *m, unsigned shor
         if (r < 0)
                 return r;
 
-        m->container_offsets[m->n_containers ++] = r;
+        m->containers[m->n_containers ++].offset = r;
 
         return 0;
 }
@@ -469,26 +469,29 @@ int sd_netlink_message_close_container(sd_netlink_message *m) {
         assert_return(!m->sealed, -EPERM);
         assert_return(m->n_containers > 0, -EINVAL);
 
-        m->container_type_system[m->n_containers] = NULL;
+        m->containers[m->n_containers].type_system = NULL;
         m->n_containers --;
 
         return 0;
 }
 
 static int netlink_message_read_internal(sd_netlink_message *m, unsigned short type, void **data) {
+        struct netlink_attribute *attribute;
         struct rtattr *rta;
 
         assert_return(m, -EINVAL);
         assert_return(m->sealed, -EPERM);
         assert_return(data, -EINVAL);
         assert(m->n_containers <= RTNL_CONTAINER_DEPTH);
-        assert(m->rta_offset_tb[m->n_containers]);
-        assert(type < m->rta_tb_size[m->n_containers]);
+        assert(m->containers[m->n_containers].attributes);
+        assert(type < m->containers[m->n_containers].n_attributes);
 
-        if(!m->rta_offset_tb[m->n_containers][type])
+        attribute = &m->containers[m->n_containers].attributes[type];
+
+        if(!attribute->offset)
                 return -ENODATA;
 
-        rta = (struct rtattr*)((uint8_t *) m->hdr + m->rta_offset_tb[m->n_containers][type]);
+        rta = (struct rtattr*)((uint8_t *) m->hdr + attribute->offset);
 
         *data = RTA_DATA(rta);
 
@@ -671,37 +674,36 @@ int sd_netlink_message_read_in6_addr(sd_netlink_message *m, unsigned short type,
         return 0;
 }
 
-static int netlink_message_parse(sd_netlink_message *m,
-                       size_t **rta_offset_tb,
-                       unsigned short *rta_tb_size,
-                       int count,
-                       struct rtattr *rta,
-                       unsigned int rt_len) {
-        unsigned short type;
-        size_t *tb;
+static int netlink_container_parse(sd_netlink_message *m,
+                                   struct netlink_container *container,
+                                   int count,
+                                   struct rtattr *rta,
+                                   unsigned int rt_len) {
+        _cleanup_free_ struct netlink_attribute *attributes = NULL;
 
-        tb = new0(size_t, count);
-        if(!tb)
+        attributes = new0(struct netlink_attribute, count);
+        if(!attributes)
                 return -ENOMEM;
 
-        *rta_tb_size = count;
-
         for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {
+                unsigned short type;
+
                 type = RTA_TYPE(rta);
 
                 /* if the kernel is newer than the headers we used
-                   when building, we ignore out-of-range attributes
-                 */
+                   when building, we ignore out-of-range attributes */
                 if (type >= count)
                         continue;
 
-                if (tb[type])
+                if (attributes[type].offset)
                         log_debug("rtnl: message parse - overwriting repeated attribute");
 
-                tb[type] = (uint8_t *) rta - (uint8_t *) m->hdr;
+                attributes[type].offset = (uint8_t *) rta - (uint8_t *) m->hdr;
         }
 
-        *rta_offset_tb = tb;
+        container->attributes = attributes;
+        attributes = NULL;
+        container->n_attributes = count;
 
         return 0;
 }
@@ -717,7 +719,7 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
         assert_return(m, -EINVAL);
         assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -EINVAL);
 
-        r = type_system_get_type(m->container_type_system[m->n_containers],
+        r = type_system_get_type(m->containers[m->n_containers].type_system,
                                  &nl_type,
                                  type_id);
         if (r < 0)
@@ -726,7 +728,7 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
         type = type_get_type(nl_type);
 
         if (type == NETLINK_TYPE_NESTED) {
-                r = type_system_get_type_system(m->container_type_system[m->n_containers],
+                r = type_system_get_type_system(m->containers[m->n_containers].type_system,
                                                 &type_system,
                                                 type_id);
                 if (r < 0)
@@ -734,7 +736,7 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
         } else if (type == NETLINK_TYPE_UNION) {
                 const NLTypeSystemUnion *type_system_union;
 
-                r = type_system_get_type_system_union(m->container_type_system[m->n_containers],
+                r = type_system_get_type_system_union(m->containers[m->n_containers].type_system,
                                                       &type_system_union,
                                                       type_id);
                 if (r < 0)
@@ -787,18 +789,17 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
 
         m->n_containers ++;
 
-        r = netlink_message_parse(m,
-                                  &m->rta_offset_tb[m->n_containers],
-                                  &m->rta_tb_size[m->n_containers],
-                                  type_system_get_count(type_system),
-                                  container,
-                                  size);
+        r = netlink_container_parse(m,
+                                    &m->containers[m->n_containers],
+                                    type_system_get_count(type_system),
+                                    container,
+                                    size);
         if (r < 0) {
                 m->n_containers --;
                 return r;
         }
 
-        m->container_type_system[m->n_containers] = type_system;
+        m->containers[m->n_containers].type_system = type_system;
 
         return 0;
 }
@@ -808,9 +809,9 @@ int sd_netlink_message_exit_container(sd_netlink_message *m) {
         assert_return(m->sealed, -EINVAL);
         assert_return(m->n_containers > 0, -EINVAL);
 
-        free(m->rta_offset_tb[m->n_containers]);
-        m->rta_offset_tb[m->n_containers] = NULL;
-        m->container_type_system[m->n_containers] = NULL;
+        free(m->containers[m->n_containers].attributes);
+        m->containers[m->n_containers].attributes = NULL;
+        m->containers[m->n_containers].type_system = NULL;
 
         m->n_containers --;
 
@@ -859,15 +860,13 @@ int sd_netlink_message_rewind(sd_netlink_message *m) {
                 rtnl_message_seal(m);
 
         for (i = 1; i <= m->n_containers; i++) {
-                free(m->rta_offset_tb[i]);
-                m->rta_offset_tb[i] = NULL;
-                m->rta_tb_size[i] = 0;
-                m->container_type_system[i] = NULL;
+                free(m->containers[i].attributes);
+                m->containers[i].attributes = NULL;
         }
 
         m->n_containers = 0;
 
-        if (m->rta_offset_tb[0]) {
+        if (m->containers[0].attributes) {
                 /* top-level attributes have already been parsed */
                 return 0;
         }
@@ -886,14 +885,13 @@ int sd_netlink_message_rewind(sd_netlink_message *m) {
 
                 type_get_type_system(nl_type, &type_system);
 
-                m->container_type_system[0] = type_system;
+                m->containers[0].type_system = type_system;
 
-                r = netlink_message_parse(m,
-                                          &m->rta_offset_tb[m->n_containers],
-                                          &m->rta_tb_size[m->n_containers],
-                                          type_system_get_count(type_system),
-                                          (struct rtattr*)((uint8_t*)NLMSG_DATA(m->hdr) + NLMSG_ALIGN(size)),
-                                          NLMSG_PAYLOAD(m->hdr, size));
+                r = netlink_container_parse(m,
+                                            &m->containers[m->n_containers],
+                                            type_system_get_count(type_system),
+                                            (struct rtattr*)((uint8_t*)NLMSG_DATA(m->hdr) + NLMSG_ALIGN(size)),
+                                            NLMSG_PAYLOAD(m->hdr, size));
                 if (r < 0)
                         return r;
         }

commit 4203fc8b818e68113aed2f3dc0e47a00f4059a30
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Jun 26 00:07:25 2015 +0200

    sd-netlink: make a couple of helper functions static
    
    Also rename from rtnl_* to netlink_*.

diff --git a/src/libsystemd/sd-netlink/netlink-internal.h b/src/libsystemd/sd-netlink/netlink-internal.h
index 7290f4e..31bc1d3 100644
--- a/src/libsystemd/sd-netlink/netlink-internal.h
+++ b/src/libsystemd/sd-netlink/netlink-internal.h
@@ -122,14 +122,6 @@ int socket_read_message(sd_netlink *nl);
 int rtnl_rqueue_make_room(sd_netlink *rtnl);
 int rtnl_rqueue_partial_make_room(sd_netlink *rtnl);
 
-int rtnl_message_read_internal(sd_netlink_message *m, unsigned short type, void **data);
-int rtnl_message_parse(sd_netlink_message *m,
-                       size_t **rta_offset_tb,
-                       unsigned short *rta_tb_size,
-                       int max,
-                       struct rtattr *rta,
-                       unsigned int rt_len);
-
 /* Make sure callbacks don't destroy the rtnl connection */
 #define RTNL_DONT_DESTROY(rtnl) \
         _cleanup_netlink_unref_ _unused_ sd_netlink *_dont_destroy_##rtnl = sd_netlink_ref(rtnl)
diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c
index 6b6843e..23f369c 100644
--- a/src/libsystemd/sd-netlink/netlink-message.c
+++ b/src/libsystemd/sd-netlink/netlink-message.c
@@ -475,7 +475,7 @@ int sd_netlink_message_close_container(sd_netlink_message *m) {
         return 0;
 }
 
-int rtnl_message_read_internal(sd_netlink_message *m, unsigned short type, void **data) {
+static int netlink_message_read_internal(sd_netlink_message *m, unsigned short type, void **data) {
         struct rtattr *rta;
 
         assert_return(m, -EINVAL);
@@ -505,7 +505,7 @@ int sd_netlink_message_read_string(sd_netlink_message *m, unsigned short type, c
         if (r < 0)
                 return r;
 
-        r = rtnl_message_read_internal(m, type, &attr_data);
+        r = netlink_message_read_internal(m, type, &attr_data);
         if (r < 0)
                 return r;
         else if (strnlen(attr_data, r) >= (size_t) r)
@@ -527,7 +527,7 @@ int sd_netlink_message_read_u8(sd_netlink_message *m, unsigned short type, uint8
         if (r < 0)
                 return r;
 
-        r = rtnl_message_read_internal(m, type, &attr_data);
+        r = netlink_message_read_internal(m, type, &attr_data);
         if (r < 0)
                 return r;
         else if ((size_t) r < sizeof(uint8_t))
@@ -549,7 +549,7 @@ int sd_netlink_message_read_u16(sd_netlink_message *m, unsigned short type, uint
         if (r < 0)
                 return r;
 
-        r = rtnl_message_read_internal(m, type, &attr_data);
+        r = netlink_message_read_internal(m, type, &attr_data);
         if (r < 0)
                 return r;
         else if ((size_t) r < sizeof(uint16_t))
@@ -571,7 +571,7 @@ int sd_netlink_message_read_u32(sd_netlink_message *m, unsigned short type, uint
         if (r < 0)
                 return r;
 
-        r = rtnl_message_read_internal(m, type, &attr_data);
+        r = netlink_message_read_internal(m, type, &attr_data);
         if (r < 0)
                 return r;
         else if ((size_t)r < sizeof(uint32_t))
@@ -593,7 +593,7 @@ int sd_netlink_message_read_ether_addr(sd_netlink_message *m, unsigned short typ
         if (r < 0)
                 return r;
 
-        r = rtnl_message_read_internal(m, type, &attr_data);
+        r = netlink_message_read_internal(m, type, &attr_data);
         if (r < 0)
                 return r;
         else if ((size_t)r < sizeof(struct ether_addr))
@@ -615,7 +615,7 @@ int sd_netlink_message_read_cache_info(sd_netlink_message *m, unsigned short typ
         if (r < 0)
                 return r;
 
-        r = rtnl_message_read_internal(m, type, &attr_data);
+        r = netlink_message_read_internal(m, type, &attr_data);
         if (r < 0)
                 return r;
         else if ((size_t)r < sizeof(struct ifa_cacheinfo))
@@ -637,7 +637,7 @@ int sd_netlink_message_read_in_addr(sd_netlink_message *m, unsigned short type,
         if (r < 0)
                 return r;
 
-        r = rtnl_message_read_internal(m, type, &attr_data);
+        r = netlink_message_read_internal(m, type, &attr_data);
         if (r < 0)
                 return r;
         else if ((size_t)r < sizeof(struct in_addr))
@@ -659,7 +659,7 @@ int sd_netlink_message_read_in6_addr(sd_netlink_message *m, unsigned short type,
         if (r < 0)
                 return r;
 
-        r = rtnl_message_read_internal(m, type, &attr_data);
+        r = netlink_message_read_internal(m, type, &attr_data);
         if (r < 0)
                 return r;
         else if ((size_t)r < sizeof(struct in6_addr))
@@ -671,6 +671,41 @@ int sd_netlink_message_read_in6_addr(sd_netlink_message *m, unsigned short type,
         return 0;
 }
 
+static int netlink_message_parse(sd_netlink_message *m,
+                       size_t **rta_offset_tb,
+                       unsigned short *rta_tb_size,
+                       int count,
+                       struct rtattr *rta,
+                       unsigned int rt_len) {
+        unsigned short type;
+        size_t *tb;
+
+        tb = new0(size_t, count);
+        if(!tb)
+                return -ENOMEM;
+
+        *rta_tb_size = count;
+
+        for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {
+                type = RTA_TYPE(rta);
+
+                /* if the kernel is newer than the headers we used
+                   when building, we ignore out-of-range attributes
+                 */
+                if (type >= count)
+                        continue;
+
+                if (tb[type])
+                        log_debug("rtnl: message parse - overwriting repeated attribute");
+
+                tb[type] = (uint8_t *) rta - (uint8_t *) m->hdr;
+        }
+
+        *rta_offset_tb = tb;
+
+        return 0;
+}
+
 int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short type_id) {
         const NLType *nl_type;
         const NLTypeSystem *type_system;
@@ -744,7 +779,7 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
         } else
                 return -EINVAL;
 
-        r = rtnl_message_read_internal(m, type_id, &container);
+        r = netlink_message_read_internal(m, type_id, &container);
         if (r < 0)
                 return r;
         else
@@ -752,12 +787,12 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
 
         m->n_containers ++;
 
-        r = rtnl_message_parse(m,
-                               &m->rta_offset_tb[m->n_containers],
-                               &m->rta_tb_size[m->n_containers],
-                               type_system_get_count(type_system),
-                               container,
-                               size);
+        r = netlink_message_parse(m,
+                                  &m->rta_offset_tb[m->n_containers],
+                                  &m->rta_tb_size[m->n_containers],
+                                  type_system_get_count(type_system),
+                                  container,
+                                  size);
         if (r < 0) {
                 m->n_containers --;
                 return r;
@@ -810,41 +845,6 @@ int sd_netlink_message_get_errno(sd_netlink_message *m) {
         return err->error;
 }
 
-int rtnl_message_parse(sd_netlink_message *m,
-                       size_t **rta_offset_tb,
-                       unsigned short *rta_tb_size,
-                       int count,
-                       struct rtattr *rta,
-                       unsigned int rt_len) {
-        unsigned short type;
-        size_t *tb;
-
-        tb = new0(size_t, count);
-        if(!tb)
-                return -ENOMEM;
-
-        *rta_tb_size = count;
-
-        for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {
-                type = RTA_TYPE(rta);
-
-                /* if the kernel is newer than the headers we used
-                   when building, we ignore out-of-range attributes
-                 */
-                if (type >= count)
-                        continue;
-
-                if (tb[type])
-                        log_debug("rtnl: message parse - overwriting repeated attribute");
-
-                tb[type] = (uint8_t *) rta - (uint8_t *) m->hdr;
-        }
-
-        *rta_offset_tb = tb;
-
-        return 0;
-}
-
 int sd_netlink_message_rewind(sd_netlink_message *m) {
         const NLType *nl_type;
         uint16_t type;
@@ -888,12 +888,12 @@ int sd_netlink_message_rewind(sd_netlink_message *m) {
 
                 m->container_type_system[0] = type_system;
 
-                r = rtnl_message_parse(m,
-                                       &m->rta_offset_tb[m->n_containers],
-                                       &m->rta_tb_size[m->n_containers],
-                                       type_system_get_count(type_system),
-                                       (struct rtattr*)((uint8_t*)NLMSG_DATA(m->hdr) + NLMSG_ALIGN(size)),
-                                       NLMSG_PAYLOAD(m->hdr, size));
+                r = netlink_message_parse(m,
+                                          &m->rta_offset_tb[m->n_containers],
+                                          &m->rta_tb_size[m->n_containers],
+                                          type_system_get_count(type_system),
+                                          (struct rtattr*)((uint8_t*)NLMSG_DATA(m->hdr) + NLMSG_ALIGN(size)),
+                                          NLMSG_PAYLOAD(m->hdr, size));
                 if (r < 0)
                         return r;
         }

commit da041d69d17cbbcb6f894d58700c01ae847dea18
Author: Tom Gundersen <teg at jklm.no>
Date:   Tue Jun 23 13:18:18 2015 +0200

    sd-netlink: mark union containers as nested
    
    This was an oversight, they are no different from regular containers in this respect.

diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c
index a935b82..6b6843e 100644
--- a/src/libsystemd/sd-netlink/netlink-message.c
+++ b/src/libsystemd/sd-netlink/netlink-message.c
@@ -454,7 +454,7 @@ int sd_netlink_message_open_container_union(sd_netlink_message *m, unsigned shor
                 return r;
 
         /* do we evere need non-null size */
-        r = add_rtattr(m, type, NULL, 0);
+        r = add_rtattr(m, type | NLA_F_NESTED, NULL, 0);
         if (r < 0)
                 return r;
 

commit 341db20b7e98199003b4ce6aa52b339757828204
Author: Felipe Sateler <fsateler at debian.org>
Date:   Sat Jun 27 17:25:06 2015 -0300

    systemd.service.xml: document that systemd removes the PIDFile

diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 1e949f0..4368ca8 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -226,7 +226,10 @@
         services where <varname>Type=</varname> is set to
         <option>forking</option>. systemd will read the PID of the
         main process of the daemon after start-up of the service.
-        systemd will not write to the file configured here.</para>
+        systemd will not write to the file configured here, although
+        it will remove the file after the service has shut down if it
+        still exists.
+        </para>
         </listitem>
       </varlistentry>
 

commit 0051ebf7e59258e3bd3e21765bbfad355806664e
Author: Bastien Nocera <hadess at hadess.net>
Date:   Sat Jun 27 21:48:52 2015 +0200

    udev: Remove accelerometer helper
    
    It's moved to the iio-sensor-proxy D-Bus service.

diff --git a/.gitignore b/.gitignore
index 1e704a8..99f361d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,7 +26,6 @@
 /GRTAGS
 /GSYMS
 /GTAGS
-/accelerometer
 /ata_id
 /bootctl
 /build-aux
diff --git a/Makefile.am b/Makefile.am
index 810a147..7ac3c1d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3801,19 +3801,6 @@ dist_udevrules_DATA += \
 	rules/60-persistent-v4l.rules
 
 # ------------------------------------------------------------------------------
-accelerometer_SOURCES = \
-	src/udev/accelerometer/accelerometer.c
-
-accelerometer_LDADD = \
-	libshared.la
-
-udevlibexec_PROGRAMS += \
-	accelerometer
-
-dist_udevrules_DATA += \
-	rules/61-accelerometer.rules
-
-# ------------------------------------------------------------------------------
 mtd_probe_SOURCES =  \
 	src/udev/mtd_probe/mtd_probe.c \
 	src/udev/mtd_probe/mtd_probe.h \
diff --git a/rules/61-accelerometer.rules b/rules/61-accelerometer.rules
deleted file mode 100644
index a6a2bfd..0000000
--- a/rules/61-accelerometer.rules
+++ /dev/null
@@ -1,3 +0,0 @@
-# do not edit this file, it will be overwritten on update
-
-SUBSYSTEM=="input", ACTION!="remove", ENV{ID_INPUT_ACCELEROMETER}=="1", IMPORT{program}="accelerometer %p"
diff --git a/src/udev/accelerometer/Makefile b/src/udev/accelerometer/Makefile
deleted file mode 120000
index d0b0e8e..0000000
--- a/src/udev/accelerometer/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-../Makefile
\ No newline at end of file
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c
deleted file mode 100644
index 9e2c590..0000000
--- a/src/udev/accelerometer/accelerometer.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * accelerometer - exports device orientation through property
- *
- * When an "change" event is received on an accelerometer,
- * open its device node, and from the value, as well as the previous
- * value of the property, calculate the device's new orientation,
- * and export it as ID_INPUT_ACCELEROMETER_ORIENTATION.
- *
- * Possible values are:
- * undefined
- * * normal
- * * bottom-up
- * * left-up
- * * right-up
- *
- * The property will be persistent across sessions, and the new
- * orientations can be deducted from the previous one (it allows
- * for a threshold for switching between opposite ends of the
- * orientation).
- *
- * Copyright (C) 2011 Red Hat, Inc.
- * Author:
- *   Bastien Nocera <hadess at hadess.net>
- *
- * orientation_calc() from the sensorfw package
- * Copyright (C) 2009-2010 Nokia Corporation
- * Authors:
- *   Üstün Ergenoglu <ext-ustun.ergenoglu at nokia.com>
- *   Timo Rongas <ext-timo.2.rongas at nokia.com>
- *   Lihan Guo <lihan.guo at digia.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <limits.h>
-#include <linux/input.h>
-
-#include "libudev.h"
-#include "libudev-private.h"
-
-/* we must use this kernel-compatible implementation */
-#define BITS_PER_LONG (sizeof(unsigned long) * 8)
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define OFF(x)  ((x)%BITS_PER_LONG)
-#define BIT(x)  (1UL<<OFF(x))
-#define LONG(x) ((x)/BITS_PER_LONG)
-#define test_bit(bit, array)    ((array[LONG(bit)] >> OFF(bit)) & 1)
-
-typedef enum {
-        ORIENTATION_UNDEFINED,
-        ORIENTATION_NORMAL,
-        ORIENTATION_BOTTOM_UP,
-        ORIENTATION_LEFT_UP,
-        ORIENTATION_RIGHT_UP
-} OrientationUp;
-
-static const char *orientations[] = {
-        "undefined",
-        "normal",
-        "bottom-up",
-        "left-up",
-        "right-up",
-        NULL
-};
-
-#define ORIENTATION_UP_UP ORIENTATION_NORMAL
-
-#define DEFAULT_THRESHOLD 250
-#define RADIANS_TO_DEGREES 180.0/M_PI
-#define SAME_AXIS_LIMIT 5
-
-#define THRESHOLD_LANDSCAPE  25
-#define THRESHOLD_PORTRAIT  20
-
-static const char *
-orientation_to_string (OrientationUp o)
-{
-        return orientations[o];
-}
-
-static OrientationUp
-string_to_orientation (const char *orientation)
-{
-        int i;
-
-        if (orientation == NULL)
-                return ORIENTATION_UNDEFINED;
-        for (i = 0; orientations[i] != NULL; i++) {
-                if (streq (orientation, orientations[i]))
-                        return i;
-        }
-        return ORIENTATION_UNDEFINED;
-}
-
-static OrientationUp
-orientation_calc (OrientationUp prev,
-                  int x, int y, int z)
-{
-        int rotation;
-        OrientationUp ret = prev;
-
-        /* Portrait check */
-        rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES);
-
-        if (abs(rotation) > THRESHOLD_PORTRAIT) {
-                ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP;
-
-                /* Some threshold to switching between portrait modes */
-                if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) {
-                        if (abs(rotation) < SAME_AXIS_LIMIT) {
-                                ret = prev;
-                        }
-                }
-
-        } else {
-                /* Landscape check */
-                rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES);
-
-                if (abs(rotation) > THRESHOLD_LANDSCAPE) {
-                        ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL;
-
-                        /* Some threshold to switching between landscape modes */
-                        if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) {
-                                if (abs(rotation) < SAME_AXIS_LIMIT) {
-                                        ret = prev;
-                                }
-                        }
-                }
-        }
-
-        return ret;
-}
-
-static OrientationUp
-get_prev_orientation(struct udev_device *dev)
-{
-        const char *value;
-
-        value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION");
-        if (value == NULL)
-                return ORIENTATION_UNDEFINED;
-        return string_to_orientation(value);
-}
-
-#define READ_AXIS(axis, var) { memzero(&abs_info, sizeof(abs_info)); r = ioctl(fd, EVIOCGABS(axis), &abs_info); if (r < 0) return; var = abs_info.value; }
-
-/* accelerometers */
-static void test_orientation(struct udev *udev,
-                             struct udev_device *dev,
-                             const char *devpath)
-{
-        OrientationUp old, new;
-        _cleanup_close_ int fd = -1;
-        struct input_absinfo abs_info;
-        int x = 0, y = 0, z = 0;
-        int r;
-        char text[64];
-
-        old = get_prev_orientation(dev);
-
-        fd = open(devpath, O_RDONLY|O_CLOEXEC);
-        if (fd < 0)
-                return;
-
-        READ_AXIS(ABS_X, x);
-        READ_AXIS(ABS_Y, y);
-        READ_AXIS(ABS_Z, z);
-
-        new = orientation_calc(old, x, y, z);
-        snprintf(text, sizeof(text),
-                 "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new));
-        puts(text);
-}
-
-static void help(void) {
-
-        printf("%s [options] <device path>\n\n"
-               "Accelerometer device identification.\n\n"
-               "  -h --help  Print this message\n"
-               "  -d --debug Debug to stderr\n"
-               , program_invocation_short_name);
-}
-
-int main (int argc, char** argv)
-{
-        struct udev *udev;
-        struct udev_device *dev;
-
-        static const struct option options[] = {
-                { "debug", no_argument, NULL, 'd' },
-                { "help", no_argument, NULL, 'h' },
-                {}
-        };
-
-        char devpath[PATH_MAX];
-        char *devnode;
-        struct udev_enumerate *enumerate;
-        struct udev_list_entry *list_entry;
-
-        log_parse_environment();
-        log_open();
-
-        udev = udev_new();
-        if (udev == NULL)
-                return 1;
-
-        /* CLI argument parsing */
-        while (1) {
-                int option;
-
-                option = getopt_long(argc, argv, "dh", options, NULL);
-                if (option == -1)
-                        break;
-
-                switch (option) {
-                case 'd':
-                        log_set_target(LOG_TARGET_CONSOLE);
-                        log_set_max_level(LOG_DEBUG);
-                        log_open();
-                        break;
-                case 'h':
-                        help();
-                        exit(0);
-                default:
-                        exit(1);
-                }
-        }
-
-        if (argv[optind] == NULL) {
-                help();
-                exit(1);
-        }
-
-        /* get the device */
-        snprintf(devpath, sizeof(devpath), "/sys/%s", argv[optind]);
-        dev = udev_device_new_from_syspath(udev, devpath);
-        if (dev == NULL) {
-                fprintf(stderr, "unable to access '%s'\n", devpath);
-                return 1;
-        }
-
-        /* Get the children devices and find the devnode */
-        devnode = NULL;
-        enumerate = udev_enumerate_new(udev);
-        udev_enumerate_add_match_parent(enumerate, dev);
-        udev_enumerate_scan_devices(enumerate);
-        udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) {
-                struct udev_device *device;
-                const char *node;
-
-                device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate),
-                                                      udev_list_entry_get_name(list_entry));
-                if (device == NULL)
-                        continue;
-                /* Already found it */
-                if (devnode != NULL) {
-                        udev_device_unref(device);
-                        continue;
-                }
-
-                node = udev_device_get_devnode(device);
-                if (node == NULL) {
-                        udev_device_unref(device);
-                        continue;
-                }
-                /* Use the event sub-device */
-                if (strstr(node, "/event") == NULL) {
-                        udev_device_unref(device);
-                        continue;
-                }
-
-                devnode = strdup(node);
-                udev_device_unref(device);
-        }
-
-        if (devnode == NULL) {
-                fprintf(stderr, "unable to get device node for '%s'\n", devpath);
-                return 0;
-        }
-
-        log_debug("opening accelerometer device %s", devnode);
-        test_orientation(udev, dev, devnode);
-        free(devnode);
-        log_close();
-        return 0;
-}

commit 281d4a7710b861559f11023657e661511d524ba0
Merge: 57a2bf2 418b22b
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Jun 26 21:41:44 2015 +0200

    Merge pull request #377 from zonque/logind
    
    logind: fix delayed execution regression


commit 57a2bf232946ece2a59e4994440558b980017156
Merge: 13b7079 e2452ee
Author: Greg Kroah-Hartman <greg at kroah.com>
Date:   Fri Jun 26 09:51:11 2015 -0700

    Merge pull request #353 from kaysievers/hid
    
    rules: remove all power management from udev


commit 13b7079289378795792f1f746e68935c5af4ac8a
Merge: 906fa49 0530459
Author: Kay Sievers <kay at vrfy.org>
Date:   Fri Jun 26 11:33:04 2015 +0200

    Merge pull request #379 from whot/hwdb-updates
    
    Revert "hwdb: add a touchpad hwdb"


commit 05304592457e01e684042067edd52897afda5135
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jun 26 16:09:48 2015 +1000

    Revert "hwdb: add a touchpad hwdb"
    
    The main purpose of this hwdb was to tag touchpads that have the physical
    trackstick buttons wired to the touchpad (Lenovo Carbon X1 3rd, Lenovo *50
    series).  This hwdb is not required on kernels 4.0 and above, the kernel now
    re-routes button presses through the trackstick's device node. Userspace does
    not need to do anything.
    
    See kernel commit cdd9dc195916ef5644cfac079094c3c1d1616e4c.
    
    This reverts commit 001a247324b44c0e0b8fdba41a6fc66e7465b8b6.

diff --git a/Makefile.am b/Makefile.am
index d6e0b4c..46f0da7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3498,7 +3498,6 @@ dist_udevrules_DATA += \
 	rules/60-serial.rules \
 	rules/64-btrfs.rules \
 	rules/70-mouse.rules \
-	rules/70-touchpad.rules \
 	rules/75-net-description.rules \
 	rules/78-sound-card.rules \
 	rules/80-net-setup-link.rules
@@ -3667,8 +3666,7 @@ dist_udevhwdb_DATA = \
 	hwdb/60-evdev.hwdb \
 	hwdb/60-keyboard.hwdb \
 	hwdb/70-mouse.hwdb \
-	hwdb/70-pointingstick.hwdb \
-	hwdb/70-touchpad.hwdb
+	hwdb/70-pointingstick.hwdb
 
 SYSINIT_TARGET_WANTS += \
 	systemd-hwdb-update.service
diff --git a/hwdb/70-touchpad.hwdb b/hwdb/70-touchpad.hwdb
deleted file mode 100644
index 8a32446..0000000
--- a/hwdb/70-touchpad.hwdb
+++ /dev/null
@@ -1,43 +0,0 @@
-# This file is part of systemd.
-#
-# The lookup keys are composed in:
-#   70-touchpad.rules
-#
-# Note: The format of the "touchpad:" prefix match key is a
-# contract between the rules file and the hardware data, it might
-# change in later revisions to support more or better matches, it
-# is not necessarily expected to be a stable ABI.
-#
-# Match string format:
-# touchpad:pnpid:<pnpid>:
-#
-# To add local entries, create a new file
-#   /etc/udev/hwdb.d/71-touchpad-local.hwdb
-# and add your rules there. To load the new rules execute (as root):
-#   udevadm hwdb --update
-#   udevadm trigger /dev/input/eventXX
-# where /dev/input/eventXX is the touchpad in question. If in
-# doubt, simply use /dev/input/event* to reload all input rules.
-#
-# If your changes are generally applicable, open a bug report on
-#   http://bugs.freedesktop.org/enter_bug.cgi?product=systemd
-# and include your new rules, a description of the device, and the
-# output of
-#   udevadm info /dev/input/eventXX
-# (or /dev/input/event*).
-#
-# Allowed properties are:
-#    TOUCHPAD_HAS_TRACKPOINT_BUTTONS=1
-#
-# If the TOUCHPAD_HAS_TRACKPOINT_BUTTONS property is set, this
-# device has # the trackpoint buttons wired up to the touchpad as
-# BTN_0, BTN_1 and BTN_2. This affects the Lenovo X1 Carbon 3rd
-# and the *50 series (T450, T550, etc.)
-
-# Lenovo X1 Carbon 3rd
-touchpad:pnpid:*LEN0048*:
-# Lenovo W541
-touchpad:pnpid:*LEN004a*:
-# Lenovo T450s
-touchpad:pnpid:*LEN200f*:
- TOUCHPAD_HAS_TRACKPOINT_BUTTONS=1
diff --git a/rules/70-touchpad.rules b/rules/70-touchpad.rules
deleted file mode 100644
index 88e6fd2..0000000
--- a/rules/70-touchpad.rules
+++ /dev/null
@@ -1,12 +0,0 @@
-# do not edit this file, it will be overwritten on update
-
-ACTION=="remove", GOTO="touchpad_end"
-KERNEL!="event*", GOTO="touchpad_end"
-ENV{ID_INPUT_TOUCHPAD}=="", GOTO="touchpad_end"
-
-# touchpad:pnpid:<pnpid>:*
-KERNELS=="serio1", \
-    IMPORT{builtin}="hwdb 'touchpad:pnpid:$attr{firmware_id}:'", \
-    GOTO="touchpad_end"
-
-LABEL="touchpad_end"

commit 418b22b88f79911fe5d76fabedd18ef1eb491680
Author: Daniel Mack <daniel at zonque.org>
Date:   Mon Jun 8 22:58:50 2015 +0200

    logind: fix delayed execution regression
    
    Commit c0f32805 ("logind: use sd_event timer source for inhibitor
    logic") reworked the main loop logic of logind so that it uses a
    real timeout callback handler to execute delayed functions.
    
    What the old code did, however, was to call those functions on
    every iteration in the main loop, not only when the timeout
    expired.
    
    Restore that behavior by bringing back manager_dispatch_delayed(),
    and call it from manager_run(). The internal event source callback
    manager_inhibit_timeout_handler() was turned into a wrapper of
    manager_dispatch_delayed() now.

diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 8ebcd3f..640ae92 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1486,18 +1486,13 @@ static int execute_shutdown_or_sleep(
         return 0;
 }
 
-static int manager_inhibit_timeout_handler(
-                        sd_event_source *s,
-                        uint64_t usec,
-                        void *userdata) {
+int manager_dispatch_delayed(Manager *manager, bool timeout) {
 
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
         Inhibitor *offending = NULL;
-        Manager *manager = userdata;
         int r;
 
         assert(manager);
-        assert(manager->inhibit_timeout_source == s);
 
         if (manager->action_what == 0 || manager->action_job)
                 return 0;
@@ -1505,6 +1500,9 @@ static int manager_inhibit_timeout_handler(
         if (manager_is_inhibited(manager, manager->action_what, INHIBIT_DELAY, NULL, false, false, 0, &offending)) {
                 _cleanup_free_ char *comm = NULL, *u = NULL;
 
+                if (!timeout)
+                        return 0;
+
                 (void) get_process_comm(offending->pid, &comm);
                 u = uid_to_name(offending->uid);
 
@@ -1520,9 +1518,25 @@ static int manager_inhibit_timeout_handler(
 
                 manager->action_unit = NULL;
                 manager->action_what = 0;
+                return r;
         }
 
-        return 0;
+        return 1;
+}
+
+static int manager_inhibit_timeout_handler(
+                        sd_event_source *s,
+                        uint64_t usec,
+                        void *userdata) {
+
+        Manager *manager = userdata;
+        int r;
+
+        assert(manager);
+        assert(manager->inhibit_timeout_source == s);
+
+        r = manager_dispatch_delayed(manager, true);
+        return (r < 0) ? r : 0;
 }
 
 static int delay_shutdown_or_sleep(
diff --git a/src/login/logind.c b/src/login/logind.c
index 01f7cd9..e2fb496 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -1109,6 +1109,12 @@ static int manager_run(Manager *m) {
 
                 manager_gc(m, true);
 
+                r = manager_dispatch_delayed(m, false);
+                if (r < 0)
+                        return r;
+                if (r > 0)
+                        continue;
+
                 r = sd_event_run(m->event, (uint64_t) -1);
                 if (r < 0)
                         return r;
diff --git a/src/login/logind.h b/src/login/logind.h
index feb381d..ad437b7 100644
--- a/src/login/logind.h
+++ b/src/login/logind.h
@@ -194,3 +194,5 @@ int manager_get_seat_from_creds(Manager *m, sd_bus_message *message, const char
 
 int manager_setup_wall_message_timer(Manager *m);
 bool logind_wall_tty_filter(const char *tty, void *userdata);
+
+int manager_dispatch_delayed(Manager *manager, bool timeout);

commit 906fa490769c4bdb3be1e90ac7d16f66120608c7
Merge: 9674f04 77cd2c8
Author: Daniel Mack <github at zonque.org>
Date:   Thu Jun 25 16:38:41 2015 +0200

    Merge pull request #367 from msekletar/install-unit-file-list-assert
    
    install: explicitly return 0 on success


commit 9674f042b2bcbdd61d294e40b36d86f2dacd0914
Merge: 9ebdb1e caa4339
Author: Daniel Mack <github at zonque.org>
Date:   Thu Jun 25 16:37:06 2015 +0200

    Merge pull request #366 from gmacario/fix-issue139-v5
    
    bootchart: Account CPU time spent in non-main threads of processes (v5)


commit 77cd2c87a47c49aa9063fbaa4d9077f4a381cab1
Author: Michal Sekletar <msekleta at redhat.com>
Date:   Thu Jun 25 16:06:40 2015 +0200

    install: explicitly return 0 on success
    
    Maybe there is some left-over value stored in r from previous function
    call. Let's make sure we always return consistent error code when we reach end of
    the function body.
    
    Fixes following crash of test-install,
    
    Assertion 'r == 0' failed at src/test/test-install.c:52, function main(). Aborting.
    [1]    11703 abort (core dumped)  ./test-install

diff --git a/src/shared/install.c b/src/shared/install.c
index 559fda2..c37cf19 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -2263,7 +2263,7 @@ int unit_file_get_list(
                 }
         }
 
-        return r;
+        return 0;
 }
 
 static const char* const unit_file_state_table[_UNIT_FILE_STATE_MAX] = {

commit caa4339784fe83d93327fcf8b5e9f0a3ef09a225
Author: Gianpaolo Macario <gmacario at gmail.com>
Date:   Thu Jun 11 10:03:30 2015 +0000

    bootchart: Account CPU time spent in non-main threads of processes (v5)
    
    Fix for issue https://github.com/systemd/systemd/issues/139
    
    - Implement fixes suggested by @teg to -v2
    - Implement fixes suggested by @zonque to -v3 and -v4

diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index f159cba..00439f0 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -115,6 +115,7 @@ int log_sample(DIR *proc,
         struct list_sample_data *sampledata;
         struct ps_sched_struct *ps_prev = NULL;
         int procfd;
+        int taskfd = -1;
 
         sampledata = *ptr;
 
@@ -409,6 +410,63 @@ schedstat_next:
                 ps->total = (ps->last->runtime - ps->first->runtime)
                             / 1000000000.0;
 
+                /* Take into account CPU runtime/waittime spent in non-main threads of the process
+                 * by parsing "/proc/[pid]/task/[tid]/schedstat" for all [tid] != [pid]
+                 * See https://github.com/systemd/systemd/issues/139
+                 */
+
+                /* Browse directory "/proc/[pid]/task" to know the thread ids of process [pid] */
+                snprintf(filename, sizeof(filename), PID_FMT "/task", pid);
+                taskfd = openat(procfd, filename, O_RDONLY|O_DIRECTORY|O_CLOEXEC);
+                if (taskfd >= 0) {
+                        _cleanup_closedir_ DIR *taskdir = NULL;
+
+                        taskdir = fdopendir(taskfd);
+                        if (!taskdir) {
+                                safe_close(taskfd);
+                                return -errno;
+                        }
+                        FOREACH_DIRENT(ent, taskdir, break) {
+                                int r;
+                                int tid = -1;
+                                _cleanup_close_ int tid_schedstat = -1;
+                                long long delta_rt;
+                                long long delta_wt;
+
+                                if ((ent->d_name[0] < '0') || (ent->d_name[0] > '9'))
+                                        continue;
+
+                                /* Skip main thread as it was already accounted */
+                                r = safe_atoi(ent->d_name, &tid);
+                                if (r < 0 || tid == pid)
+                                        continue;
+
+                                /* Parse "/proc/[pid]/task/[tid]/schedstat" */
+                                snprintf(filename, sizeof(filename), PID_FMT "/schedstat", tid);
+                                tid_schedstat = openat(taskfd, filename, O_RDONLY|O_CLOEXEC);
+
+                                if (tid_schedstat == -1)
+                                        continue;
+
+                                s = pread(tid_schedstat, buf, sizeof(buf) - 1, 0);
+                                if (s <= 0)
+                                        continue;
+                                buf[s] = '\0';
+
+                                if (!sscanf(buf, "%s %s %*s", rt, wt))
+                                        continue;
+
+                                r = safe_atolli(rt, &delta_rt);
+                                if (r < 0)
+                                    continue;
+                                r = safe_atolli(rt, &delta_wt);
+                                if (r < 0)
+                                    continue;
+                                ps->sample->runtime  += delta_rt;
+                                ps->sample->waittime += delta_wt;
+                        }
+                }
+
                 if (!arg_pss)
                         goto catch_rename;
 

commit e2452eef02a839e1928f4ffd893c93a460474ab6
Author: Kay Sievers <kay at vrfy.org>
Date:   Wed Jun 24 13:10:07 2015 +0200

    rules: remove all power management from udev
    
    It is not udev's task to apply any of these setting that way, or
    from udev rules files. Things need to be sortet out in the kernel,
    or explicit whitelist can possibly be added to the hardware database.
    Until that is sorted out, and general agreement, udev is not
    willing to maintain any such lists or power management settings
    in general.
    
    "Thanks for digging this out! I thought my Kinesis keyboard got broken
    and ordered a new one, only to find out that the new one doesn't work
    as well. I'm not sure whether we should start collecting a blacklist
    of keyboards which don't work with USB autosuspend, or rather a
    whitelist? Or revert this wholesale?"
    
      https://github.com/systemd/systemd/issues/340

diff --git a/Makefile.am b/Makefile.am
index 0f1028b..5c58e57 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3486,7 +3486,6 @@ dist_network_DATA = \
 	network/80-container-ve.network
 
 dist_udevrules_DATA += \
-	rules/42-usb-hid-pm.rules \
 	rules/50-udev-default.rules \
 	rules/60-block.rules \
 	rules/60-drm.rules \
diff --git a/rules/42-usb-hid-pm.rules b/rules/42-usb-hid-pm.rules
deleted file mode 100644
index 3721219..0000000
--- a/rules/42-usb-hid-pm.rules
+++ /dev/null
@@ -1,36 +0,0 @@
-# do not edit this file, it will be overwritten on update
-#
-# Enable autosuspend for qemu emulated usb hid devices
-
-# Note that there are buggy qemu versions (0.13 & older) which
-# advertise remote wakeup support but don't actually implement
-# it correctly.  This is the reason why we need a match for the
-# serial number here.  Old, broken versions have serial "1".
-# It has been changed to "42" after fixing the bug to indicate
-# remote wakeup is working.
-ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto"
-ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto"
-ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto"
-
-# Dell DRAC 4
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="2500", TEST=="power/control", ATTR{power/control}="auto"
-
-# Dell DRAC 5
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="0000", TEST=="power/control", ATTR{power/control}="auto"
-
-# IBM remote access
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b3", ATTR{idProduct}=="4001", TEST=="power/control", ATTR{power/control}="auto"
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b3", ATTR{idProduct}=="4002", TEST=="power/control", ATTR{power/control}="auto"
-ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="04b3", ATTR{idProduct}=="4012", TEST=="power/control", ATTR{power/control}="auto"
-
-# Raritan Computer, Inc KVM.
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="14dd", ATTR{idProduct}=="0002", TEST=="power/control", ATTR{power/control}="auto"
-
-# USB HID devices that are internal to the machine should also be safe to autosuspend
-
-ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTR{../removable}=="removable", GOTO="usb_hid_pm_end"
-ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTR{../removable}=="unknown", GOTO="usb_hid_pm_end"
-
-ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTR{../removable}=="fixed", TEST=="../power/control", ATTR{../power/control}="auto"
-
-LABEL="usb_hid_pm_end"



More information about the systemd-commits mailing list