[systemd-commits] 5 commits - fixme Makefile.am src/build.h src/conf-parser.c src/dbus.c src/dbus-execute.c src/dbus-execute.h src/main.c src/manager.c src/unit.c src/unit.h

Lennart Poettering lennart at kemper.freedesktop.org
Wed Aug 11 16:05:48 PDT 2010


 Makefile.am        |    3 ++-
 fixme              |    6 ------
 src/build.h        |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/conf-parser.c  |    2 +-
 src/dbus-execute.c |    6 ++++--
 src/dbus-execute.h |    2 +-
 src/dbus.c         |    6 +++---
 src/main.c         |    4 +++-
 src/manager.c      |   12 +++++++++---
 src/unit.c         |    6 +++++-
 src/unit.h         |    3 +++
 11 files changed, 82 insertions(+), 19 deletions(-)

New commits:
commit 8821a00fd5b8cb349bce66816c213573db05ec46
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Aug 12 01:05:35 2010 +0200

    unit: don't show ENOENT configuration file warnings for units that are not essential

diff --git a/fixme b/fixme
index 6d0f5b2..47fb8a8 100644
--- a/fixme
+++ b/fixme
@@ -10,10 +10,6 @@
     chown root:utmp /var/run/utmp
     mkdir -p /var/lock/subsys
 
-* downgrade warnings for non-existent services pulled-in
-  by soft dependencies, like:
-    init[1]: Failed to load configuration for isdn.service: No such file or directory
-
 * have a simple syslog bridge providing /dev/log and forward messages
   to /dev/kmsg. at the moment the real syslog can be started, the bridge
   is stopped and the open /dev/log fd to the real syslog. that way we
@@ -71,8 +67,6 @@
 
 * if a service fails too often, make the service enter maintainence mode, and the socket, too.
 
-* don't show file not found msgs for irrelevant units
-
 * j->installed issue
 
 * plymouth boot.log
