[arch-commits] Commit in systemd/trunk (4 files)

Dave Reisner dreisner at nymeria.archlinux.org
Sun Apr 14 17:41:42 UTC 2013


    Date: Sunday, April 14, 2013 @ 19:41:42
  Author: dreisner
Revision: 182760

upgpkg: systemd 201-2

- backport trivial fixes from git master

Added:
  systemd/trunk/0001-fileio-in-envfiles-do-not-skip-lines-following-empty.patch
  systemd/trunk/0001-journal-fix-broken-tags-_SOURCE_REALTIME_TIMESTAMP-a.patch
  systemd/trunk/0001-logind-avoid-creating-stale-session-state-files.patch
Modified:
  systemd/trunk/PKGBUILD

-----------------------------------------------------------------+
 0001-fileio-in-envfiles-do-not-skip-lines-following-empty.patch |  167 ++++++++++
 0001-journal-fix-broken-tags-_SOURCE_REALTIME_TIMESTAMP-a.patch |   35 ++
 0001-logind-avoid-creating-stale-session-state-files.patch      |   48 ++
 PKGBUILD                                                        |   10 
 4 files changed, 260 insertions(+)

Added: 0001-fileio-in-envfiles-do-not-skip-lines-following-empty.patch
===================================================================
--- 0001-fileio-in-envfiles-do-not-skip-lines-following-empty.patch	                        (rev 0)
+++ 0001-fileio-in-envfiles-do-not-skip-lines-following-empty.patch	2013-04-14 17:41:42 UTC (rev 182760)
@@ -0,0 +1,167 @@
+From d3b6d0c21ea5a0d15ec6dbd8b8d179138b7463bc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek at in.waw.pl>
+Date: Sat, 13 Apr 2013 20:22:53 -0400
+Subject: [PATCH] fileio: in envfiles, do not skip lines following empty lines
+
+https://bugs.freedesktop.org/show_bug.cgi?id=63477
+---
+ src/binfmt/binfmt.c             |  2 +-
+ src/journal/catalog.c           |  2 +-
+ src/modules-load/modules-load.c |  2 +-
+ src/shared/conf-parser.c        |  2 +-
+ src/shared/install.c            |  2 +-
+ src/shared/util.h               |  2 +-
+ src/sysctl/sysctl.c             |  2 +-
+ src/test/test-unit-file.c       | 31 +++++++++++++++++++++++++++++++
+ 8 files changed, 38 insertions(+), 7 deletions(-)
+
+diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
+index 9ca1e60..5a42b3d 100644
+--- a/src/binfmt/binfmt.c
++++ b/src/binfmt/binfmt.c
+@@ -110,7 +110,7 @@ static int apply_file(const char *path, bool ignore_enoent) {
+                 p = strstrip(l);
+                 if (!*p)
+                         continue;
+-                if (strchr(COMMENTS, *p))
++                if (strchr(COMMENTS "\n", *p))
+                         continue;
+ 
+                 k = apply_rule(p);
+diff --git a/src/journal/catalog.c b/src/journal/catalog.c
+index ebf0622..7681af6 100644
+--- a/src/journal/catalog.c
++++ b/src/journal/catalog.c
+@@ -180,7 +180,7 @@ int catalog_import_file(Hashmap *h, struct strbuf *sb, const char *path) {
+                         continue;
+                 }
+ 
+-                if (strchr(COMMENTS, line[0]))
++                if (strchr(COMMENTS "\n", line[0]))
+                         continue;
+ 
+                 if (empty_line &&
+diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
+index 9ee2603..b3f7af0 100644
+--- a/src/modules-load/modules-load.c
++++ b/src/modules-load/modules-load.c
+@@ -206,7 +206,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
+                 l = strstrip(line);
+                 if (!*l)
+                         continue;
+-                if (strchr(COMMENTS, *l))
++                if (strchr(COMMENTS "\n", *l))
+                         continue;
+ 
+                 k = load_module(ctx, l);
+diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
+index fbacf98..fea2e56 100644
+--- a/src/shared/conf-parser.c
++++ b/src/shared/conf-parser.c
+@@ -174,7 +174,7 @@ static int parse_line(
+         if (!*l)
+                 return 0;
+ 
+-        if (strchr(COMMENTS, *l))
++        if (strchr(COMMENTS "\n", *l))
+                 return 0;
+ 
+         if (startswith(l, ".include ")) {
+diff --git a/src/shared/install.c b/src/shared/install.c
+index f9d223e..71e0433 100644
+--- a/src/shared/install.c
++++ b/src/shared/install.c
+@@ -1699,7 +1699,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) {
+                         if (!*l)
+                                 continue;
+ 
+-                        if (strchr(COMMENTS, *l))
++                        if (strchr(COMMENTS "\n", *l))
+                                 continue;
+ 
+                         if (first_word(l, "enable")) {
+diff --git a/src/shared/util.h b/src/shared/util.h
+index 99ec0a3..ad97536 100644
+--- a/src/shared/util.h
++++ b/src/shared/util.h
+@@ -52,7 +52,7 @@ union dirent_storage {
+ #define WHITESPACE " \t\n\r"
+ #define NEWLINE "\n\r"
+ #define QUOTES "\"\'"
+-#define COMMENTS "#;\n"
++#define COMMENTS "#;"
+ 
+ #define FORMAT_BYTES_MAX 8
+ 
+diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
+index e0ba78a..db18dd9 100644
+--- a/src/sysctl/sysctl.c
++++ b/src/sysctl/sysctl.c
+@@ -149,7 +149,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
+                 if (!*p)
+                         continue;
+ 
+-                if (strchr(COMMENTS, *p))
++                if (strchr(COMMENTS "\n", *p))
+                         continue;
+ 
+                 value = strchr(p, '=');
+diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
+index 3cf8463..1bf11e6 100644
+--- a/src/test/test-unit-file.c
++++ b/src/test/test-unit-file.c
+@@ -199,6 +199,17 @@ static void test_config_parse_exec(void) {
+         "#--nouser-config                                     \\\n" \
+         "normal=line"
+ 
++#define env_file_4 \
++       "# Generated\n" \
++       "\n" \
++       "HWMON_MODULES=\"coretemp f71882fg\"\n" \
++       "\n" \
++       "# For compatibility reasons\n" \
++       "\n" \
++       "MODULE_0=coretemp\n" \
++       "MODULE_1=f71882fg"
++
++
+ static void test_load_env_file_1(void) {
+         char _cleanup_strv_free_ **data = NULL;
+         int r;
+@@ -251,6 +262,25 @@ static void test_load_env_file_3(void) {
+         unlink(name);
+ }
+ 
++static void test_load_env_file_4(void) {
++        char _cleanup_strv_free_ **data = NULL;
++        int r;
++
++        char name[] = "/tmp/test-load-env-file.XXXXXX";
++        int _cleanup_close_ fd = mkstemp(name);
++        assert(fd >= 0);
++        assert_se(write(fd, env_file_4, sizeof(env_file_4)) == sizeof(env_file_4));
++
++        r = load_env_file(name, NULL, &data);
++        assert(r == 0);
++        assert(streq(data[0], "HWMON_MODULES=coretemp f71882fg"));
++        assert(streq(data[1], "MODULE_0=coretemp"));
++        assert(streq(data[2], "MODULE_1=f71882fg"));
++        assert(data[3] == NULL);
++        unlink(name);
++}
++
++
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wnonnull"
+ 
+@@ -327,6 +357,7 @@ int main(int argc, char *argv[]) {
+         test_load_env_file_1();
+         test_load_env_file_2();
+         test_load_env_file_3();
++        test_load_env_file_4();
+         test_install_printf();
+ 
+         return 0;
+-- 
+1.8.2.1
+

Added: 0001-journal-fix-broken-tags-_SOURCE_REALTIME_TIMESTAMP-a.patch
===================================================================
--- 0001-journal-fix-broken-tags-_SOURCE_REALTIME_TIMESTAMP-a.patch	                        (rev 0)
+++ 0001-journal-fix-broken-tags-_SOURCE_REALTIME_TIMESTAMP-a.patch	2013-04-14 17:41:42 UTC (rev 182760)
@@ -0,0 +1,35 @@
+From d378991747d67fff1d4dc39e7fb2bc8f49f1b561 Mon Sep 17 00:00:00 2001
+From: Mirco Tischler <mt-ml at gmx.de>
+Date: Sat, 13 Apr 2013 01:03:49 +0200
+Subject: [PATCH] journal: fix broken tags _SOURCE_REALTIME_TIMESTAMP and
+ _MACHINE_ID
+
+---
+ src/journal/journald-server.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
+index 53e3830..be84323 100644
+--- a/src/journal/journald-server.c
++++ b/src/journal/journald-server.c
+@@ -538,7 +538,7 @@ static void dispatch_message_real(
+         char pid[sizeof("_PID=") + DECIMAL_STR_MAX(ucred->pid)],
+                 uid[sizeof("_UID=") + DECIMAL_STR_MAX(ucred->uid)],
+                 gid[sizeof("_GID=") + DECIMAL_STR_MAX(ucred->gid)],
+-                source_time[sizeof("_SOURCE_REALTIME_TIMESTAMP=" + DECIMAL_STR_MAX(usec_t))],
++                source_time[sizeof("_SOURCE_REALTIME_TIMESTAMP=") + DECIMAL_STR_MAX(usec_t)],
+                 boot_id[sizeof("_BOOT_ID=") + 32] = "_BOOT_ID=",
+                 machine_id[sizeof("_MACHINE_ID=") + 32] = "_MACHINE_ID=";
+ 
+@@ -699,7 +699,7 @@ static void dispatch_message_real(
+ 
+         r = sd_id128_get_machine(&id);
+         if (r >= 0) {
+-                sd_id128_to_string(id, machine_id + sizeof("_MACHINE_ID") - 1);
++                sd_id128_to_string(id, machine_id + sizeof("_MACHINE_ID=") - 1);
+                 IOVEC_SET_STRING(iovec[n++], machine_id);
+         }
+ 
+-- 
+1.8.2.1
+

Added: 0001-logind-avoid-creating-stale-session-state-files.patch
===================================================================
--- 0001-logind-avoid-creating-stale-session-state-files.patch	                        (rev 0)
+++ 0001-logind-avoid-creating-stale-session-state-files.patch	2013-04-14 17:41:42 UTC (rev 182760)
@@ -0,0 +1,48 @@
+From 50fb97935d689a520251b2d543599be14bdfd0ed Mon Sep 17 00:00:00 2001
+From: Fedora systemd team <systemd-maint at redhat.com>
+Date: Wed, 10 Apr 2013 09:49:24 +0200
+Subject: [PATCH] logind: avoid creating stale session state files
+
+There were old session state files accumulating in /run/systemd/session.
+They confused e.g. "reboot", which thought there were still users logged
+in. The files got created like this:
+
+session_stop(Session *s) ->
+        ...
+        unlink(s->state_file);
+        ...
+        seat_set_active(s->seat, NULL) ->
+                session_save(...);  /* re-creates the state file we just
+                                       unlinked */
+
+Fix it simply by clearing the s->started flag earlier to prevent
+any further writes of the state file (session_save() checks the flag).
+---
+ src/login/logind-session.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/login/logind-session.c b/src/login/logind-session.c
+index 508336d..e2f41d3 100644
+--- a/src/login/logind-session.c
++++ b/src/login/logind-session.c
+@@ -710,6 +710,8 @@ int session_stop(Session *s) {
+         if (s->started)
+                 session_send_signal(s, false);
+ 
++        s->started = false;
++
+         if (s->seat) {
+                 if (s->seat->active == s)
+                         seat_set_active(s->seat, NULL);
+@@ -721,8 +723,6 @@ int session_stop(Session *s) {
+         user_send_changed(s->user, "Sessions\0");
+         user_save(s->user);
+ 
+-        s->started = false;
+-
+         return r;
+ }
+ 
+-- 
+1.8.2.1
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2013-04-14 17:12:52 UTC (rev 182759)
+++ PKGBUILD	2013-04-14 17:41:42 UTC (rev 182760)
@@ -16,11 +16,17 @@
         'initcpio-hook-udev'
         'initcpio-install-udev'
         'initcpio-install-timestamp'
+        '0001-fileio-in-envfiles-do-not-skip-lines-following-empty.patch'
+        '0001-journal-fix-broken-tags-_SOURCE_REALTIME_TIMESTAMP-a.patch'
+        '0001-logind-avoid-creating-stale-session-state-files.patch'
         'use-split-usr-path.patch')
 md5sums=('3e758392ff0e9206b3f7ee252b4a654b'
          'e99e9189aa2f6084ac28b8ddf605aeb8'
          'fb37e34ea006c79be1c54cbb0f803414'
          'df69615503ad293c9ddf9d8b7755282d'
+         'd575a29ca735944aa45126ab9d3087a5'
+         '8170482f10bb0420770a64dce23975bc'
+         'b1355aae98071e83fca27549a0ac3def'
          '76bf83fe34c5b40533abc5dc940576a6')
 
 prepare() {
@@ -28,6 +34,10 @@
 
   # hang onto this until we do the /{,s}bin merge
   patch -Np1 <"$srcdir/use-split-usr-path.patch"
+
+  patch -Np1 <"$srcdir/0001-fileio-in-envfiles-do-not-skip-lines-following-empty.patch"
+  patch -Np1 <"$srcdir/0001-journal-fix-broken-tags-_SOURCE_REALTIME_TIMESTAMP-a.patch"
+  patch -Np1 <"$srcdir/0001-logind-avoid-creating-stale-session-state-files.patch"
 }
 
 build() {




More information about the arch-commits mailing list