diff --git a/src/manager.c b/src/manager.c
index 9684efa..3e742f7 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1392,9 +1392,15 @@ static int transaction_add_job_and_dependencies(
         assert(type < _JOB_TYPE_MAX);
         assert(unit);
 
-        if (type != JOB_STOP &&
-            unit->meta.load_state != UNIT_LOADED) {
-                dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load. See logs for details.", unit->meta.id);
+        if (unit->meta.load_state != UNIT_LOADED && unit->meta.load_state != UNIT_FAILED) {
+                dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s is not loaded properly.", unit->meta.id);
+                return -EINVAL;
+        }
+
+        if (type != JOB_STOP && unit->meta.load_state == UNIT_FAILED) {
+                dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load: %s. You might find more information in the logs.",
+                               unit->meta.id,
+                               strerror(-unit->meta.load_error));
                 return -EINVAL;
         }
 
diff --git a/src/unit.c b/src/unit.c
index 59776c3..e004250 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -672,6 +672,9 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
                 fprintf(f,
                         "%s\tMerged into: %s\n",
                         prefix, u->meta.merged_into->meta.id);
+        else if (u->meta.load_state == UNIT_FAILED)
+                fprintf(f, "%s\tLoad Error Code: %s\n", prefix, strerror(-u->meta.load_error));
+
 
         if (u->meta.job)
                 job_dump(u->meta.job, f, prefix2);
@@ -756,9 +759,10 @@ int unit_load(Unit *u) {
 
 fail:
         u->meta.load_state = UNIT_FAILED;
+        u->meta.load_error = r;
         unit_add_to_dbus_queue(u);
 
-        log_notice("Failed to load configuration for %s: %s", u->meta.id, strerror(-r));
+        log_debug("Failed to load configuration for %s: %s", u->meta.id, strerror(-r));
 
         return r;
 }
diff --git a/src/unit.h b/src/unit.h
index a99d33e..8bd81a2 100644
--- a/src/unit.h
+++ b/src/unit.h
@@ -184,6 +184,9 @@ struct Meta {
          * unit here, if there was a job scheduled */
         int deserialized_job; /* This is actually of type JobType */
 
+        /* Error code when we didn't manage to load the unit (negative) */
+        int load_error;
+
         /* If we go down, pull down everything that depends on us, too */
         bool recursive_stop;
 
commit 302e27c89ed57f413d2a136fbe66fde32f016aed
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Aug 12 01:03:24 2010 +0200

    main: log build time features on startup

diff --git a/Makefile.am b/Makefile.am
index abd07eb..3d33e79 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -337,7 +337,8 @@ EXTRA_DIST += \
 	src/dbus-common.h \
 	src/bus-errors.h \
 	src/cgroup-show.h \
-	src/utmp-wtmp.h
+	src/utmp-wtmp.h \
+	src/build.h
 
 MANPAGES = \
 	man/systemd.1 \
diff --git a/src/build.h b/src/build.h
new file mode 100644
index 0000000..d2058db
--- /dev/null
+++ b/src/build.h
@@ -0,0 +1,51 @@
+/*-*- Mode: C; c-basic-offset: 8 -*-*/
+
+#ifndef foobuildhfoo
+#define foobuildhfoo
+
+/***
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd 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.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#ifdef HAVE_PAM
+#define _PAM_FEATURE_ "+PAM"
+#else
+#define _PAM_FEATURE_ "-PAM"
+#endif
+
+#ifdef HAVE_LIBWRAP
+#define _LIBWRAP_FEATURE_ "+LIBWRAP"
+#else
+#define _LIBWRAP_FEATURE_ "-LIBWRAP"
+#endif
+
+#ifdef HAVE_AUDIT
+#define _AUDIT_FEATURE_ "+AUDIT"
+#else
+#define _AUDIT_FEATURE_ "-AUDIT"
+#endif
+
+#ifdef HAVE_SELINUX
+#define _SELINUX_FEATURE_ "+SELINUX"
+#else
+#define _SELINUX_FEATURE_ "-SELINUX"
+#endif
+
+#define SYSTEMD_FEATURES _PAM_FEATURE_ " " _LIBWRAP_FEATURE_ " " _AUDIT_FEATURE_ " " _SELINUX_FEATURE_
+
+#endif
diff --git a/src/main.c b/src/main.c
index 2e17f9b..68da330 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,6 +46,7 @@
 #include "bus-errors.h"
 #include "missing.h"
 #include "label.h"
+#include "build.h"
 
 static enum {
         ACTION_RUN,
@@ -988,7 +989,8 @@ int main(int argc, char *argv[]) {
         if (getpid() == 1)
                 install_crash_handler();
 
-        log_info(PACKAGE_STRING " running in %s mode.", manager_running_as_to_string(arg_running_as));
+        log_full(arg_running_as == MANAGER_SYSTEM ? LOG_INFO : LOG_DEBUG,
+                 PACKAGE_STRING " running in %s mode. (" SYSTEMD_FEATURES ")", manager_running_as_to_string(arg_running_as));
 
         if (arg_running_as == MANAGER_SYSTEM) {
 
commit 91805b3bcb651b80957fa9d5e8f730e8e8375f43
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Aug 12 01:02:19 2010 +0200

    dbus: downgrade a few log messages

diff --git a/src/dbus.c b/src/dbus.c
index cb580e1..f378f43 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -454,7 +454,7 @@ static DBusHandlerResult system_bus_message_filter(DBusConnection *connection, D
                           dbus_message_get_path(message));
 
         if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
-                log_error("Warning! System D-Bus connection terminated.");
+                log_debug("System D-Bus connection terminated.");
                 bus_done_system(m);
 
         } else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Agent", "Released")) {
@@ -816,7 +816,7 @@ static int bus_init_system(Manager *m) {
 
         if (m->api_bus != m->system_bus) {
                 char *id;
-                log_info("Successfully connected to system D-Bus bus %s as %s",
+                log_debug("Successfully connected to system D-Bus bus %s as %s",
                          strnull((id = dbus_connection_get_server_id(m->system_bus))),
                          strnull(dbus_bus_get_unique_name(m->system_bus)));
                 dbus_free(id);
@@ -902,7 +902,7 @@ static int bus_init_api(Manager *m) {
 
         if (m->api_bus != m->system_bus) {
                 char *id;
-                log_info("Successfully connected to API D-Bus bus %s as %s",
+                log_debug("Successfully connected to API D-Bus bus %s as %s",
                          strnull((id = dbus_connection_get_server_id(m->api_bus))),
                          strnull(dbus_bus_get_unique_name(m->api_bus)));
                 dbus_free(id);
commit 674cdd1933ef5301385d2119a4d1c5e9c862f0a2
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Aug 12 01:01:55 2010 +0200

    dbus: fix capability serialization

diff --git a/src/dbus-execute.c b/src/dbus-execute.c
index 55c61e5..1222d1b 100644
--- a/src/dbus-execute.c
+++ b/src/dbus-execute.c
@@ -209,11 +209,13 @@ int bus_execute_append_capabilities(Manager *m, DBusMessageIter *i, const char *
         else
                 s = "";
 
-        if (!t)
+        if (!s)
                 return -ENOMEM;
 
         b = dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &s);
-        cap_free(t);
+
+        if (t)
+                cap_free(t);
 
         if (!b)
                 return -ENOMEM;
diff --git a/src/dbus-execute.h b/src/dbus-execute.h
index a00acbe..cc4b803 100644
--- a/src/dbus-execute.h
+++ b/src/dbus-execute.h
@@ -127,7 +127,7 @@
         { interface, "SyslogPriority",                bus_property_append_int,    "i",     &(context).syslog_priority              }, \
         { interface, "SyslogIdentifier",              bus_property_append_string, "s",     (context).syslog_identifier             }, \
         { interface, "SyslogLevelPrefix",             bus_property_append_bool,   "b",     &(context).syslog_level_prefix          }, \
-        { interface, "Capabilities",                  bus_execute_append_capabilities, "s", (context).capabilities                 }, \
+        { interface, "Capabilities",                  bus_execute_append_capabilities, "s",&(context)                              }, \
         { interface, "SecureBits",                    bus_property_append_int,    "i",     &(context).secure_bits                  }, \
         { interface, "CapabilityBoundingSetDrop",     bus_property_append_uint64, "t",     &(context).capability_bounding_set_drop }, \
         { interface, "User",                          bus_property_append_string, "s",     (context).user                          }, \
commit 449648c430b38906fd8c8cd9cc3e4a5d05d7e0a9
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Aug 12 01:01:30 2010 +0200

    conf-parser: don't crash if an assignment is read before a section header

diff --git a/src/conf-parser.c b/src/conf-parser.c
index 1cabc0d..b439d0c 100644
--- a/src/conf-parser.c
+++ b/src/conf-parser.c
@@ -122,7 +122,7 @@ static int parse_line(const char *filename, unsigned line, char **section, const
                 return 0;
         }
 
-        if (sections && !strv_contains((char**) sections, *section))
+        if (sections && (!*section || !strv_contains((char**) sections, *section)))
                 return 0;
 
         if (!(e = strchr(l, '='))) {


More information about the systemd-commits mailing list