Compare commits

...

23 Commits
master ... f19

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 3a9a496636 Enable x2gocleansessions.service by default (#1141607) 2014-09-16 05:55:05 -04:00
Zbigniew Jędrzejewski-Szmek b7f33dca9e Revert bad patch 2014-08-14 22:18:36 -04:00
Zbigniew Jędrzejewski-Szmek 674ca7db6e Bugfix release 2014-07-22 23:27:07 -04:00
Zbigniew Jędrzejewski-Szmek ad4bdfb7cc Require diffutils 2014-01-11 12:40:59 -05:00
Zbigniew Jędrzejewski-Szmek 41a9137aa2 Enable x509watch in presets 2013-12-10 22:12:50 -05:00
Zbigniew Jędrzejewski-Szmek 6cb7994365 Backport a bunch of fixes and hwdb updates 2013-12-08 22:07:34 -05:00
Zbigniew Jędrzejewski-Szmek 2f8be63bb9 Backport one more patch 2013-10-23 17:00:01 -04:00
Zbigniew Jędrzejewski-Szmek 1ab4435c73 Backport a bunch of fixes and hwdb updates
https://bugzilla.redhat.com/show_bug.cgi?id=890463
https://bugzilla.redhat.com/show_bug.cgi?id=994268
https://bugzilla.redhat.com/show_bug.cgi?id=1017375
https://bugzilla.redhat.com/show_bug.cgi?id=880709
https://bugzilla.redhat.com/show_bug.cgi?id=1017473
2013-10-21 18:52:11 -04:00
Zbigniew Jędrzejewski-Szmek 906d6271c3 Add one more bug number 2013-10-06 18:01:13 -04:00
Zbigniew Jędrzejewski-Szmek 51b11df8bc Backport more patches 2013-10-06 16:34:32 -04:00
Zbigniew Jędrzejewski-Szmek 8732442681 Fix policykit bug 2013-09-18 11:50:20 -05:00
Zbigniew Jędrzejewski-Szmek b629b6bd89 Remove one more patch
UNIT_NOT_FOUND doesn't exist yet in 204.
2013-09-17 11:58:26 -05:00
Zbigniew Jędrzejewski-Szmek 310fc4f860 Fix hwdb patch format 2013-09-17 11:45:51 -05:00
Zbigniew Jędrzejewski-Szmek a54eec6cfa Remove one patch 2013-09-17 11:15:04 -05:00
Zbigniew Jędrzejewski-Szmek 7a98274052 Backport two more patches 2013-09-17 11:00:47 -05:00
Zbigniew Jędrzejewski-Szmek ec83c47f2c Backport newest changes in hwdb 2013-09-17 09:06:20 -05:00
Zbigniew Jędrzejewski-Szmek b867292db0 Backport hwdb 2013-09-17 08:32:44 -05:00
Zbigniew Jędrzejewski-Szmek be52b9f23a Backport a bunch of bugfixes 2013-09-14 14:13:11 -04:00
Zbigniew Jędrzejewski-Szmek 7246e4baec Add ownership of files we create 2013-09-06 07:48:58 -04:00
Harald Hoyer f07f76f46a systemd-204-11
- always call kmod, even when a driver is bound to the device
Resolves: rhbz#1004456
2013-09-05 14:12:48 +02:00
Zbigniew Jędrzejewski-Szmek e50a60694b Fix double includes in %files 2013-08-17 00:00:57 -04:00
Zbigniew Jędrzejewski-Szmek 24290ffb24 Filter python modules from provides
Those are "private libraries" and should never be present
in provides.
2013-08-16 23:48:04 -04:00
Zbigniew Jędrzejewski-Szmek 263fbfb8cc Package also Python 3 bindings 2013-08-14 21:56:20 -04:00
157 changed files with 99294 additions and 43 deletions

View File

@ -0,0 +1,28 @@
From 11fe664c24617569d1088fae7c6630718fbf1896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Bartoszkiewicz?= <mbartoszkiewicz@gmail.com>
Date: Wed, 15 May 2013 11:28:58 +0200
Subject: [PATCH] journal: correctly convert usec_t to timespec.
Use timespec_store instead of (incorrectly) doing it inline.
---
src/journal/journald-server.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index cc52b8a5c9..b717b92ffb 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1332,10 +1332,9 @@ int server_schedule_sync(Server *s) {
return 0;
if (s->sync_interval_usec) {
- struct itimerspec sync_timer_enable = {
- .it_value.tv_sec = s->sync_interval_usec / USEC_PER_SEC,
- .it_value.tv_nsec = s->sync_interval_usec % MSEC_PER_SEC,
- };
+ struct itimerspec sync_timer_enable = {};
+
+ timespec_store(&sync_timer_enable.it_value, s->sync_interval_usec);
r = timerfd_settime(s->sync_timer_fd, 0, &sync_timer_enable, NULL);
if (r < 0)

View File

@ -0,0 +1,32 @@
From 67cbbab20c41dd3a7908bc9e50f56ce3ee607bf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 16 May 2013 00:38:39 -0400
Subject: [PATCH] systemd-python: do not attempt to convert str to bytes
Bug-spotted-by: Steven Hiscocks <steven-systemd@hiscocks.me.uk>
---
src/python-systemd/journal.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index 9ef1ede229..8fd1bb357c 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -55,6 +55,9 @@ def _convert_realtime(t):
def _convert_timestamp(s):
return _datetime.datetime.fromtimestamp(int(s) / 1000000)
+def _convert_trivial(x):
+ return x
+
if _sys.version_info >= (3,):
def _convert_uuid(s):
return _uuid.UUID(s.decode())
@@ -87,6 +90,7 @@ DEFAULT_CONVERTERS = {
'__REALTIME_TIMESTAMP': _convert_realtime,
'_SOURCE_MONOTONIC_TIMESTAMP': _convert_source_monotonic,
'__MONOTONIC_TIMESTAMP': _convert_monotonic,
+ '__CURSOR': _convert_trivial,
'COREDUMP': bytes,
'COREDUMP_PID': int,
'COREDUMP_UID': int,

View File

@ -0,0 +1,59 @@
From 451cbd3ce291b2e3205461068899bb55d7dcd9d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 17 Jul 2013 12:50:43 -0400
Subject: [PATCH] systemd-python: fix iteration
Back in 6a58bf4135 raising stop iteration was removed from the C
code, but wasn't added in the Python counterpart.
---
configure.ac | 1 -
src/python-systemd/journal.py | 24 ++++++++++++------------
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/configure.ac b/configure.ac
index e1278e8504..a9182520fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -939,7 +939,6 @@ AC_MSG_RESULT([
nss-myhostname: ${have_myhostname}
gudev: ${enable_gudev}
gintrospection: ${enable_introspection}
- keymap: ${enable_keymap}
Python: ${have_python}
Python Headers: ${have_python_devel}
man pages: ${have_manpages}
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index 8fd1bb357c..adcc844f46 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -191,18 +191,18 @@ class Reader(_Reader):
"""
return self
- if _sys.version_info >= (3,):
- def __next__(self):
- """Part of iterator protocol.
- Returns self.get_next().
- """
- return self.get_next()
- else:
- def next(self):
- """Part of iterator protocol.
- Returns self.get_next().
- """
- return self.get_next()
+ def __next__(self):
+ """Part of iterator protocol.
+ Returns self.get_next() or raises StopIteration.
+ """
+ ans = self.get_next()
+ if ans:
+ return ans
+ else:
+ raise StopIteration()
+
+ if _sys.version_info < (3,):
+ next = __next__
def add_match(self, *args, **kwargs):
"""Add one or more matches to the filter journal log entries.

View File

@ -0,0 +1,54 @@
From 416783827045e646f8c104aa9a0719e738f53ca6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
Date: Mon, 20 May 2013 11:20:15 +0300
Subject: [PATCH] systemctl: honor "--no-legend" in 'list-sockets'
---
src/systemctl/systemctl.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3cca861cf6..e6bd855c15 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -655,11 +655,12 @@ static int output_sockets_list(struct socket_info *socket_infos, unsigned cs) {
}
if (cs) {
- printf("%-*s %-*.*s%-*s %s\n",
- pathlen, "LISTEN",
- typelen + arg_show_types, typelen + arg_show_types, "TYPE ",
- socklen, "UNIT",
- "ACTIVATES");
+ if (!arg_no_legend)
+ printf("%-*s %-*.*s%-*s %s\n",
+ pathlen, "LISTEN",
+ typelen + arg_show_types, typelen + arg_show_types, "TYPE ",
+ socklen, "UNIT",
+ "ACTIVATES");
for (s = socket_infos; s < socket_infos + cs; s++) {
char **a;
@@ -678,15 +679,18 @@ static int output_sockets_list(struct socket_info *socket_infos, unsigned cs) {
on = ansi_highlight(true);
off = ansi_highlight(false);
- printf("\n");
+ if (!arg_no_legend)
+ printf("\n");
} else {
on = ansi_highlight_red(true);
off = ansi_highlight_red(false);
}
- printf("%s%u sockets listed.%s\n", on, cs, off);
- if (!arg_all)
- printf("Pass --all to see loaded but inactive sockets, too.\n");
+ if (!arg_no_legend) {
+ printf("%s%u sockets listed.%s\n", on, cs, off);
+ if (!arg_all)
+ printf("Pass --all to see loaded but inactive sockets, too.\n");
+ }
return 0;
}

View File

@ -0,0 +1,47 @@
From 1edd8011c0a9452d4f384551f06dd0c5f480c60f Mon Sep 17 00:00:00 2001
From: Michael Olbrich <m.olbrich@pengutronix.de>
Date: Sun, 19 May 2013 12:10:55 +0200
Subject: [PATCH] service: kill processes with SIGKILL on watchdog failure
Just calling service_enter_dead() does not kill any processes.
As a result, the old process may still be running when the new one is
started.
After a watchdog failure the service is in an undefined state.
Using the normal shutdown mechanism makes no sense. Instead all processes
are just killed and the service can try to restart.
---
src/core/service.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index 3617c24711..e110a41dae 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -235,7 +235,7 @@ static void service_stop_watchdog(Service *s) {
s->watchdog_timestamp.monotonic = 0;
}
-static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart);
+static void service_enter_signal(Service *s, ServiceState state, ServiceResult f);
static void service_handle_watchdog(Service *s) {
usec_t offset;
@@ -249,7 +249,7 @@ static void service_handle_watchdog(Service *s) {
offset = now(CLOCK_MONOTONIC) - s->watchdog_timestamp.monotonic;
if (offset >= s->watchdog_usec) {
log_error_unit(UNIT(s)->id, "%s watchdog timeout!", UNIT(s)->id);
- service_enter_dead(s, SERVICE_FAILURE_WATCHDOG, true);
+ service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_FAILURE_WATCHDOG);
return;
}
@@ -1939,8 +1939,6 @@ fail:
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
}
-static void service_enter_signal(Service *s, ServiceState state, ServiceResult f);
-
static void service_enter_stop_post(Service *s, ServiceResult f) {
int r;
assert(s);

View File

@ -0,0 +1,24 @@
From 099027082347d4c366d1f72e9e23d1939914d7bf Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Fri, 24 May 2013 13:34:53 -0400
Subject: [PATCH] Fix CPUShares configuration option
This fixes the error message "Unknown or unsupported cgroup attribute
CPUShares".
---
src/core/cgroup-semantics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/cgroup-semantics.c b/src/core/cgroup-semantics.c
index 82b02bbd78..7df9d014e9 100644
--- a/src/core/cgroup-semantics.c
+++ b/src/core/cgroup-semantics.c
@@ -255,7 +255,7 @@ static int map_blkio(const CGroupSemantics *s, const char *value, char **ret) {
}
static const CGroupSemantics semantics[] = {
- { "cpu", "cpu.shares", "CPUShare", false, parse_cpu_shares, NULL, NULL },
+ { "cpu", "cpu.shares", "CPUShares", false, parse_cpu_shares, NULL, NULL },
{ "memory", "memory.soft_limit_in_bytes", "MemorySoftLimit", false, parse_memory_limit, NULL, NULL },
{ "memory", "memory.limit_in_bytes", "MemoryLimit", false, parse_memory_limit, NULL, NULL },
{ "devices", "devices.allow", "DeviceAllow", true, parse_device, map_device, NULL },

View File

@ -0,0 +1,84 @@
From b2923bfc88c874b303efa86f51a53ba0a31f5aaa Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Tue, 28 May 2013 20:45:34 +0200
Subject: [PATCH] journald: DO recalculate the ACL mask, but only if it doesn't
exist
Since 11ec7ce, journald isn't setting the ACLs properly anymore if
the files had no ACLs to begin with: acl_set_fd fails with EINVAL.
An ACL with ACL_USER or ACL_GROUP entries but no ACL_MASK entry is
invalid, so make sure a mask exists before trying to set the ACL.
---
src/journal/journald-server.c | 6 ++++--
src/shared/acl-util.c | 28 ++++++++++++++++++++++++++++
src/shared/acl-util.h | 1 +
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index b717b92ffb..da5b725863 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -227,9 +227,11 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
}
}
- /* We do not recalculate the mask here, so that the fchmod() mask above stays intact. */
+ /* We do not recalculate the mask unconditionally here,
+ * so that the fchmod() mask above stays intact. */
if (acl_get_permset(entry, &permset) < 0 ||
- acl_add_perm(permset, ACL_READ) < 0) {
+ acl_add_perm(permset, ACL_READ) < 0 ||
+ calc_acl_mask_if_needed(&acl) < 0) {
log_warning("Failed to patch ACL on %s, ignoring: %m", f->path);
goto finish;
}
diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c
index 48bb12f46b..fb04e49dc4 100644
--- a/src/shared/acl-util.c
+++ b/src/shared/acl-util.c
@@ -69,6 +69,34 @@ int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry) {
return 0;
}
+int calc_acl_mask_if_needed(acl_t *acl_p) {
+ acl_entry_t i;
+ int found;
+
+ assert(acl_p);
+
+ for (found = acl_get_entry(*acl_p, ACL_FIRST_ENTRY, &i);
+ found > 0;
+ found = acl_get_entry(*acl_p, ACL_NEXT_ENTRY, &i)) {
+
+ acl_tag_t tag;
+
+ if (acl_get_tag_type(i, &tag) < 0)
+ return -errno;
+
+ if (tag == ACL_MASK)
+ return 0;
+ }
+
+ if (found < 0)
+ return -errno;
+
+ if (acl_calc_mask(acl_p) < 0)
+ return -errno;
+
+ return 0;
+}
+
int search_acl_groups(char*** dst, const char* path, bool* belong) {
acl_t acl;
diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h
index 23090d9984..36ef490d7e 100644
--- a/src/shared/acl-util.h
+++ b/src/shared/acl-util.h
@@ -24,4 +24,5 @@
#include <stdbool.h>
int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry);
+int calc_acl_mask_if_needed(acl_t *acl_p);
int search_acl_groups(char*** dst, const char* path, bool* belong);

View File

@ -0,0 +1,29 @@
From 184c94de2cd85228b729dac1fb5f59453cfbbbed Mon Sep 17 00:00:00 2001
From: Ross Lagerwall <rosslagerwall@gmail.com>
Date: Sun, 9 Jun 2013 17:28:44 +0100
Subject: [PATCH] service: don't report alien child as alive when it's not
When a sigchld is received from an alien child, main_pid is set to
0 then service_enter_running calls main_pid_good to check if the
child is running. This incorrectly returned true because
kill(main_pid, 0) would return >= 0.
This fixes an error where a service would die and the cgroup would
become empty but the service would still report as active (running).
---
src/core/service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/service.c b/src/core/service.c
index e110a41dae..973bd03c78 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1865,7 +1865,7 @@ static int main_pid_good(Service *s) {
/* If it's an alien child let's check if it is still
* alive ... */
- if (s->main_pid_alien)
+ if (s->main_pid_alien && s->main_pid > 0)
return kill(s->main_pid, 0) >= 0 || errno != ESRCH;
/* .. otherwise assume we'll get a SIGCHLD for it,

View File

@ -1,8 +1,8 @@
From 87011c25d96e9fbcd8a465ba758fa037c7d08203 Mon Sep 17 00:00:00 2001
From c17f7d8a60e17af4abb63668756f9237db3b9634 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 6 Jun 2013 22:28:05 -0400
Subject: [PATCH 01/13] journal: remember last direction of search and keep
offset cache
Subject: [PATCH] journal: remember last direction of search and keep offset
cache
The fields in JournalFile are moved around to avoid wasting
7 bytes because of alignment.
@ -13,10 +13,10 @@ The fields in JournalFile are moved around to avoid wasting
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/TODO b/TODO
index 0dd19a0..1dc585c 100644
index 4f5af140f0..55d70f7acd 100644
--- a/TODO
+++ b/TODO
@@ -77,9 +77,6 @@ Features:
@@ -36,9 +36,6 @@ Features:
* investigate endianess issues of UUID vs. GUID
@ -27,7 +27,7 @@ index 0dd19a0..1dc585c 100644
should be able to safely try another attempt when the bus call LoadUnit() is invoked.
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index 7b1cd42..5cc2c2d 100644
index 7b1cd42854..5cc2c2d28d 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -42,10 +42,14 @@ typedef struct JournalMetrics {
@ -72,10 +72,10 @@ index 7b1cd42..5cc2c2d 100644
const char *fname,
int flags,
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 3aa9ed4..4c4cc2d 100644
index c21712b7c4..c74b4a22cd 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -102,7 +102,8 @@ static void init_location(Location *l, LocationType type, JournalFile *f, Object
@@ -101,7 +101,8 @@ static void init_location(Location *l, LocationType type, JournalFile *f, Object
l->seqnum_set = l->realtime_set = l->monotonic_set = l->xor_hash_set = true;
}
@ -85,7 +85,7 @@ index 3aa9ed4..4c4cc2d 100644
assert(j);
assert(type == LOCATION_DISCRETE || type == LOCATION_SEEK);
assert(f);
@@ -110,12 +111,10 @@ static void set_location(sd_journal *j, LocationType type, JournalFile *f, Objec
@@ -109,12 +110,10 @@ static void set_location(sd_journal *j, LocationType type, JournalFile *f, Objec
init_location(&j->current_location, type, f, o);
@ -99,7 +99,7 @@ index 3aa9ed4..4c4cc2d 100644
f->current_offset = offset;
}
@@ -811,7 +810,7 @@ static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc
@@ -826,7 +825,7 @@ static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc
assert(j);
assert(f);
@ -108,7 +108,7 @@ index 3aa9ed4..4c4cc2d 100644
cp = f->current_offset;
r = journal_file_move_to_object(f, OBJECT_ENTRY, cp, &c);
@@ -908,7 +907,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) {
@@ -923,7 +922,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) {
if (r < 0)
return r;
@ -117,6 +117,3 @@ index 3aa9ed4..4c4cc2d 100644
return 1;
}
--
1.8.2.1

View File

@ -1,4 +1,4 @@
From 53113dc8254cae9a27e321e539d2d876677e61b9 Mon Sep 17 00:00:00 2001
From 0bad6bf0e0c53e68bc41dd011ad22d4672de56eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 7 Jun 2013 22:01:03 -0400
Subject: [PATCH] journal: letting (interleaved) seqnums go
@ -49,18 +49,15 @@ https://bugzilla.novell.com/show_bug.cgi?id=817778
Possibly related:
https://bugs.freedesktop.org/show_bug.cgi?id=64293
Conflicts:
src/journal/journald-server.c
---
src/journal/journald-server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index cc52b8a..cde63c8 100644
index da5b725863..5813699b85 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -280,7 +280,7 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
@@ -282,7 +282,7 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
journal_file_close(f);
}
@ -69,6 +66,3 @@ index cc52b8a..cde63c8 100644
free(p);
if (r < 0)
--
1.8.2.1

View File

@ -0,0 +1,39 @@
From 59eb9113f522703d80f2904c81825e4a165bb050 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Sat, 20 Jul 2013 14:29:12 +0200
Subject: [PATCH] rules: drivers - always call kmod, even when a driver is
bound to the device
On Sat, Jul 20, 2013 at 12:56 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> After a recent change present in 3.11-rc1 there is a driver, called processor,
> that can be bound to the CPU devices whose sysfs directories are located under
> /sys/devices/system/cpu/. A side effect of this is that, after the driver has
> been bound to those devices, the kernel adds DRIVER=processor to ENV for CPU
> uevents and they don't match the default rule for autoloading modules matching
> MODALIAS:
>
> DRIVER!="?*", ENV{MODALIAS}=="?*", IMPORT{builtin}="kmod load $env{MODALIAS}"
>
> any more. However, there are some modules whose module aliases match specific
> CPU features through the modalias string and those modules should be loaded
> automatically if a compatible CPU is present. Yet, with the processor driver
> bound to the CPU devices the above rule is not sufficient for that, so we need
> a new default udev rule allowing those modules to be autoloaded even if the
> CPU devices have drivers.
---
rules/80-drivers.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rules/80-drivers.rules b/rules/80-drivers.rules
index 50523e4333..0b22d73ce5 100644
--- a/rules/80-drivers.rules
+++ b/rules/80-drivers.rules
@@ -2,7 +2,7 @@
ACTION=="remove", GOTO="drivers_end"
-DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{builtin}="kmod load $env{MODALIAS}"
+ENV{MODALIAS}=="?*", RUN{builtin}="kmod load $env{MODALIAS}"
SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN{builtin}="kmod load tifm_sd"
SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN{builtin}="kmod load tifm_ms"
SUBSYSTEM=="memstick", RUN{builtin}="kmod load ms_block mspro_block"

View File

@ -0,0 +1,39 @@
From 33e3e7fbcce582c26604d997df89e71908ac7999 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 1 Aug 2013 12:31:38 +0200
Subject: [PATCH] 80-net-name-slot.rules: only rename network interfaces on
ACTION=="add"
Otherwise systemd-udevd will rename on "change" and "move" events,
resulting in weird renames in combination with biosdevname
systemd-udevd[355]: renamed network interface eth0 to em1
systemd-udevd[355]: renamed network interface eth1 to p3p2
systemd-udevd[357]: renamed network interface eth0 to p3p1
systemd-udevd[429]: renamed network interface p3p2 to ens3f1
systemd-udevd[428]: renamed network interface p3p1 to ens3f0
systemd-udevd[426]: renamed network interface em1 to enp63s0
or
systemd-udevd[356]: renamed network interface eth0 to em1
systemd-udevd[356]: renamed network interface eth0 to p3p1
systemd-udevd[420]: renamed network interface p3p1 to ens3f0
systemd-udevd[418]: renamed network interface em1 to enp63s0
systemd-udevd[421]: renamed network interface eth1 to p3p1
---
rules/80-net-name-slot.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rules/80-net-name-slot.rules b/rules/80-net-name-slot.rules
index 15b5bc4107..c5f1b3885b 100644
--- a/rules/80-net-name-slot.rules
+++ b/rules/80-net-name-slot.rules
@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update
-ACTION=="remove", GOTO="net_name_slot_end"
+ACTION!="add", GOTO="net_name_slot_end"
SUBSYSTEM!="net", GOTO="net_name_slot_end"
NAME!="", GOTO="net_name_slot_end"

View File

@ -0,0 +1,37 @@
From 812882be86dcb30b2ab6e7f95dfcd393d972c781 Mon Sep 17 00:00:00 2001
From: George McCollister <george.mccollister@gmail.com>
Date: Thu, 1 Aug 2013 12:40:01 -0500
Subject: [PATCH] journal: fix hashmap leak in mmap-cache
hashmap_free() wasn't being called on m->contexts and m->fds resulting
in a leak.
To reproduce do:
while(1) {
sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY);
sd_journal_close(j);
}
Memory usage will increase until OOM.
---
src/journal/mmap-cache.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 767f555526..03b57beb04 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -307,9 +307,13 @@ static void mmap_cache_free(MMapCache *m) {
while ((c = hashmap_first(m->contexts)))
context_free(c);
+ hashmap_free(m->contexts);
+
while ((f = hashmap_first(m->fds)))
fd_free(f);
+ hashmap_free(m->fds);
+
while (m->unused)
window_free(m->unused);

View File

@ -0,0 +1,25 @@
From b09b841398cccd3794b9573d57828e810f5f33cb Mon Sep 17 00:00:00 2001
From: WANG Chao <chaowang@redhat.com>
Date: Fri, 9 Aug 2013 17:01:50 +0800
Subject: [PATCH] fstab-generator: read rd.fstab=on/off switch correctly
---
src/fstab-generator/fstab-generator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index c17299f267..479938f336 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -596,9 +596,9 @@ static int parse_proc_cmdline(void) {
} else if (startswith(word, "rd.fstab=")) {
if (in_initrd()) {
- r = parse_boolean(word + 6);
+ r = parse_boolean(word + 9);
if (r < 0)
- log_warning("Failed to parse fstab switch %s. Ignoring.", word + 6);
+ log_warning("Failed to parse fstab switch %s. Ignoring.", word + 9);
else
arg_enabled = r;
}

View File

@ -0,0 +1,22 @@
From 591e3ca379b32a65aea20f84fba3f88dd0f85f9b Mon Sep 17 00:00:00 2001
From: WANG Chao <chaowang@redhat.com>
Date: Tue, 13 Aug 2013 16:38:19 +0800
Subject: [PATCH] fstab-generator: log_oom() if automount_name is null
---
src/fstab-generator/fstab-generator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 479938f336..6b3e67e666 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -351,7 +351,7 @@ static int add_mount(
if (automount && !path_equal(where, "/")) {
automount_name = unit_name_from_path(where, ".automount");
- if (!name)
+ if (!automount_name)
return log_oom();
automount_unit = strjoin(arg_dest, "/", automount_name, NULL);

View File

@ -0,0 +1,24 @@
From 9331382dd5caabd748d8fc28a0bc2a087ed8f9a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 10 Jun 2013 18:10:12 -0400
Subject: [PATCH] journald: do not overwrite syslog facility when parsing
priority
https://bugs.freedesktop.org/show_bug.cgi?id=65610
---
src/journal/journald-syslog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index 000f5acc10..4aeb9a35f0 100644
--- a/src/journal/journald-syslog.c
+++ b/src/journal/journald-syslog.c
@@ -268,7 +268,7 @@ void syslog_parse_priority(char **p, int *priority) {
if (a < 0 || b < 0 || c < 0)
return;
- *priority = a*100+b*10+c;
+ *priority = (*priority & LOG_FACMASK) | (a*100 + b*10 + c);
*p += k;
}

View File

@ -0,0 +1,86 @@
From 5ca24e3f6deaba05049e4b0e4d8cea8a31f9eea0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 26 Jul 2013 12:57:33 -0400
Subject: [PATCH] journal: fix parsing of facility in syslog messages
In 49998b383 (journald: do not overwrite syslog facility when
parsing priority) journald started ignoring facility part when
reading service stderr to convert to syslog messages. In this
case it is fine, because only the priority is allowed.
But the same codepath is used for syslog messages, where the
facility should be used. Split the two codepaths by explicitly
specyfing whether the facility should be ignored or not.
https://bugzilla.redhat.com/show_bug.cgi?id=988814
---
src/journal/journald-stream.c | 2 +-
src/journal/journald-syslog.c | 12 ++++++++----
src/journal/journald-syslog.h | 2 +-
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index 6d51c29083..ad5df4c81d 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -90,7 +90,7 @@ static int stdout_stream_log(StdoutStream *s, const char *p) {
priority = s->priority;
if (s->level_prefix)
- syslog_parse_priority((char**) &p, &priority);
+ syslog_parse_priority((char**) &p, &priority, false);
if (s->forward_to_syslog || s->server->forward_to_syslog)
server_forward_syslog(s->server, syslog_fixup_facility(priority), s->identifier, p, &s->ucred, NULL);
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index 4aeb9a35f0..88d2a87236 100644
--- a/src/journal/journald-syslog.c
+++ b/src/journal/journald-syslog.c
@@ -236,7 +236,7 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid)
return e;
}
-void syslog_parse_priority(char **p, int *priority) {
+void syslog_parse_priority(char **p, int *priority, bool with_facility) {
int a = 0, b = 0, c = 0;
int k;
@@ -265,10 +265,14 @@ void syslog_parse_priority(char **p, int *priority) {
} else
return;
- if (a < 0 || b < 0 || c < 0)
+ if (a < 0 || b < 0 || c < 0 ||
+ (!with_facility && (a || b || c > 7)))
return;
- *priority = (*priority & LOG_FACMASK) | (a*100 + b*10 + c);
+ if (with_facility)
+ *priority = a*100 + b*10 + c;
+ else
+ *priority = (*priority & LOG_FACMASK) | c;
*p += k;
}
@@ -361,7 +365,7 @@ void server_process_syslog_message(
assert(buf);
orig = buf;
- syslog_parse_priority((char**) &buf, &priority);
+ syslog_parse_priority((char**) &buf, &priority, true);
if (s->forward_to_syslog)
forward_syslog_raw(s, priority, orig, ucred, tv);
diff --git a/src/journal/journald-syslog.h b/src/journal/journald-syslog.h
index 324b70eef0..8ccdb77a09 100644
--- a/src/journal/journald-syslog.h
+++ b/src/journal/journald-syslog.h
@@ -25,7 +25,7 @@
int syslog_fixup_facility(int priority) _const_;
-void syslog_parse_priority(char **p, int *priority);
+void syslog_parse_priority(char **p, int *priority, bool with_facility);
size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid);
void server_forward_syslog(Server *s, int priority, const char *identifier, const char *message, struct ucred *ucred, struct timeval *tv);

View File

@ -0,0 +1,49 @@
From fa74dedd21c2c64dc6cf20f49be9db32d909db74 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Wed, 4 Sep 2013 12:36:19 +0200
Subject: [PATCH] libudev: fix memleak when enumerating childs
We need to free udev-devices again if they don't match. Funny that no-one
noticed it yet since valgrind is quite verbose about it.
Fix it and free non-matching devices.
---
src/libudev/libudev-enumerate.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index 5ccaabdc6c..7e63820cba 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -826,23 +826,27 @@ nomatch:
static int parent_add_child(struct udev_enumerate *enumerate, const char *path)
{
struct udev_device *dev;
+ int r = 0;
dev = udev_device_new_from_syspath(enumerate->udev, path);
if (dev == NULL)
return -ENODEV;
if (!match_subsystem(enumerate, udev_device_get_subsystem(dev)))
- return 0;
+ goto nomatch;
if (!match_sysname(enumerate, udev_device_get_sysname(dev)))
- return 0;
+ goto nomatch;
if (!match_property(enumerate, dev))
- return 0;
+ goto nomatch;
if (!match_sysattr(enumerate, dev))
- return 0;
+ goto nomatch;
syspath_add(enumerate, udev_device_get_syspath(dev));
+ r = 1;
+
+nomatch:
udev_device_unref(dev);
- return 1;
+ return r;
}
static int parent_crawl_children(struct udev_enumerate *enumerate, const char *path, int maxdepth)

View File

@ -0,0 +1,44 @@
From 0006eedfd2596b69a6d62e0ae6ec7cfeec20ce0c Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Fri, 30 Aug 2013 15:50:41 +0200
Subject: [PATCH] libudev: enumerate: fix NULL-deref for subsystem-matches
udev_device_get_subsystem() may return NULL if no subsystem could be
figured out by libudev. This might be due to OOM or if the device
disconnected between the udev_device_new() call and
udev_device_get_subsystem(). Therefore, we need to handle subsystem==NULL
safely.
Instead of testing for it in each helper, we treat subsystem==NULL as
empty subsystem in match_subsystem().
Backtrace of udev_enumerate with an input-device disconnecting in exactly
this time-frame:
(gdb) bt
#0 0x00007ffff569dc24 in strnlen () from /usr/lib/libc.so.6
#1 0x00007ffff56d9e04 in fnmatch@@GLIBC_2.2.5 () from /usr/lib/libc.so.6
#2 0x00007ffff5beb83d in match_subsystem (udev_enumerate=0x7a05f0, subsystem=0x0) at src/libudev/libudev-enumerate.c:727
#3 0x00007ffff5bebb30 in parent_add_child (enumerate=enumerate@entry=0x7a05f0, path=<optimized out>) at src/libudev/libudev-enumerate.c:834
#4 0x00007ffff5bebc3f in parent_crawl_children (enumerate=enumerate@entry=0x7a05f0, path=0x7a56b0 "/sys/devices/<shortened>/input/input97", maxdepth=maxdepth@entry=254) at src/libudev/libudev-enumerate.c:866
#5 0x00007ffff5bebc54 in parent_crawl_children (enumerate=enumerate@entry=0x7a05f0, path=0x79e8c0 "/sys/devices/<shortened>/input", maxdepth=maxdepth@entry=255) at src/libudev/libudev-enumerate.c:868
#6 0x00007ffff5bebc54 in parent_crawl_children (enumerate=enumerate@entry=0x7a05f0, path=path@entry=0x753190 "/sys/devices/<shortened>", maxdepth=maxdepth@entry=256) at src/libudev/libudev-enumerate.c:868
#7 0x00007ffff5bec7df in scan_devices_children (enumerate=0x7a05f0) at src/libudev/libudev-enumerate.c:882
#8 udev_enumerate_scan_devices (udev_enumerate=udev_enumerate@entry=0x7a05f0) at src/libudev/libudev-enumerate.c:919
#9 0x00007ffff5df8777 in <random_caller> () at some/file.c:181
---
src/libudev/libudev-enumerate.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index 7e63820cba..77f75bfd3a 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -718,6 +718,8 @@ static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *s
{
struct udev_list_entry *list_entry;
+ subsystem = subsystem ? : "";
+
udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) {
if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0)
return false;

View File

@ -0,0 +1,40 @@
From 27b1a19a3c1c42a3af0d3970ca5b5cb5b24c7254 Mon Sep 17 00:00:00 2001
From: Andrew Cook <ariscop@gmail.com>
Date: Wed, 4 Sep 2013 23:27:40 +1000
Subject: [PATCH] systemd-coredump: Ignore coredumps larger than COREDUMP_MAX
Currently this check happens when the coredump has been collected in
it's entirety and being received by journald. this is not ideal
behaviour when the crashing process is consuming significant percentage
of physical memory such as a large instance of firefox or a java
application.
---
src/journal/coredump.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index fd03e389bb..a7d3c34fe4 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -41,7 +41,7 @@
#define COREDUMP_MIN_START (3*1024*1024)
/* Make sure to not make this larger than the maximum journal entry
* size. See ENTRY_SIZE_MAX in journald-native.c. */
-#define COREDUMP_MAX (768*1024*1024)
+#define COREDUMP_MAX (767*1024*1024)
enum {
ARG_PID = 1,
@@ -258,6 +258,12 @@ int main(int argc, char* argv[]) {
break;
coredump_size += n;
+
+ if(coredump_size > COREDUMP_MAX) {
+ log_error("Coredump too large, ignoring");
+ goto finish;
+ }
+
if (!GREEDY_REALLOC(coredump_data, coredump_bufsize, coredump_size + 1)) {
r = log_oom();
goto finish;

View File

@ -0,0 +1,177 @@
From 7d3f06fa516a0eacad9ca9a17c433ca7e4f5876a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 19 Jul 2013 04:02:50 -0400
Subject: [PATCH] journalctl: use _COMM= match for scripts
In case of scripts, _EXE is set to the interpreter name, and
_COMM is set based on the file name. Add a match for _COMM,
and _EXE if the interpreter is not a link (e.g. for yum,
the interpreter is /usr/bin/python, but it is a link to
/usr/bin/python2, which in turn is a link to /usr/bin/python2.7,
at least on Fedora, so we end up with _EXE=/usr/bin/python2.7).
I don't think that such link chasing makes sense, because
the final _EXE name is more likely to change.
---
src/journal/journalctl.c | 30 ++++++++++++++++++++++++++----
src/shared/fileio.c | 29 +++++++++++++++++++++++++++++
src/shared/fileio.h | 2 ++
src/test/test-fileio.c | 35 +++++++++++++++++++++++++++++++++++
4 files changed, 92 insertions(+), 4 deletions(-)
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 409f082276..7fc2c36c7c 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -45,6 +45,7 @@
#include "logs-show.h"
#include "util.h"
#include "path-util.h"
+#include "fileio.h"
#include "build.h"
#include "pager.h"
#include "logs-show.h"
@@ -544,8 +545,9 @@ static int add_matches(sd_journal *j, char **args) {
if (streq(*i, "+"))
r = sd_journal_add_disjunction(j);
else if (path_is_absolute(*i)) {
- _cleanup_free_ char *p, *t = NULL;
+ _cleanup_free_ char *p, *t = NULL, *t2 = NULL;
const char *path;
+ _cleanup_free_ char *interpreter = NULL;
struct stat st;
p = canonicalize_file_name(*i);
@@ -556,9 +558,27 @@ static int add_matches(sd_journal *j, char **args) {
return -errno;
}
- if (S_ISREG(st.st_mode) && (0111 & st.st_mode))
- t = strappend("_EXE=", path);
- else if (S_ISCHR(st.st_mode))
+ if (S_ISREG(st.st_mode) && (0111 & st.st_mode)) {
+ if (executable_is_script(path, &interpreter) > 0) {
+ _cleanup_free_ char *comm;
+
+ comm = strndup(path_get_file_name(path), 15);
+ if (!comm)
+ return log_oom();
+
+ t = strappend("_COMM=", comm);
+
+ /* Append _EXE only if the interpreter is not a link.
+ Otherwise it might be outdated often. */
+ if (lstat(interpreter, &st) == 0 &&
+ !S_ISLNK(st.st_mode)) {
+ t2 = strappend("_EXE=", interpreter);
+ if (!t2)
+ return log_oom();
+ }
+ } else
+ t = strappend("_EXE=", path);
+ } else if (S_ISCHR(st.st_mode))
asprintf(&t, "_KERNEL_DEVICE=c%u:%u", major(st.st_rdev), minor(st.st_rdev));
else if (S_ISBLK(st.st_mode))
asprintf(&t, "_KERNEL_DEVICE=b%u:%u", major(st.st_rdev), minor(st.st_rdev));
@@ -571,6 +591,8 @@ static int add_matches(sd_journal *j, char **args) {
return log_oom();
r = sd_journal_add_match(j, t, 0);
+ if (t2)
+ r = sd_journal_add_match(j, t2, 0);
} else
r = sd_journal_add_match(j, *i, 0);
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index ad068bf30d..90572119d1 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -594,3 +594,32 @@ int write_env_file(const char *fname, char **l) {
return r;
}
+
+int executable_is_script(const char *path, char **interpreter) {
+ int r;
+ char _cleanup_free_ *line = NULL;
+ int len;
+ char *ans;
+
+ assert(path);
+
+ r = read_one_line_file(path, &line);
+ if (r < 0)
+ return r;
+
+ if (!startswith(line, "#!"))
+ return 0;
+
+ ans = strstrip(line + 2);
+ len = strcspn(ans, " \t");
+
+ if (len == 0)
+ return 0;
+
+ ans = strndup(ans, len);
+ if (!ans)
+ return -ENOMEM;
+
+ *interpreter = ans;
+ return 1;
+}
diff --git a/src/shared/fileio.h b/src/shared/fileio.h
index 0ca6878ea4..a0aae28bae 100644
--- a/src/shared/fileio.h
+++ b/src/shared/fileio.h
@@ -35,3 +35,5 @@ int read_full_file(const char *fn, char **contents, size_t *size);
int parse_env_file(const char *fname, const char *separator, ...) _sentinel_;
int load_env_file(const char *fname, const char *separator, char ***l);
int write_env_file(const char *fname, char **l);
+
+int executable_is_script(const char *path, char **interpreter);
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index d56f7cc856..b08e796b7d 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -139,7 +139,42 @@ static void test_parse_env_file(void) {
unlink("/tmp/test-fileio");
}
+static void test_executable_is_script(void) {
+ char t[] = "/tmp/test-executable-XXXXXX";
+ int fd, r;
+ FILE *f;
+ char *command;
+
+ fd = mkostemp(t, O_CLOEXEC);
+ assert_se(fd >= 0);
+
+ f = fdopen(fd, "w");
+ assert_se(f);
+
+ fputs("#! /bin/script -a -b \ngoo goo", f);
+ fflush(f);
+
+ r = executable_is_script(t, &command);
+ assert_se(r > 0);
+ assert_se(streq(command, "/bin/script"));
+ free(command);
+
+ r = executable_is_script("/bin/sh", &command);
+ assert_se(r == 0);
+
+ r = executable_is_script("/usr/bin/yum", &command);
+ assert_se(r > 0 || r == -ENOENT);
+ if (r > 0) {
+ assert_se(startswith(command, "/"));
+ free(command);
+ }
+
+ fclose(f);
+ unlink(t);
+}
+
int main(int argc, char *argv[]) {
test_parse_env_file();
+ test_executable_is_script();
return 0;
}

View File

@ -0,0 +1,121 @@
From c884f73cb754db77632a84830e5a058827d732e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 11 Sep 2013 21:50:16 -0400
Subject: [PATCH] Allow tabs in environment files
bash allows them, and so should we.
string_has_cc is changed to allow tabs, and if they are not wanted,
they must be now checked for explicitly. There are two other callers,
apart from the env file loaders, and one already checked anyway, and
the other is changed to check.
https://bugs.freedesktop.org/show_bug.cgi?id=68592
https://bugs.gentoo.org/show_bug.cgi?id=481554
---
src/hostname/hostnamed.c | 3 ++-
src/shared/util.c | 4 ++++
src/test/test-fileio.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 0437e33a66..6a43aeb840 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -553,7 +553,8 @@ static DBusHandlerResult hostname_message_handler(
* safe than sorry */
if (k == PROP_ICON_NAME && !filename_is_safe(name))
return bus_send_error_reply(connection, message, NULL, -EINVAL);
- if (k == PROP_PRETTY_HOSTNAME && string_has_cc(name))
+ if (k == PROP_PRETTY_HOSTNAME &&
+ (string_has_cc(name) || chars_intersect(name, "\t")))
return bus_send_error_reply(connection, message, NULL, -EINVAL);
if (k == PROP_CHASSIS && !valid_chassis(name))
return bus_send_error_reply(connection, message, NULL, -EINVAL);
diff --git a/src/shared/util.c b/src/shared/util.c
index 673e0da6b6..113133f22a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5264,6 +5264,10 @@ bool string_is_safe(const char *p) {
return true;
}
+/**
+ * Check if a string contains control characters.
+ * Spaces and tabs are not considered control characters.
+ */
bool string_has_cc(const char *p) {
const char *t;
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index b08e796b7d..ce77304108 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -139,6 +139,59 @@ static void test_parse_env_file(void) {
unlink("/tmp/test-fileio");
}
+static void test_parse_multiline_env_file(void) {
+ char t[] = "/tmp/test-fileio-in-XXXXXX",
+ p[] = "/tmp/test-fileio-out-XXXXXX";
+ int fd, r;
+ FILE *f;
+ _cleanup_strv_free_ char **a = NULL, **b = NULL;
+ char **i;
+
+ assert_se(mktemp(p));
+
+ fd = mkostemp(t, O_CLOEXEC);
+ assert_se(fd >= 0);
+
+ f = fdopen(fd, "w");
+ assert_se(f);
+
+ fputs("one=BAR\\\n"
+ " VAR\\\n"
+ "\tGAR\n"
+ "#comment\n"
+ "two=\"bar\\\n"
+ " var\\\n"
+ "\tgar\"\n"
+ "#comment\n"
+ "tri=\"bar \\\n"
+ " var \\\n"
+ "\tgar \"\n", f);
+
+ fflush(f);
+ fclose(f);
+
+ r = load_env_file(t, NULL, &a);
+ assert_se(r >= 0);
+
+ STRV_FOREACH(i, a)
+ log_info("Got: <%s>", *i);
+
+ assert_se(streq(a[0], "one=BAR VAR\tGAR"));
+ assert_se(streq(a[1], "two=bar var\tgar"));
+ assert_se(streq(a[2], "tri=bar var \tgar "));
+ assert_se(a[3] == NULL);
+
+ r = write_env_file(p, a);
+ assert_se(r >= 0);
+
+ r = load_env_file(p, NULL, &b);
+ assert_se(r >= 0);
+
+ unlink(t);
+ unlink(p);
+}
+
+
static void test_executable_is_script(void) {
char t[] = "/tmp/test-executable-XXXXXX";
int fd, r;
@@ -175,6 +228,7 @@ static void test_executable_is_script(void) {
int main(int argc, char *argv[]) {
test_parse_env_file();
+ test_parse_multiline_env_file();
test_executable_is_script();
return 0;
}

View File

@ -0,0 +1,23 @@
From f3e54e0678ed5cf42ce21ef83cf4640889db1f5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 12 Sep 2013 10:03:16 -0400
Subject: [PATCH] Actually allow tabs in environment files
Fixup for ac4c8d6da8b5e.
---
src/shared/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index 113133f22a..c9e9b87228 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5274,7 +5274,7 @@ bool string_has_cc(const char *p) {
assert(p);
for (t = p; *t; t++)
- if (*t > 0 && *t < ' ')
+ if (*t > 0 && *t < ' ' && *t != '\t')
return true;
return false;

View File

@ -0,0 +1,51 @@
From 90c6172bd8c7e40cba714737f5a5f5364dc56084 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Thu, 12 Sep 2013 15:42:24 +0200
Subject: [PATCH] systemctl: process only signals for jobs we really wait for
wait_filter() callback shouldn't process JobRemove signals for arbitrary
jobs. It should only deal with signals for jobs which are included in
set of jobs we wait for.
---
src/systemctl/systemctl.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index e6bd855c15..50f61a3487 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1486,7 +1486,7 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
} else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Manager", "JobRemoved")) {
uint32_t id;
- const char *path, *result, *unit;
+ const char *path, *result, *unit, *r;
if (dbus_message_get_args(message, &error,
DBUS_TYPE_UINT32, &id,
@@ -1495,7 +1495,11 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
DBUS_TYPE_STRING, &result,
DBUS_TYPE_INVALID)) {
- free(set_remove(d->set, (char*) path));
+ r = set_remove(d->set, (char*) path);
+ if (!r)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ free(r);
if (!isempty(result))
d->result = strdup(result);
@@ -1515,7 +1519,11 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
/* Compatibility with older systemd versions <
* 183 during upgrades. This should be dropped
* one day. */
- free(set_remove(d->set, (char*) path));
+ r = set_remove(d->set, (char*) path);
+ if (!r)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ free(r);
if (*result)
d->result = strdup(result);

View File

@ -0,0 +1,27 @@
From fc9783ea51072f062a98f1541481355bac3aee3b Mon Sep 17 00:00:00 2001
From: Brandon Philips <brandon@ifup.co>
Date: Tue, 3 Sep 2013 21:34:02 -0700
Subject: [PATCH] cgtop: fixup the online help
The online help shows the keys as uppercase but the code and manpage say
lower case. Make the online help follow reality.
---
src/cgtop/cgtop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 1e21b0074d..f7d84da107 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -824,9 +824,9 @@ int main(int argc, char *argv[]) {
case '?':
case 'h':
fprintf(stdout,
- "\t<" ON "P" OFF "> By path; <" ON "T" OFF "> By tasks; <" ON "C" OFF "> By CPU; <" ON "M" OFF "> By memory; <" ON "I" OFF "> By I/O\n"
+ "\t<" ON "p" OFF "> By path; <" ON "t" OFF "> By tasks; <" ON "c" OFF "> By CPU; <" ON "m" OFF "> By memory; <" ON "i" OFF "> By I/O\n"
"\t<" ON "+" OFF "> Increase delay; <" ON "-" OFF "> Decrease delay; <" ON "%%" OFF "> Toggle time\n"
- "\t<" ON "Q" OFF "> Quit; <" ON "SPACE" OFF "> Refresh");
+ "\t<" ON "q" OFF "> Quit; <" ON "SPACE" OFF "> Refresh");
fflush(stdout);
sleep(3);
break;

View File

@ -0,0 +1,72 @@
From 06f66abc77fb23c736bad72e8cc8d1ef62167fd3 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 22 Aug 2013 13:55:21 -0400
Subject: [PATCH] polkit: Avoid race condition in scraping /proc
If a calling process execve()s a setuid program, it can appear to be
uid 0. Since we're receiving requests over DBus, avoid this by simply
passing system-bus-name as a subject.
---
src/shared/polkit.c | 31 +++++--------------------------
1 file changed, 5 insertions(+), 26 deletions(-)
diff --git a/src/shared/polkit.c b/src/shared/polkit.c
index cea7074ad3..1c5e9e3e0f 100644
--- a/src/shared/polkit.c
+++ b/src/shared/polkit.c
@@ -38,12 +38,8 @@ int verify_polkit(
#ifdef ENABLE_POLKIT
DBusMessage *m = NULL, *reply = NULL;
- const char *unix_process = "unix-process", *pid = "pid", *starttime = "start-time", *cancel_id = "";
+ const char *system_bus_name = "system-bus-name", *name = "name", *cancel_id = "";
uint32_t flags = interactive ? 1 : 0;
- pid_t pid_raw;
- uint32_t pid_u32;
- unsigned long long starttime_raw;
- uint64_t starttime_u64;
DBusMessageIter iter_msg, iter_struct, iter_array, iter_dict, iter_variant;
int r;
dbus_bool_t authorized = FALSE, challenge = FALSE;
@@ -68,14 +64,6 @@ int verify_polkit(
#ifdef ENABLE_POLKIT
- pid_raw = bus_get_unix_process_id(c, sender, error);
- if (pid_raw == 0)
- return -EINVAL;
-
- r = get_starttime_of_pid(pid_raw, &starttime_raw);
- if (r < 0)
- return r;
-
m = dbus_message_new_method_call(
"org.freedesktop.PolicyKit1",
"/org/freedesktop/PolicyKit1/Authority",
@@ -86,22 +74,13 @@ int verify_polkit(
dbus_message_iter_init_append(m, &iter_msg);
- pid_u32 = (uint32_t) pid_raw;
- starttime_u64 = (uint64_t) starttime_raw;
-
if (!dbus_message_iter_open_container(&iter_msg, DBUS_TYPE_STRUCT, NULL, &iter_struct) ||
- !dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &unix_process) ||
+ !dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &system_bus_name) ||
!dbus_message_iter_open_container(&iter_struct, DBUS_TYPE_ARRAY, "{sv}", &iter_array) ||
!dbus_message_iter_open_container(&iter_array, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict) ||
- !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &pid) ||
- !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "u", &iter_variant) ||
- !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_UINT32, &pid_u32) ||
- !dbus_message_iter_close_container(&iter_dict, &iter_variant) ||
- !dbus_message_iter_close_container(&iter_array, &iter_dict) ||
- !dbus_message_iter_open_container(&iter_array, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict) ||
- !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &starttime) ||
- !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "t", &iter_variant) ||
- !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_UINT64, &starttime_u64) ||
+ !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &name) ||
+ !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "s", &iter_variant) ||
+ !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_STRING, &sender) ||
!dbus_message_iter_close_container(&iter_dict, &iter_variant) ||
!dbus_message_iter_close_container(&iter_array, &iter_dict) ||
!dbus_message_iter_close_container(&iter_struct, &iter_array) ||

View File

@ -0,0 +1,24 @@
From a948167a8cbac5a609b98fe238d2f921de151efa Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Thu, 19 Sep 2013 15:52:31 +0400
Subject: [PATCH] clarify $ escaping in Exec* lines
Explain that literal $ can be passed by doubling it.
---
man/systemd.service.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 0454cf292e..7d32e5dbc2 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -362,7 +362,8 @@
case it will be replaced by the value
of the environment variable split up
at whitespace, resulting in zero or
- more arguments. Note that the first
+ more arguments. To pass literal dollar sign
+ use <literal>$$</literal>. Note that the first
argument (i.e. the program to execute)
may not be a variable, since it must
be a literal and absolute path

View File

@ -0,0 +1,23 @@
From c393e2c64d621ef594ab64329c397aafd35a0a19 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Thu, 19 Sep 2013 11:36:40 -0400
Subject: [PATCH] udev-builtin-blkid: export ID_PART_TABLE_UUID
---
src/udev/udev-builtin-blkid.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
index bae429344f..b48dccc2fb 100644
--- a/src/udev/udev-builtin-blkid.c
+++ b/src/udev/udev-builtin-blkid.c
@@ -67,6 +67,9 @@ static void print_property(struct udev_device *dev, bool test, const char *name,
} else if (streq(name, "PTTYPE")) {
udev_builtin_add_property(dev, test, "ID_PART_TABLE_TYPE", value);
+ } else if (streq(name, "PTUUID")) {
+ udev_builtin_add_property(dev, test, "ID_PART_TABLE_UUID", value);
+
} else if (streq(name, "PART_ENTRY_NAME")) {
blkid_encode_string(value, s, sizeof(s));
udev_builtin_add_property(dev, test, "ID_PART_ENTRY_NAME", s);

View File

@ -0,0 +1,62 @@
From 8dab9d3583dc7446e7df6e34bd640318e671dfd2 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Thu, 19 Sep 2013 14:30:07 -0400
Subject: [PATCH] nspawn: be less liberal about creating bind mount
destinations
Previously, if a file's bind mount destination didn't exist, nspawn
would blindly create a directory, and the subsequent bind mount would
fail. Examine the filetype of the source and ensure that, if the
destination does not exist, that it is created appropriately.
Also go one step further and ensure that the filetypes of the source
and destination match.
---
src/nspawn/nspawn.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 09153c87ce..33aaf145dd 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -419,12 +419,39 @@ static int mount_binds(const char *dest, char **l, unsigned long flags) {
STRV_FOREACH_PAIR(x, y, l) {
_cleanup_free_ char *where = NULL;
+ struct stat source_st, dest_st;
+
+ if (stat(*x, &source_st) < 0) {
+ log_error("failed to stat %s: %m", *x);
+ return -errno;
+ }
where = strjoin(dest, "/", *y, NULL);
if (!where)
return log_oom();
- mkdir_p_label(where, 0755);
+ if (stat(where, &dest_st) == 0) {
+ if ((source_st.st_mode & S_IFMT) != (dest_st.st_mode & S_IFMT)) {
+ log_error("The file types of %s and %s do not matching. Refusing bind mount",
+ *x, where);
+ return -EINVAL;
+ }
+ } else {
+ /* Create the mount point, but be conservative -- refuse to create block
+ * and char devices. */
+ if (S_ISDIR(source_st.st_mode))
+ mkdir_p_label(where, 0755);
+ else if (S_ISFIFO(source_st.st_mode))
+ mkfifo(where, 0644);
+ else if (S_ISSOCK(source_st.st_mode))
+ mknod(where, 0644 | S_IFSOCK, 0);
+ else if (S_ISREG(source_st.st_mode))
+ touch(where);
+ else {
+ log_error("Refusing to create mountpoint for file: %s", *x);
+ return -ENOTSUP;
+ }
+ }
if (mount(*x, where, "bind", MS_BIND, NULL) < 0) {
log_error("mount(%s) failed: %m", where);

View File

@ -0,0 +1,22 @@
From c3576f997b898b4374f4f05a829c2b5c3809b6d7 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Thu, 19 Sep 2013 14:55:35 -0400
Subject: [PATCH] fix grammatical error
---
src/nspawn/nspawn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 33aaf145dd..847ad883b2 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -432,7 +432,7 @@ static int mount_binds(const char *dest, char **l, unsigned long flags) {
if (stat(where, &dest_st) == 0) {
if ((source_st.st_mode & S_IFMT) != (dest_st.st_mode & S_IFMT)) {
- log_error("The file types of %s and %s do not matching. Refusing bind mount",
+ log_error("The file types of %s and %s do not match. Refusing bind mount",
*x, where);
return -EINVAL;
}

View File

@ -0,0 +1,38 @@
From 995cdebf10e2ec67f4bdfcc154661931192e9290 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Thu, 19 Sep 2013 18:00:36 -0400
Subject: [PATCH] completion/systemctl: add missing list-sockets verb
Conflicts:
shell-completion/bash/systemctl
shell-completion/zsh/_systemctl
---
shell-completion/bash/systemctl | 2 +-
shell-completion/systemd-zsh-completion.zsh | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/shell-completion/bash/systemctl b/shell-completion/bash/systemctl
index 191b8d13ec..f1ec99bdd2 100644
--- a/shell-completion/bash/systemctl
+++ b/shell-completion/bash/systemctl
@@ -133,7 +133,7 @@ _systemctl () {
[ENVS]='set-environment unset-environment'
[STANDALONE]='daemon-reexec daemon-reload default dump
emergency exit halt hibernate hybrid-sleep kexec list-jobs
- list-units list-unit-files poweroff reboot rescue
+ list-sockets list-units list-unit-files poweroff reboot rescue
show-environment suspend'
[NAME]='snapshot load'
[FILE]='link'
diff --git a/shell-completion/systemd-zsh-completion.zsh b/shell-completion/systemd-zsh-completion.zsh
index 411646ea59..ff15da6d37 100644
--- a/shell-completion/systemd-zsh-completion.zsh
+++ b/shell-completion/systemd-zsh-completion.zsh
@@ -328,6 +328,7 @@ _outputmodes() {
{
local -a _systemctl_cmds
_systemctl_cmds=(
+ "list-sockets:List sockets"
"list-units:List units"
"start:Start (activate) one or more units"
"stop:Stop (deactivate) one or more units"

View File

@ -0,0 +1,26 @@
From 4afb30fa357af2f82bbfe8e40b8646c72625ffda Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Tue, 24 Sep 2013 14:39:40 -0400
Subject: [PATCH] journalctl(1): s/adm/systemd-journal/
Conflicts:
man/journalctl.xml
---
man/journalctl.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/man/journalctl.xml b/man/journalctl.xml
index cc7d1a0533..5bacf3297f 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -103,8 +103,8 @@
system itself or are accessible user journals.</para>
<para>All users are granted access to their private
- per-user journals. However, by default only root and
- users who are members of the <literal>adm</literal>
+ per-user journals. However, by default, only root and
+ users who are members of the <literal>systemd-journal</literal>
group get access to the system journal and the
journals of other users.</para>
</refsect1>

View File

@ -0,0 +1,69 @@
From 1691769c56255ce939fea32f83845d4862d7b198 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 19 Sep 2013 16:57:57 -0500
Subject: [PATCH] journald: accept EPOLLERR from /dev/kmsg
Also print out unexpected epoll events explictly.
---
src/journal/journald-server.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 5813699b85..6c03a0d9c3 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -977,7 +977,8 @@ int process_event(Server *s, struct epoll_event *ev) {
ssize_t n;
if (ev->events != EPOLLIN) {
- log_error("Got invalid event from epoll.");
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
+ "signal fd", ev->events);
return -EIO;
}
@@ -1026,8 +1027,12 @@ int process_event(Server *s, struct epoll_event *ev) {
} else if (ev->data.fd == s->dev_kmsg_fd) {
int r;
- if (ev->events != EPOLLIN) {
- log_error("Got invalid event from epoll.");
+ if (ev->events & EPOLLERR)
+ log_warning("/dev/kmsg buffer overrun, some messages lost.");
+
+ if (!(ev->events & EPOLLIN)) {
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
+ "/dev/kmsg", ev->events);
return -EIO;
}
@@ -1041,7 +1046,9 @@ int process_event(Server *s, struct epoll_event *ev) {
ev->data.fd == s->syslog_fd) {
if (ev->events != EPOLLIN) {
- log_error("Got invalid event from epoll.");
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
+ ev->data.fd == s->native_fd ? "native fd" : "syslog fd",
+ ev->events);
return -EIO;
}
@@ -1169,7 +1176,8 @@ int process_event(Server *s, struct epoll_event *ev) {
} else if (ev->data.fd == s->stdout_fd) {
if (ev->events != EPOLLIN) {
- log_error("Got invalid event from epoll.");
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
+ "stdout fd", ev->events);
return -EIO;
}
@@ -1180,6 +1188,8 @@ int process_event(Server *s, struct epoll_event *ev) {
StdoutStream *stream;
if ((ev->events|EPOLLIN|EPOLLHUP) != (EPOLLIN|EPOLLHUP)) {
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
+ "stdout stream", ev->events);
log_error("Got invalid event from epoll.");
return -EIO;
}

View File

@ -0,0 +1,23 @@
From 9732761d497432ef7436e8aaa12dec68bdfaa684 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 26 Sep 2013 20:31:37 +0200
Subject: [PATCH] logind: if a user is sitting in front of the computer and can
shutdown the machine anyway he should also be able to reboot it
---
src/login/org.freedesktop.login1.policy.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/login/org.freedesktop.login1.policy.in b/src/login/org.freedesktop.login1.policy.in
index 0c551d4f9b..b96d32d526 100644
--- a/src/login/org.freedesktop.login1.policy.in
+++ b/src/login/org.freedesktop.login1.policy.in
@@ -190,7 +190,7 @@
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
- <allow_active>auth_admin_keep</allow_active>
+ <allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.reboot</annotate>
</action>

View File

@ -0,0 +1,22 @@
From e851b89255688c58577ecc39f7088221a6e93f00 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 27 Sep 2013 00:35:36 +0200
Subject: [PATCH] dbus: fix introspection for TimerSlackNSec
---
src/core/dbus-execute.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/dbus-execute.h b/src/core/dbus-execute.h
index 91d70e535f..698102f01e 100644
--- a/src/core/dbus-execute.h
+++ b/src/core/dbus-execute.h
@@ -63,7 +63,7 @@
" <property name=\"CPUSchedulingPolicy\" type=\"i\" access=\"read\"/>\n" \
" <property name=\"CPUSchedulingPriority\" type=\"i\" access=\"read\"/>\n" \
" <property name=\"CPUAffinity\" type=\"ay\" access=\"read\"/>\n" \
- " <property name=\"TimerSlackNS\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"TimerSlackNSec\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"CPUSchedulingResetOnFork\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"NonBlocking\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"StandardInput\" type=\"s\" access=\"read\"/>\n" \

View File

@ -0,0 +1,21 @@
From aa1e724469c882478fd4f3fd31acdffb820d4fa1 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 27 Sep 2013 02:02:21 +0200
Subject: [PATCH] swap: properly expose timeout property on the bus
---
src/core/dbus-swap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/core/dbus-swap.c b/src/core/dbus-swap.c
index 2e99fba7db..e72749addc 100644
--- a/src/core/dbus-swap.c
+++ b/src/core/dbus-swap.c
@@ -93,6 +93,7 @@ static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_swap_append_swap_result, swap_result,
static const BusProperty bus_swap_properties[] = {
{ "What", bus_property_append_string, "s", offsetof(Swap, what), true },
{ "Priority", bus_swap_append_priority, "i", 0 },
+ { "TimeoutUSec",bus_property_append_usec, "t", offsetof(Swap, timeout_usec)},
BUS_EXEC_COMMAND_PROPERTY("ExecActivate", offsetof(Swap, exec_command[SWAP_EXEC_ACTIVATE]), false),
BUS_EXEC_COMMAND_PROPERTY("ExecDeactivate", offsetof(Swap, exec_command[SWAP_EXEC_DEACTIVATE]), false),
{ "ControlPID", bus_property_append_pid, "u", offsetof(Swap, control_pid) },

View File

@ -0,0 +1,23 @@
From 3a6e57e5d611bc44521df25669f07de5e6e3f073 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 27 Sep 2013 07:58:57 +0200
Subject: [PATCH] Remove duplicated line
Conflicts:
src/core/load-fragment.c
---
src/journal/journald-server.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 6c03a0d9c3..8a9957c655 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1190,7 +1190,6 @@ int process_event(Server *s, struct epoll_event *ev) {
if ((ev->events|EPOLLIN|EPOLLHUP) != (EPOLLIN|EPOLLHUP)) {
log_error("Got invalid event from epoll for %s: %"PRIx32,
"stdout stream", ev->events);
- log_error("Got invalid event from epoll.");
return -EIO;
}

View File

@ -0,0 +1,26 @@
From 403c467739a1a1c2bb66454582bcb6a4870adaef Mon Sep 17 00:00:00 2001
From: Michael Scherer <misc@zarb.org>
Date: Fri, 27 Sep 2013 11:43:28 +0200
Subject: [PATCH] Add a bit more explicit message, to help confused users
Seeing http://www.happyassassin.net/2013/09/27/further-sysadmin-adventures-wheres-my-freeipa-badge/
it seems that the default message is a bit confusing for people
who never encountered it before, so adding a link to the manpage could
help them.
Conflicts:
tmpfiles.d/systemd.conf
---
tmpfiles.d/systemd.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tmpfiles.d/systemd.conf b/tmpfiles.d/systemd.conf
index ee86f2ebce..fcda00f426 100644
--- a/tmpfiles.d/systemd.conf
+++ b/tmpfiles.d/systemd.conf
@@ -21,4 +21,4 @@ d /run/systemd/sessions 0755 root root -
d /run/systemd/users 0755 root root -
d /run/systemd/shutdown 0755 root root -
-F /run/nologin 0644 - - - "System is booting up."
+F /run/nologin 0644 - - - "System is booting up. See pam_nologin(8)"

View File

@ -0,0 +1,140 @@
From 3e5bd73528675367c70f09cd5a55776bd978ebf0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 29 Sep 2013 14:40:58 +0200
Subject: [PATCH] Fix buffer overrun when enumerating files
https://bugs.freedesktop.org/show_bug.cgi?id=69887
Based-on-a-patch-by: Hans Petter Jansson <hpj@copyleft.no>
Conflicts:
src/test/test-util.c
---
src/shared/util.c | 79 ++++++++++++++++++-------------------------------------
1 file changed, 26 insertions(+), 53 deletions(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index c9e9b87228..eb9b0f7e92 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4388,38 +4388,31 @@ int dirent_ensure_type(DIR *d, struct dirent *de) {
}
int in_search_path(const char *path, char **search) {
- char **i, *parent;
+ char **i;
+ _cleanup_free_ char *parent = NULL;
int r;
r = path_get_parent(path, &parent);
if (r < 0)
return r;
- r = 0;
-
- STRV_FOREACH(i, search) {
- if (path_equal(parent, *i)) {
- r = 1;
- break;
- }
- }
-
- free(parent);
+ STRV_FOREACH(i, search)
+ if (path_equal(parent, *i))
+ return 1;
- return r;
+ return 0;
}
int get_files_in_directory(const char *path, char ***list) {
- DIR *d;
- int r = 0;
- unsigned n = 0;
- char **l = NULL;
+ _cleanup_closedir_ DIR *d = NULL;
+ size_t bufsize = 0, n = 0;
+ _cleanup_strv_free_ char **l = NULL;
assert(path);
/* Returns all files in a directory in *list, and the number
* of files as return value. If list is NULL returns only the
- * number */
+ * number. */
d = opendir(path);
if (!d)
@@ -4431,11 +4424,9 @@ int get_files_in_directory(const char *path, char ***list) {
int k;
k = readdir_r(d, &buf.de, &de);
- if (k != 0) {
- r = -k;
- goto finish;
- }
-
+ assert(k >= 0);
+ if (k > 0)
+ return -k;
if (!de)
break;
@@ -4445,43 +4436,25 @@ int get_files_in_directory(const char *path, char ***list) {
continue;
if (list) {
- if ((unsigned) r >= n) {
- char **t;
-
- n = MAX(16, 2*r);
- t = realloc(l, sizeof(char*) * n);
- if (!t) {
- r = -ENOMEM;
- goto finish;
- }
-
- l = t;
- }
-
- assert((unsigned) r < n);
+ /* one extra slot is needed for the terminating NULL */
+ if (!GREEDY_REALLOC(l, bufsize, n + 2))
+ return -ENOMEM;
- l[r] = strdup(de->d_name);
- if (!l[r]) {
- r = -ENOMEM;
- goto finish;
- }
+ l[n] = strdup(de->d_name);
+ if (!l[n])
+ return -ENOMEM;
- l[++r] = NULL;
+ l[++n] = NULL;
} else
- r++;
+ n++;
}
-finish:
- if (d)
- closedir(d);
-
- if (r >= 0) {
- if (list)
- *list = l;
- } else
- strv_free(l);
+ if (list) {
+ *list = l;
+ l = NULL; /* avoid freeing */
+ }
- return r;
+ return n;
}
char *strjoin(const char *x, ...) {

View File

@ -0,0 +1,27 @@
From 7596e64d662085ea57eb51a3f4d9a6146d0bd864 Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sun, 29 Sep 2013 15:37:30 +0400
Subject: [PATCH] set IgnoreOnIsolate=true for systemd-cryptsetup@.service
When crypttab contains noauto, cryptsetup service does not have any
explicit dependencies. If service is started later manually (directly or via
mount dependency) it will be stopped on isolate.
mount units already have IgnoreOnIsolate set by default. Set it by
default for cryptsetup units as well.
---
src/cryptsetup/cryptsetup-generator.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 81b770890a..edd0b40318 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -111,6 +111,7 @@ static int create_disk(
"Conflicts=umount.target\n"
"DefaultDependencies=no\n"
"BindsTo=dev-mapper-%i.device\n"
+ "IgnoreOnIsolate=true\n"
"After=systemd-readahead-collect.service systemd-readahead-replay.service\n",
f);

View File

@ -0,0 +1,21 @@
From 3fecc95e6a11f04f8e63ad594ff28f181bfb1aee Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 30 Sep 2013 18:56:34 +0200
Subject: [PATCH] man: mention the systemd homepage from systemd(1)
---
man/systemd.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/man/systemd.xml b/man/systemd.xml
index d009ed8e1c..8b03417bd4 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -1258,6 +1258,7 @@
<refsect1>
<title>See Also</title>
<para>
+ The <ulink url="http://www.freedesktop.org/wiki/Software/systemd/">systemd Homepage</ulink>,
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>locale.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,

View File

@ -0,0 +1,21 @@
From 5c6fa27f02690457f0865bfe31e8c3b5ffdee39c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 1 Oct 2013 00:06:48 +0200
Subject: [PATCH] main: don't free fds array twice
---
src/core/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/core/main.c b/src/core/main.c
index 7fc06bea05..954b480fd3 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1650,6 +1650,7 @@ int main(int argc, char *argv[]) {
/* This will close all file descriptors that were opened, but
* not claimed by any unit. */
fdset_free(fds);
+ fds = NULL;
if (serialization) {
fclose(serialization);

View File

@ -0,0 +1,25 @@
From 40d128581e8a836cd88b82ddab794da9dde206f8 Mon Sep 17 00:00:00 2001
From: Patrick McCarty <patrick.mccarty@linux.intel.com>
Date: Mon, 30 Sep 2013 17:43:38 -0700
Subject: [PATCH] smack-setup: fix path to Smack/CIPSO mappings
The correct path to the dir with CIPSO mappings is /etc/smack/cipso.d/;
/etc/smack/cipso is a file that can include these mappings as well,
though it is no longer supported in upstream libsmack.
---
src/core/smack-setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
index 73eeb04190..d203a30aaf 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
@@ -40,7 +40,7 @@
#include "label.h"
#define SMACK_CONFIG "/etc/smack/accesses.d/"
-#define CIPSO_CONFIG "/etc/smack/cipso/"
+#define CIPSO_CONFIG "/etc/smack/cipso.d/"
static int write_rules(const char* dstpath, const char* srcdir) {
_cleanup_fclose_ FILE *dst = NULL;

View File

@ -0,0 +1,40 @@
From e543e472c3ed1a02257bf33a434e45dc6ca7cc07 Mon Sep 17 00:00:00 2001
From: Chen Jie <chenj@lemote.com>
Date: Thu, 12 Sep 2013 09:21:41 +0800
Subject: [PATCH] util.c: ignore pollfd.revent for loop_read/loop_write
Let read()/write() report any error/EOF.
---
src/shared/util.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index eb9b0f7e92..1b35c54c75 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2193,8 +2193,10 @@ ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) {
return n > 0 ? n : -errno;
}
- if (pollfd.revents != POLLIN)
- return n > 0 ? n : -EIO;
+ /* We knowingly ignore the revents value here,
+ * and expect that any error/EOF is reported
+ * via read()/write()
+ */
continue;
}
@@ -2241,8 +2243,10 @@ ssize_t loop_write(int fd, const void *buf, size_t nbytes, bool do_poll) {
return n > 0 ? n : -errno;
}
- if (pollfd.revents != POLLOUT)
- return n > 0 ? n : -EIO;
+ /* We knowingly ignore the revents value here,
+ * and expect that any error/EOF is reported
+ * via read()/write()
+ */
continue;
}

View File

@ -0,0 +1,33 @@
From 915491b8cd7af22bad97ad3dfc5eacd4db810af1 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:36:28 +0200
Subject: [PATCH] cryptsetup: fix OOM handling when parsing mount options
Conflicts:
src/cryptsetup/cryptsetup.c
---
src/cryptsetup/cryptsetup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 347394db8e..c75b7458de 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -70,7 +70,7 @@ static int parse_one_option(const char *option) {
t = strdup(option+7);
if (!t)
- return -ENOMEM;
+ return log_oom();
free(opt_cipher);
opt_cipher = t;
@@ -101,7 +101,7 @@ static int parse_one_option(const char *option) {
t = strdup(option+5);
if (!t)
- return -ENOMEM;
+ return log_oom();
free(opt_hash);
opt_hash = t;

View File

@ -0,0 +1,22 @@
From 4bee17817b81c4f8772d7c79f1e07d86181f52ba Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:36:43 +0200
Subject: [PATCH] journald: add missing error check
---
src/journal/journal-file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 38499a6881..bb8090588c 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -907,6 +907,8 @@ static int journal_file_append_field(
osize = offsetof(Object, field.payload) + size;
r = journal_file_append_object(f, OBJECT_FIELD, osize, &o, &p);
+ if (r < 0)
+ return r;
o->field.hash = htole64(hash);
memcpy(o->field.payload, field, size);

View File

@ -0,0 +1,27 @@
From 5625c498c41fbc4ae0f7861a98a2eef834ce4f8c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:37:30 +0200
Subject: [PATCH] dbus: fix return value of dispatch_rqueue()
---
src/libsystemd-bus/sd-bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 7d6d848ec5..b0eb2f1aed 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1088,11 +1088,11 @@ static int dispatch_rqueue(sd_bus *bus, sd_bus_message **m) {
if (r == 0)
return ret;
- r = 1;
+ ret = 1;
} while (!z);
*m = z;
- return 1;
+ return ret;
}
int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) {

View File

@ -0,0 +1,24 @@
From f29767aea11dfc79ca46edc5701e131f84c496ae Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:37:44 +0200
Subject: [PATCH] modules-load: fix error handling
---
src/modules-load/modules-load.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index 7b19ee02ef..49ee4203dd 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -302,8 +302,8 @@ int main(int argc, char *argv[]) {
STRV_FOREACH(i, arg_proc_cmdline_modules) {
k = load_module(ctx, *i);
- if (k < 0)
- r = EXIT_FAILURE;
+ if (k < 0 && r == 0)
+ r = k;
}
r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs);

View File

@ -0,0 +1,23 @@
From 503283556cdb9c2ae0b3e0bf219f870e0f7d44dd Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:38:09 +0200
Subject: [PATCH] efi: never call qsort on potentially NULL arrays
---
src/shared/efivars.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 8d004bad33..99340c9751 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -383,7 +383,8 @@ int efi_get_boot_options(uint16_t **options) {
list[count ++] = id;
}
- qsort(list, count, sizeof(uint16_t), cmp_uint16);
+ if (list)
+ qsort(list, count, sizeof(uint16_t), cmp_uint16);
*options = list;
return count;

View File

@ -0,0 +1,24 @@
From 99d90921089449abe54b960636a0193c266085d3 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:38:28 +0200
Subject: [PATCH] strv: don't access potentially NULL string arrays
---
src/shared/env-util.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/shared/env-util.c b/src/shared/env-util.c
index 6a52fb960d..598222c5b9 100644
--- a/src/shared/env-util.c
+++ b/src/shared/env-util.c
@@ -406,7 +406,9 @@ char **strv_env_clean_log(char **e, const char *message) {
e[k++] = *p;
}
- e[k] = NULL;
+ if (e)
+ e[k] = NULL;
+
return e;
}

View File

@ -0,0 +1,242 @@
From ecf8adc9117d139d849a062839ad7a20de4d0010 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 2 Oct 2013 13:23:10 +0200
Subject: [PATCH] execute.c: always set $SHELL
In e6dca81 $SHELL was added to user@.service. Let's
instead provide it to all units which have a user.
Conflicts:
TODO
man/systemd.exec.xml
---
man/systemd.exec.xml | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++
src/core/execute.c | 56 ++++++++--------------
2 files changed, 148 insertions(+), 37 deletions(-)
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index b3e0287d72..34bbdb283a 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -1248,6 +1248,135 @@
</refsect1>
<refsect1>
+ <title>Environment variables in spawned processes</title>
+
+ <para>Processes started by the system are executed in
+ a clean environment in which select variables
+ listed below are set. System processes started by systemd
+ do not inherit variables from PID 1, but processes
+ started by user systemd instances inherit all
+ environment variables from the user systemd instance.
+ </para>
+
+ <variablelist class='environment-variables'>
+ <varlistentry>
+ <term><varname>$PATH</varname></term>
+
+ <listitem><para>Colon-separated list
+ of directiories to use when launching
+ executables. Systemd uses a fixed
+ value of
+ <filename>/usr/local/sbin</filename>:<filename>/usr/local/bin</filename>:<filename>/usr/sbin</filename>:<filename>/usr/bin</filename>:<filename>/sbin</filename>:<filename>/bin</filename>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>$LANG</varname></term>
+
+ <listitem><para>Locale. Can be set in
+ <citerefentry><refentrytitle>locale.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ or on the kernel command line (see
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ and
+ <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>).
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>$USER</varname></term>
+ <term><varname>$LOGNAME</varname></term>
+ <term><varname>$HOME</varname></term>
+ <term><varname>$SHELL</varname></term>
+
+ <listitem><para>User name (twice), home
+ directory, and the login shell.
+ Set for the units which
+ have <varname>User=</varname> set,
+ which includes user
+ <command>systemd</command> instances.
+ See
+ <citerefentry><refentrytitle>passwd</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>$XDG_RUNTIME_DIR</varname></term>
+
+ <listitem><para>The directory for volatile
+ state. Set for the user <command>systemd</command>
+ instance, and also in user sessions.
+ See
+ <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>$XDG_SESSION_ID</varname></term>
+ <term><varname>$XDG_SEAT</varname></term>
+ <term><varname>$XDG_VTNR</varname></term>
+
+ <listitem><para>The identifier of the
+ session, and the seat name, and
+ virtual terminal of the session. Set
+ by
+ <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ for login sessions.
+ <varname>$XDG_SEAT</varname> and
+ <varname>$XDG_VTNR</varname> will be
+ only set when attached to a seat and a
+ tty.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>$MANAGERPID</varname></term>
+
+ <listitem><para>The PID of the user
+ <command>systemd</command> instance,
+ set for processes spawned by it.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>$LISTEN_FDS</varname></term>
+ <term><varname>$LISTEN_PID</varname></term>
+
+ <listitem><para>Information about file
+ descriptors passed to a service for
+ socket activation. See
+ <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>$TERM</varname></term>
+
+ <listitem><para>Terminal type, set
+ only for units connected to a terminal
+ (<varname>StandardInput=tty</varname>,
+ <varname>StandardOutput=tty</varname>,
+ or
+ <varname>StandardError=tty</varname>).
+ See
+ <citerefentry><refentrytitle>termcap</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>Additional variables may be configured by the
+ following means: for processes spawned in specific
+ units, use the <varname>Environment=</varname> and
+ <varname>EnvironmentFile=</varname> options above; to
+ specify variables globally, use
+ <varname>DefaultEnvironment=</varname> (see
+ <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
+ or the kernel option
+ <varname>systemd.setenv=</varname> (see
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>). Additional
+ variables may also be set through PAM,
+ c.f. <citerefentry><refentrytitle>pam_env</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+ </refsect1>
+
+ <refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
diff --git a/src/core/execute.c b/src/core/execute.c
index 3959ef9623..27f88b9e5c 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1066,7 +1066,7 @@ int exec_spawn(ExecCommand *command,
if (pid == 0) {
int i, err;
sigset_t ss;
- const char *username = NULL, *home = NULL;
+ const char *username = NULL, *home = NULL, *shell = NULL;
uid_t uid = (uid_t) -1;
gid_t gid = (gid_t) -1;
_cleanup_strv_free_ char **our_env = NULL, **pam_env = NULL,
@@ -1256,7 +1256,7 @@ int exec_spawn(ExecCommand *command,
if (context->user) {
username = context->user;
- err = get_user_creds(&username, &uid, &gid, &home, NULL);
+ err = get_user_creds(&username, &uid, &gid, &home, &shell);
if (err < 0) {
r = EXIT_USER;
goto fail_child;
@@ -1454,46 +1454,28 @@ int exec_spawn(ExecCommand *command,
}
}
- our_env = new0(char*, 7);
- if (!our_env) {
+ our_env = new(char*, 8);
+ if (!our_env ||
+ (n_fds > 0 && (
+ asprintf(our_env + n_env++, "LISTEN_PID=%lu", (unsigned long) getpid()) < 0 ||
+ asprintf(our_env + n_env++, "LISTEN_FDS=%u", n_fds) < 0)) ||
+ (home && asprintf(our_env + n_env++, "HOME=%s", home) < 0) ||
+ (username && (
+ asprintf(our_env + n_env++, "LOGNAME=%s", username) < 0 ||
+ asprintf(our_env + n_env++, "USER=%s", username) < 0)) ||
+ (shell && asprintf(our_env + n_env++, "SHELL=%s", shell) < 0) ||
+ ((is_terminal_input(context->std_input) ||
+ context->std_output == EXEC_OUTPUT_TTY ||
+ context->std_error == EXEC_OUTPUT_TTY) && (
+ !(our_env[n_env++] = strdup(default_term_for_tty(tty_path(context))))))) {
+
err = -ENOMEM;
r = EXIT_MEMORY;
goto fail_child;
}
- if (n_fds > 0)
- if (asprintf(our_env + n_env++, "LISTEN_PID=%lu", (unsigned long) getpid()) < 0 ||
- asprintf(our_env + n_env++, "LISTEN_FDS=%u", n_fds) < 0) {
- err = -ENOMEM;
- r = EXIT_MEMORY;
- goto fail_child;
- }
-
- if (home)
- if (asprintf(our_env + n_env++, "HOME=%s", home) < 0) {
- err = -ENOMEM;
- r = EXIT_MEMORY;
- goto fail_child;
- }
-
- if (username)
- if (asprintf(our_env + n_env++, "LOGNAME=%s", username) < 0 ||
- asprintf(our_env + n_env++, "USER=%s", username) < 0) {
- err = -ENOMEM;
- r = EXIT_MEMORY;
- goto fail_child;
- }
-
- if (is_terminal_input(context->std_input) ||
- context->std_output == EXEC_OUTPUT_TTY ||
- context->std_error == EXEC_OUTPUT_TTY)
- if (!(our_env[n_env++] = strdup(default_term_for_tty(tty_path(context))))) {
- err = -ENOMEM;
- r = EXIT_MEMORY;
- goto fail_child;
- }
-
- assert(n_env <= 7);
+ our_env[n_env++] = NULL;
+ assert(n_env <= 8);
final_env = strv_env_merge(5,
environment,

View File

@ -0,0 +1,42 @@
From 6577f5c40ced5cd57dd92c1fd2ce65bf2bdead98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= <vpavlin@redhat.com>
Date: Thu, 3 Oct 2013 15:47:26 +0200
Subject: [PATCH] man: Improve the description of parameter X in tmpfiles.d
page
---
man/tmpfiles.d.xml | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml
index 519f9bc618..f84d17453e 100644
--- a/man/tmpfiles.d.xml
+++ b/man/tmpfiles.d.xml
@@ -168,15 +168,18 @@ L /tmp/foobar - - - - /dev/null</programlisting>
<varlistentry>
<term><varname>X</varname></term>
<listitem><para>Ignore a path
- during cleanup. Use this type
- to prevent path removal as
- controlled with the Age parameter.
- Note that if path is a directory,
- content of a directory is not
- excluded from clean-up, only
- directory itself. Lines of this
- type accept shell-style globs
- in place of normal path
+ during cleaning. Use this type
+ to exclude paths from clean-up
+ as controlled with the Age
+ parameter. Unlike x this
+ parameter will not exclude the
+ content if path is a directory,
+ but only directory itself.
+ Note that lines of this type do
+ not influence the effect of r
+ or R lines. Lines of this type
+ accept shell-style globs in
+ place of normal path
names.</para></listitem>
</varlistentry>

View File

@ -0,0 +1,38 @@
From bed59840a1fbac42d72dd4e324537a08c827ce9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 3 Oct 2013 22:15:08 -0400
Subject: [PATCH] systemd: order remote mounts from mountinfo before
remote-fs.target
Usually the network is stopped before filesystems are umounted.
Ordering network filesystems before remote-fs.target means that their
unmounting will be performed earlier, and can terminate sucessfully.
https://bugs.freedesktop.org/show_bug.cgi?id=70002
---
src/core/mount.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/core/mount.c b/src/core/mount.c
index 10073b50be..8777b47ca9 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1508,6 +1508,9 @@ static int mount_add_one(
u = manager_get_unit(m, e);
if (!u) {
+ const char* const target =
+ fstype_is_network(fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
+
delete = true;
u = unit_new(m, sizeof(Mount));
@@ -1534,7 +1537,7 @@ static int mount_add_one(
goto fail;
}
- r = unit_add_dependency_by_name(u, UNIT_BEFORE, SPECIAL_LOCAL_FS_TARGET, NULL, true);
+ r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true);
if (r < 0)
goto fail;

View File

@ -0,0 +1,42 @@
From 98f452c534f242359dc2fbc1cc07347c3577406c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 4 Oct 2013 17:01:37 +0200
Subject: [PATCH] manager: when verifying whether clients may change
environment using selinux check for "reload" rather "reboot"
This appears to be a copy/paste error.
---
src/core/dbus-manager.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 56b02a1cf5..2b6d799965 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1550,7 +1550,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
_cleanup_strv_free_ char **l = NULL;
char **e = NULL;
- SELINUX_ACCESS_CHECK(connection, message, "reboot");
+ SELINUX_ACCESS_CHECK(connection, message, "reload");
r = bus_parse_strv(message, &l);
if (r == -ENOMEM)
@@ -1577,7 +1577,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
_cleanup_strv_free_ char **l = NULL;
char **e = NULL;
- SELINUX_ACCESS_CHECK(connection, message, "reboot");
+ SELINUX_ACCESS_CHECK(connection, message, "reload");
r = bus_parse_strv(message, &l);
if (r == -ENOMEM)
@@ -1605,7 +1605,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
char **f = NULL;
DBusMessageIter iter;
- SELINUX_ACCESS_CHECK(connection, message, "reboot");
+ SELINUX_ACCESS_CHECK(connection, message, "reload");
if (!dbus_message_iter_init(message, &iter))
goto oom;

View File

@ -0,0 +1,207 @@
From 2dfa0e9ba6155b99547fde3b386f135696673e89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 13 Sep 2013 19:41:52 -0400
Subject: [PATCH] Advertise hibernation only if there's enough free swap
Condition that is checked is taken from upower:
active(anon) < free swap * 0.98
This is really stupid, because the kernel knows the situation better,
e.g. there could be two swap files, and then hibernation would be
impossible despite passing this check, or the kernel could start
supporting compressed swap and/or compressed hibernation images, and
then this this check would be too stringent. Nevertheless, until
we have something better, this should at least return a true negative
if there's no swap.
Logging of capabilities in the journal is changed to not strip leading
zeros. I consider this more readable anyway.
http://cgit.freedesktop.org/upower/tree/src/up-daemon.c#n613
https://bugzilla.redhat.com/show_bug.cgi?id=1007059
Conflicts:
src/shared/logs-show.c
src/shared/util.c
---
src/shared/fileio.c | 34 ++++++++++++++++++++++++++++++++++
src/shared/fileio.h | 2 ++
src/shared/sleep-config.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
src/test/test-fileio.c | 20 ++++++++++++++++++++
src/test/test-sleep.c | 16 ++++++++--------
5 files changed, 108 insertions(+), 9 deletions(-)
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 90572119d1..62920cc600 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -623,3 +623,37 @@ int executable_is_script(const char *path, char **interpreter) {
*interpreter = ans;
return 1;
}
+
+/**
+ * Retrieve one field from a file like /proc/self/status.
+ * pattern should start with '\n' and end with ':'. Whitespace
+ * after ':' will be skipped. field must be freed afterwards.
+ */
+int get_status_field(const char *filename, const char *pattern, char **field) {
+ _cleanup_free_ char *status = NULL;
+ char *t;
+ size_t len;
+ int r;
+
+ assert(filename);
+ assert(field);
+
+ r = read_full_file(filename, &status, NULL);
+ if (r < 0)
+ return r;
+
+ t = strstr(status, pattern);
+ if (!t)
+ return -ENOENT;
+
+ t += strlen(pattern);
+ t += strspn(t, WHITESPACE);
+
+ len = strcspn(t, WHITESPACE);
+
+ *field = strndup(t, len);
+ if (!*field)
+ return -ENOMEM;
+
+ return 0;
+}
diff --git a/src/shared/fileio.h b/src/shared/fileio.h
index a0aae28bae..59e41502b1 100644
--- a/src/shared/fileio.h
+++ b/src/shared/fileio.h
@@ -37,3 +37,5 @@ int load_env_file(const char *fname, const char *separator, char ***l);
int write_env_file(const char *fname, char **l);
int executable_is_script(const char *path, char **interpreter);
+
+int get_status_field(const char *filename, const char *pattern, char **field);
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index cd3238b405..5ec7cce458 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -163,6 +163,46 @@ int can_sleep_disk(char **types) {
return false;
}
+#define HIBERNATION_SWAP_THRESHOLD 0.98
+
+static bool enough_memory_for_hibernation(void) {
+ _cleanup_free_ char *active = NULL, *swapfree = NULL;
+ unsigned long long act, swap;
+ int r;
+
+ r = get_status_field("/proc/meminfo", "\nSwapFree:", &swapfree);
+ if (r < 0) {
+ log_error("Failed to retrieve SwapFree from /proc/meminfo: %s", strerror(-r));
+ return false;
+ }
+
+ r = safe_atollu(swapfree, &swap);
+ if (r < 0) {
+ log_error("Failed to parse SwapFree from /proc/meminfo: %s: %s",
+ swapfree, strerror(-r));
+ return false;
+ }
+
+ r = get_status_field("/proc/meminfo", "\nActive(anon):", &active);
+ if (r < 0) {
+ log_error("Failed to retrieve Active(anon) from /proc/meminfo: %s", strerror(-r));
+ return false;
+ }
+
+ r = safe_atollu(active, &act);
+ if (r < 0) {
+ log_error("Failed to parse Active(anon) from /proc/meminfo: %s: %s",
+ active, strerror(-r));
+ return false;
+ }
+
+ r = act <= swap * HIBERNATION_SWAP_THRESHOLD;
+ log_debug("Hibernation is %spossible, Active(anon)=%llu kB, SwapFree=%llu kB, threshold=%.2g%%",
+ r ? "" : "im", act, swap, 100*HIBERNATION_SWAP_THRESHOLD);
+
+ return r;
+}
+
int can_sleep(const char *verb) {
_cleanup_strv_free_ char **modes = NULL, **states = NULL;
int r;
@@ -175,5 +215,8 @@ int can_sleep(const char *verb) {
if (r < 0)
return false;
- return can_sleep_state(states) && can_sleep_disk(modes);
+ if (!can_sleep_state(states) || !can_sleep_disk(modes))
+ return false;
+
+ return streq(verb, "suspend") || enough_memory_for_hibernation();
}
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index ce77304108..6c10d9f1fb 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -226,9 +226,29 @@ static void test_executable_is_script(void) {
unlink(t);
}
+static void test_status_field(void) {
+ _cleanup_free_ char *t = NULL, *p = NULL, *s = NULL;
+ unsigned long long total, buffers;
+
+ assert_se(get_status_field("/proc/self/status", "\nThreads:", &t) == 0);
+ puts(t);
+ assert_se(streq(t, "1"));
+
+ assert_se(get_status_field("/proc/meminfo", "MemTotal:", &p) == 0);
+ puts(p);
+ assert_se(safe_atollu(p, &total) == 0);
+
+ assert_se(get_status_field("/proc/meminfo", "\nBuffers:", &s) == 0);
+ puts(s);
+ assert_se(safe_atollu(s, &buffers) == 0);
+
+ assert(buffers < total);
+}
+
int main(int argc, char *argv[]) {
test_parse_env_file();
test_parse_multiline_env_file();
test_executable_is_script();
+ test_status_field();
return 0;
}
diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c
index c3cb9c531d..545dfab92c 100644
--- a/src/test/test-sleep.c
+++ b/src/test/test-sleep.c
@@ -40,14 +40,14 @@ int main(int argc, char* argv[]) {
**shutdown = strv_new("shutdown", NULL),
**freez = strv_new("freeze", NULL);
- log_info("Can Standby: %s", yes_no(can_sleep_state(standby) > 0));
- log_info("Can Suspend: %s", yes_no(can_sleep_state(mem) > 0));
- log_info("Can Hibernate: %s", yes_no(can_sleep_state(disk) > 0));
- log_info("Can Hibernate+Suspend (Hybrid-Sleep): %s", yes_no(can_sleep_disk(suspend) > 0));
- log_info("Can Hibernate+Reboot: %s", yes_no(can_sleep_disk(reboot) > 0));
- log_info("Can Hibernate+Platform: %s", yes_no(can_sleep_disk(platform) > 0));
- log_info("Can Hibernate+Shutdown: %s", yes_no(can_sleep_disk(shutdown) > 0));
- log_info("Can Freeze: %s", yes_no(can_sleep_disk(freez) > 0));
+ log_info("Standby configured: %s", yes_no(can_sleep_state(standby) > 0));
+ log_info("Suspend configured: %s", yes_no(can_sleep_state(mem) > 0));
+ log_info("Hibernate configured: %s", yes_no(can_sleep_state(disk) > 0));
+ log_info("Hibernate+Suspend (Hybrid-Sleep) configured: %s", yes_no(can_sleep_disk(suspend) > 0));
+ log_info("Hibernate+Reboot configured: %s", yes_no(can_sleep_disk(reboot) > 0));
+ log_info("Hibernate+Platform configured: %s", yes_no(can_sleep_disk(platform) > 0));
+ log_info("Hibernate+Shutdown configured: %s", yes_no(can_sleep_disk(shutdown) > 0));
+ log_info("Freeze configured: %s", yes_no(can_sleep_state(freez) > 0));
log_info("Suspend configured and possible: %s", yes_no(can_sleep("suspend") > 0));
log_info("Hibernation configured and possible: %s", yes_no(can_sleep("hibernate") > 0));

View File

@ -0,0 +1,50 @@
From 6ccb2ab66121554f78cec1e4b1eebaa7e7e5ec1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 15 Sep 2013 08:40:16 -0400
Subject: [PATCH] Assume that /proc/meminfo can be missing
Travis tests are failing, probably because /proc/meminfo is not available
in the test environment. The same might be true in some virtualized systems,
so just treat missing /proc/meminfo as a sign that hibernation is not
possible.
---
src/shared/sleep-config.c | 3 ++-
src/test/test-fileio.c | 6 +++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 5ec7cce458..148c4dc617 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -172,7 +172,8 @@ static bool enough_memory_for_hibernation(void) {
r = get_status_field("/proc/meminfo", "\nSwapFree:", &swapfree);
if (r < 0) {
- log_error("Failed to retrieve SwapFree from /proc/meminfo: %s", strerror(-r));
+ log_full(r == -ENOENT ? LOG_DEBUG : LOG_WARNING,
+ "Failed to retrieve SwapFree from /proc/meminfo: %s", strerror(-r));
return false;
}
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 6c10d9f1fb..a05640a0a1 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -229,12 +229,16 @@ static void test_executable_is_script(void) {
static void test_status_field(void) {
_cleanup_free_ char *t = NULL, *p = NULL, *s = NULL;
unsigned long long total, buffers;
+ int r;
assert_se(get_status_field("/proc/self/status", "\nThreads:", &t) == 0);
puts(t);
assert_se(streq(t, "1"));
- assert_se(get_status_field("/proc/meminfo", "MemTotal:", &p) == 0);
+ r = get_status_field("/proc/meminfo", "MemTotal:", &p);
+ if (r == -ENOENT)
+ return;
+ assert(r == 0);
puts(p);
assert_se(safe_atollu(p, &total) == 0);

View File

@ -0,0 +1,148 @@
From 66023e631657a9724f3b0a0d39e761a4b3cde8dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 17 Sep 2013 15:12:16 -0500
Subject: [PATCH] Use first partition in /proc/swaps for hibernation test
It seems that the kernel uses the first configured partition
for hibernation. If it is too full, hibernation will fail. Test
that directly.
---
src/core/swap.c | 7 +----
src/shared/sleep-config.c | 80 +++++++++++++++++++++++++++++++++++++----------
2 files changed, 64 insertions(+), 23 deletions(-)
diff --git a/src/core/swap.c b/src/core/swap.c
index d503fe20df..1ad11a72b8 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1052,7 +1052,7 @@ static int swap_load_proc_swaps(Manager *m, bool set_flags) {
(void) fscanf(m->proc_swaps, "%*s %*s %*s %*s %*s\n");
for (i = 1;; i++) {
- char *dev = NULL, *d;
+ _cleanup_free_ char *dev = NULL, *d = NULL;
int prio = 0, k;
k = fscanf(m->proc_swaps,
@@ -1067,19 +1067,14 @@ static int swap_load_proc_swaps(Manager *m, bool set_flags) {
break;
log_warning("Failed to parse /proc/swaps:%u", i);
- free(dev);
continue;
}
d = cunescape(dev);
- free(dev);
-
if (!d)
return -ENOMEM;
k = swap_process_new_swap(m, d, prio, set_flags);
- free(d);
-
if (k < 0)
r = k;
}
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 148c4dc617..d068bfce3c 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -165,24 +165,70 @@ int can_sleep_disk(char **types) {
#define HIBERNATION_SWAP_THRESHOLD 0.98
-static bool enough_memory_for_hibernation(void) {
- _cleanup_free_ char *active = NULL, *swapfree = NULL;
- unsigned long long act, swap;
- int r;
+static int hibernation_partition_size(size_t *size, size_t *used) {
+ _cleanup_fclose_ FILE *f;
+ int i;
+
+ assert(size);
+ assert(used);
+
+ f = fopen("/proc/swaps", "r");
+ if (!f) {
+ log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+ "Failed to retrieve open /proc/swaps: %m");
+ assert(errno > 0);
+ return -errno;
+ }
- r = get_status_field("/proc/meminfo", "\nSwapFree:", &swapfree);
- if (r < 0) {
- log_full(r == -ENOENT ? LOG_DEBUG : LOG_WARNING,
- "Failed to retrieve SwapFree from /proc/meminfo: %s", strerror(-r));
- return false;
+ (void) fscanf(f, "%*s %*s %*s %*s %*s\n");
+
+ for (i = 1;; i++) {
+ _cleanup_free_ char *dev = NULL, *d = NULL, *type = NULL;
+ size_t size_field, used_field;
+ int k;
+
+ k = fscanf(f,
+ "%ms " /* device/file */
+ "%ms " /* type of swap */
+ "%zd " /* swap size */
+ "%zd " /* used */
+ "%*i\n", /* priority */
+ &dev, &type, &size_field, &used_field);
+ if (k != 4) {
+ if (k == EOF)
+ break;
+
+ log_warning("Failed to parse /proc/swaps:%u", i);
+ continue;
+ }
+
+ d = cunescape(dev);
+ if (!d)
+ return -ENOMEM;
+
+ if (!streq(type, "partition")) {
+ log_debug("Partition %s has type %s, ignoring.", d, type);
+ continue;
+ }
+
+ *size = size_field;
+ *used = used_field;
+ return 0;
}
- r = safe_atollu(swapfree, &swap);
- if (r < 0) {
- log_error("Failed to parse SwapFree from /proc/meminfo: %s: %s",
- swapfree, strerror(-r));
+ log_debug("No swap partitions were found.");
+ return -ENOSYS;
+}
+
+static bool enough_memory_for_hibernation(void) {
+ _cleanup_free_ char *active = NULL;
+ unsigned long long act;
+ size_t size, used;
+ int r;
+
+ r = hibernation_partition_size(&size, &used);
+ if (r < 0)
return false;
- }
r = get_status_field("/proc/meminfo", "\nActive(anon):", &active);
if (r < 0) {
@@ -197,9 +243,9 @@ static bool enough_memory_for_hibernation(void) {
return false;
}
- r = act <= swap * HIBERNATION_SWAP_THRESHOLD;
- log_debug("Hibernation is %spossible, Active(anon)=%llu kB, SwapFree=%llu kB, threshold=%.2g%%",
- r ? "" : "im", act, swap, 100*HIBERNATION_SWAP_THRESHOLD);
+ r = act <= (size - used) * HIBERNATION_SWAP_THRESHOLD;
+ log_debug("Hibernation is %spossible, Active(anon)=%llu kB, size=%zu kB, used=%zu kB, threshold=%.2g%%",
+ r ? "" : "im", act, size, used, 100*HIBERNATION_SWAP_THRESHOLD);
return r;
}

View File

@ -0,0 +1,25 @@
From 098a54e1440a98e1c66865823fe55b6de7ccaafe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 17 Sep 2013 15:50:49 -0500
Subject: [PATCH] test-fileio: assume that Buffers may be missing
---
src/test/test-fileio.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index a05640a0a1..c589f19350 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -242,7 +242,10 @@ static void test_status_field(void) {
puts(p);
assert_se(safe_atollu(p, &total) == 0);
- assert_se(get_status_field("/proc/meminfo", "\nBuffers:", &s) == 0);
+ r = get_status_field("/proc/meminfo", "\nBuffers:", &s);
+ if (r == -ENOENT)
+ return;
+ assert(r == 0);
puts(s);
assert_se(safe_atollu(s, &buffers) == 0);

View File

@ -0,0 +1,24 @@
From a66b28a7b7936ba34dde7c45bc9e0e4302c624f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 15 Sep 2013 10:35:51 -0400
Subject: [PATCH] Remove duplicate entries from syscall list
ARM syscall list includes SYS_OABI_SYSCALL_BASE and SYS_SYSCALL_BASE
which were obsuring real syscall names.
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 3a196a65e7..82010a59d1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1000,7 +1000,7 @@ BUILT_SOURCES += \
src/core/syscall-list.txt: Makefile
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include sys/syscall.h - < /dev/null | $(AWK) '/^#define[ \t]+__NR_[^ ]+[ \t]+[0-9(]/ { sub(/__NR_/, "", $$2); print $$2; }' > $@
+ $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include sys/syscall.h - < /dev/null | $(AWK) '/^#define[ \t]+__NR_[^ ]+[ \t]+[0-9(]/ { sub(/__NR_/, "", $$2); if ($$2 !~ /SYSCALL_BASE/) print $$2; }' > $@
src/core/syscall-from-name.gperf: src/core/syscall-list.txt Makefile
$(AM_V_at)$(MKDIR_P) $(dir $@)

View File

@ -0,0 +1,20 @@
From 49bfb98b14455671c97c5dacfcebf9d80c4d731e Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Tue, 17 Sep 2013 16:37:42 -0500
Subject: [PATCH] libudev: add missing 'global' to symbol export
---
src/libudev/libudev.sym | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libudev/libudev.sym b/src/libudev/libudev.sym
index 8e09430aec..1e6f885141 100644
--- a/src/libudev/libudev.sym
+++ b/src/libudev/libudev.sym
@@ -109,5 +109,6 @@ global:
} LIBUDEV_189;
LIBUDEV_199 {
+global:
udev_device_set_sysattr_value;
} LIBUDEV_196;

View File

@ -0,0 +1,25 @@
From dde42206a9f6e6000f896857264c73fdac4a676e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
Date: Thu, 12 Sep 2013 00:53:36 +0300
Subject: [PATCH] man: fix description of sysctl.d order
systemd-sysctl gives priority to the latest occurence as of commit
04bf3c1a60d82791e0320381e9268f727708f776, but the manpage hasn't been
updated for that.
---
man/sysctl.d.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/sysctl.d.xml b/man/sysctl.d.xml
index 759b8740f5..a5868e638f 100644
--- a/man/sysctl.d.xml
+++ b/man/sysctl.d.xml
@@ -92,7 +92,7 @@
alphabetical order, regardless in which of the
directories they reside, to guarantee that a specific
configuration file takes precedence over another file
- with an alphabetically later name, if both files
+ with an alphabetically earlier name, if both files
contain the same variable setting.</para>
<para>If the administrator wants to disable a

View File

@ -0,0 +1,50 @@
From 94de750682225e93dd847f73f5ade8207bce6cef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 15 Aug 2013 15:07:57 -0400
Subject: [PATCH] units: make fsck units remain after exit
Without this, fsck would be re-run if any other service which pulls
in a target requiring one of the mounts was started after fsck was done
but before the initial transaction was done.
https://bugs.freedesktop.org/show_bug.cgi?id=66784
---
units/systemd-fsck-root.service.in | 4 ++--
units/systemd-fsck@.service.in | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/units/systemd-fsck-root.service.in b/units/systemd-fsck-root.service.in
index ef5123feb8..1f0b3a3e3c 100644
--- a/units/systemd-fsck-root.service.in
+++ b/units/systemd-fsck-root.service.in
@@ -7,7 +7,7 @@
[Unit]
Description=File System Check on Root Device
-Documentation=man:systemd-fsck@.service(8)
+Documentation=man:systemd-fsck-root.service(8)
DefaultDependencies=no
After=systemd-readahead-collect.service systemd-readahead-replay.service
Before=local-fs.target shutdown.target
@@ -18,7 +18,7 @@ ConditionPathIsReadWrite=!/
[Service]
Type=oneshot
-RemainAfterExit=no
+RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-fsck
StandardOutput=journal+console
FsckPassNo=1
diff --git a/units/systemd-fsck@.service.in b/units/systemd-fsck@.service.in
index b3c71eb250..e229cdcb83 100644
--- a/units/systemd-fsck@.service.in
+++ b/units/systemd-fsck@.service.in
@@ -15,7 +15,7 @@ Before=shutdown.target
[Service]
Type=oneshot
-RemainAfterExit=no
+RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-fsck %f
StandardOutput=journal+console
TimeoutSec=0

View File

@ -0,0 +1,22 @@
From f2c76cb8c04a4123c6ff76609ea808bcec28b2a4 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Mon, 22 Jul 2013 16:59:26 +0200
Subject: [PATCH] systemd-tmpfiles-setup-dev: remain after exit
Without this, tmpfiles-setpu-dev would be re-run if any other service,
which pulls in basic.target, was started after setup-dev was finished
and before basic.target was active.
---
units/systemd-tmpfiles-setup-dev.service.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/units/systemd-tmpfiles-setup-dev.service.in b/units/systemd-tmpfiles-setup-dev.service.in
index f029285bc0..0a814f064c 100644
--- a/units/systemd-tmpfiles-setup-dev.service.in
+++ b/units/systemd-tmpfiles-setup-dev.service.in
@@ -14,4 +14,5 @@ ConditionCapability=CAP_MKNOD
[Service]
Type=oneshot
+RemainAfterExit=true
ExecStart=@rootbindir@/systemd-tmpfiles --prefix=/dev --create

View File

@ -0,0 +1,22 @@
From 3bb6a0541b448e4b5d59c91d5c85f72709043a98 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Mon, 22 Jul 2013 17:10:15 +0200
Subject: [PATCH] kmod-static-nodes: remain after exit
Conflicts:
units/systemd-random-seed-save.service.in
---
units/systemd-tmpfiles-setup-dev.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/systemd-tmpfiles-setup-dev.service.in b/units/systemd-tmpfiles-setup-dev.service.in
index 0a814f064c..764da01186 100644
--- a/units/systemd-tmpfiles-setup-dev.service.in
+++ b/units/systemd-tmpfiles-setup-dev.service.in
@@ -14,5 +14,5 @@ ConditionCapability=CAP_MKNOD
[Service]
Type=oneshot
-RemainAfterExit=true
+RemainAfterExit=yes
ExecStart=@rootbindir@/systemd-tmpfiles --prefix=/dev --create

View File

@ -0,0 +1,75 @@
From 6a47d00a0d01be32b106e56b766d0330cfb6b88a Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Thu, 15 Aug 2013 18:35:03 +0200
Subject: [PATCH] sysctl: allow overwriting of values specified in "later"
files
Conflicts:
NEWS
---
src/sysctl/sysctl.c | 16 ++++++++--------
units/systemd-sysctl.service.in | 1 -
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index db18dd9f6e..b5670dbb86 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -135,6 +135,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
log_debug("parse: %s\n", path);
while (!feof(f)) {
char l[LINE_MAX], *p, *value, *new_value, *property, *existing;
+ void *v;
int k;
if (!fgets(l, sizeof(l), f)) {
@@ -167,13 +168,14 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
p = normalize_sysctl(strstrip(p));
value = strstrip(value);
- existing = hashmap_get(sysctl_options, p);
+ existing = hashmap_get2(sysctl_options, p, &v);
if (existing) {
- if (!streq(value, existing))
- log_warning("Duplicate assignment of %s in file '%s', ignoring.",
- p, path);
+ if (streq(value, existing))
+ continue;
- continue;
+ log_info("Overwriting earlier assignment of %s in file '%s'.", p, path);
+ free(hashmap_remove(sysctl_options, p));
+ free(v);
}
property = strdup(p);
@@ -188,7 +190,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
k = hashmap_put(sysctl_options, property, new_value);
if (k < 0) {
- log_error("Failed to add sysctl variable %s to hashmap: %s", property, strerror(-r));
+ log_error("Failed to add sysctl variable %s to hashmap: %s", property, strerror(-k));
free(property);
free(new_value);
return k;
@@ -304,8 +306,6 @@ int main(int argc, char *argv[]) {
goto finish;
}
- r = parse_file(sysctl_options, "/etc/sysctl.conf", true);
-
STRV_FOREACH(f, files) {
k = parse_file(sysctl_options, *f, true);
if (k < 0 && r == 0)
diff --git a/units/systemd-sysctl.service.in b/units/systemd-sysctl.service.in
index 45e1ceb25c..5baf22c183 100644
--- a/units/systemd-sysctl.service.in
+++ b/units/systemd-sysctl.service.in
@@ -13,7 +13,6 @@ Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/
-ConditionPathExists=|/etc/sysctl.conf
ConditionDirectoryNotEmpty=|/lib/sysctl.d
ConditionDirectoryNotEmpty=|/usr/lib/sysctl.d
ConditionDirectoryNotEmpty=|/usr/local/lib/sysctl.d

View File

@ -0,0 +1,35 @@
From 52f92901cc76ea38549549083a153a5c79910732 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 6 Oct 2013 11:33:15 -0400
Subject: [PATCH] Restore reading of /etc/sysctl.conf
---
src/sysctl/sysctl.c | 2 ++
units/systemd-sysctl.service.in | 1 +
2 files changed, 3 insertions(+)
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index b5670dbb86..c0cce491b6 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -306,6 +306,8 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ r = parse_file(sysctl_options, "/etc/sysctl.conf", true);
+
STRV_FOREACH(f, files) {
k = parse_file(sysctl_options, *f, true);
if (k < 0 && r == 0)
diff --git a/units/systemd-sysctl.service.in b/units/systemd-sysctl.service.in
index 5baf22c183..45e1ceb25c 100644
--- a/units/systemd-sysctl.service.in
+++ b/units/systemd-sysctl.service.in
@@ -13,6 +13,7 @@ Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/
+ConditionPathExists=|/etc/sysctl.conf
ConditionDirectoryNotEmpty=|/lib/sysctl.d
ConditionDirectoryNotEmpty=|/usr/lib/sysctl.d
ConditionDirectoryNotEmpty=|/usr/local/lib/sysctl.d

View File

@ -0,0 +1,30 @@
From ccfa8c13bc47a1fe2bb502167d35d88e279a71e5 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 17 Jun 2013 21:12:53 +0200
Subject: [PATCH] mount: when learning about the root mount from mountinfo,
don't add conflicting dep for umount.target
That way systemd won't try to umount it at shutdown.
---
src/core/mount.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/core/mount.c b/src/core/mount.c
index 8777b47ca9..605c56d26d 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1541,9 +1541,11 @@ static int mount_add_one(
if (r < 0)
goto fail;
- r = unit_add_dependency_by_name(u, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true);
- if (r < 0)
- goto fail;
+ if (!path_equal(where, "/")) {
+ r = unit_add_dependency_by_name(u, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true);
+ if (r < 0)
+ goto fail;
+ }
unit_add_to_load_queue(u);
} else {

View File

@ -0,0 +1,31 @@
From 659773964a8e0b00e24f465b3b3a1fa6ca3bf54a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 4 Jul 2013 11:01:47 +0200
Subject: [PATCH] core/mount.c:mount_dump(): don't segfault, if mount is not
mounted anymore
Don't segfault, if m->from_proc_self_mountinfo and m->from_fragment is
false.
https://bugzilla.redhat.com/show_bug.cgi?id=957783#c9
---
src/core/mount.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/mount.c b/src/core/mount.c
index 605c56d26d..85f500005d 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -820,9 +820,9 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) {
prefix, mount_state_to_string(m->state),
prefix, mount_result_to_string(m->result),
prefix, m->where,
- prefix, strna(p->what),
- prefix, strna(p->fstype),
- prefix, strna(p->options),
+ prefix, p ? strna(p->what) : "n/a",
+ prefix, p ? strna(p->fstype) : "n/a",
+ prefix, p ? strna(p->options) : "n/a",
prefix, yes_no(m->from_proc_self_mountinfo),
prefix, yes_no(m->from_fragment),
prefix, m->directory_mode);

View File

@ -0,0 +1,48 @@
From 9a408c634554cca89f0f217843d45bf22b0fcd1d Mon Sep 17 00:00:00 2001
From: Sylvia Else <sylviabz1@cryogenic.net>
Date: Sun, 6 Oct 2013 23:06:35 -0400
Subject: [PATCH] systemd: serialize/deserialize forbid_restart value
The Service type's forbid_restart field was not preserved by
serialization/deserialization, so the fact that the service should not
be restarted after stopping was lost.
If a systemctl stop foo command has been given, but the foo service
has not yet stopped, and then the systemctl --system daemon-reload was
given, then when the foo service eventually stopped, systemd would
restart it.
https://bugs.freedesktop.org/show_bug.cgi?id=69800
---
src/core/service.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/core/service.c b/src/core/service.c
index 973bd03c78..0c8a81b9a5 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2640,6 +2640,9 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
if (s->exec_context.var_tmp_dir)
unit_serialize_item(u, f, "var-tmp-dir", s->exec_context.var_tmp_dir);
+ if (s->forbid_restart)
+ unit_serialize_item(u, f, "forbid_restart", yes_no(s->forbid_restart));
+
return 0;
}
@@ -2774,6 +2777,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
return log_oom();
s->exec_context.var_tmp_dir = t;
+ } else if (streq(key, "forbid_restart")) {
+ int b;
+
+ b = parse_boolean(value);
+ if (b < 0)
+ log_debug_unit(u->id, "Failed to parse forbid_restart value %s", value);
+ else
+ s->forbid_restart = b;
} else
log_debug_unit(u->id, "Unknown serialization key '%s'", key);

View File

@ -0,0 +1,37 @@
From 222ff4b249bed6bf0845e303b7642e47e156640b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 9 Oct 2013 00:13:55 +0200
Subject: [PATCH] core: unify the way we denote serialization attributes
---
src/core/service.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index 0c8a81b9a5..bc00f885e8 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2641,7 +2641,7 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
unit_serialize_item(u, f, "var-tmp-dir", s->exec_context.var_tmp_dir);
if (s->forbid_restart)
- unit_serialize_item(u, f, "forbid_restart", yes_no(s->forbid_restart));
+ unit_serialize_item(u, f, "forbid-restart", yes_no(s->forbid_restart));
return 0;
}
@@ -2777,12 +2777,12 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
return log_oom();
s->exec_context.var_tmp_dir = t;
- } else if (streq(key, "forbid_restart")) {
+ } else if (streq(key, "forbid-restart")) {
int b;
b = parse_boolean(value);
if (b < 0)
- log_debug_unit(u->id, "Failed to parse forbid_restart value %s", value);
+ log_debug_unit(u->id, "Failed to parse forbid-restart value %s", value);
else
s->forbid_restart = b;
} else

View File

@ -0,0 +1,60 @@
From 6992f77147593ec5c7f2c9ad329da585e9574bd4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 24 Jun 2013 07:59:41 -0400
Subject: [PATCH] journal/vacuum: cleanup
---
src/journal/journal-vacuum.c | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 4a3a5a9e63..1ddb043e2c 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -135,10 +135,11 @@ int journal_directory_vacuum(
usec_t max_retention_usec,
usec_t *oldest_usec) {
- DIR *d;
+ _cleanup_closedir_ DIR *d = NULL;
int r = 0;
struct vacuum_info *list = NULL;
- unsigned n_list = 0, n_allocated = 0, i;
+ unsigned n_list = 0, i;
+ size_t n_allocated = 0;
uint64_t sum = 0;
usec_t retention_limit = 0;
@@ -248,19 +249,7 @@ int journal_directory_vacuum(
patch_realtime(directory, de->d_name, &st, &realtime);
- if (n_list >= n_allocated) {
- struct vacuum_info *j;
-
- n_allocated = MAX(n_allocated * 2U, 8U);
- j = realloc(list, n_allocated * sizeof(struct vacuum_info));
- if (!j) {
- free(p);
- r = -ENOMEM;
- goto finish;
- }
-
- list = j;
- }
+ GREEDY_REALLOC(list, n_allocated, n_list + 1);
list[n_list].filename = p;
list[n_list].usage = 512UL * (uint64_t) st.st_blocks;
@@ -308,11 +297,7 @@ int journal_directory_vacuum(
finish:
for (i = 0; i < n_list; i++)
free(list[i].filename);
-
free(list);
- if (d)
- closedir(d);
-
return r;
}

View File

@ -0,0 +1,65 @@
From 909a0337de322578679728231807683e666295c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 24 Jun 2013 21:00:28 -0400
Subject: [PATCH] journald: always vacuum empty offline files
Corrupted empty files are relatively common. I think they are created
when a coredump for a user who never logged anything before is
attempted to be written, but the write does not succeed because the
coredump is too big, but there are probably other ways to create
those, especially if the machine crashes at the right time.
Non-corrupted empty files can also happen, e.g. if a journal file is
opened, but nothing is ever successfully written to it and it is
rotated because of MaxFileSec=. Either way, each "empty" journal file
costs around 3 MB, and there's little point in keeping them around.
---
src/journal/journal-vacuum.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 1ddb043e2c..79572f1fb6 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -128,6 +128,24 @@ static void patch_realtime(
#endif
}
+static int journal_file_empty(int dir_fd, const char *name) {
+ int fd, r;
+ le64_t n_entries;
+
+ fd = openat(dir_fd, name, O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
+ if (fd < 0)
+ return -errno;
+
+ if (lseek(fd, offsetof(Header, n_entries), SEEK_SET) < 0)
+ return -errno;
+
+ r = read(fd, &n_entries, sizeof(n_entries));
+ if (r != sizeof(n_entries))
+ return r == 0 ? -EINVAL : -errno;
+
+ return le64toh(n_entries) == 0;
+}
+
int journal_directory_vacuum(
const char *directory,
uint64_t max_use,
@@ -247,6 +265,17 @@ int journal_directory_vacuum(
/* We do not vacuum active files or unknown files! */
continue;
+ if (journal_file_empty(dirfd(d), de->d_name)) {
+
+ /* Always vacuum empty non-online files. */
+
+ if (unlinkat(dirfd(d), de->d_name, 0) >= 0)
+ log_debug("Deleted empty journal %s/%s.", directory, de->d_name);
+ else if (errno != ENOENT)
+ log_warning("Failed to delete %s/%s: %m", directory, de->d_name);
+ continue;
+ }
+
patch_realtime(directory, de->d_name, &st, &realtime);
GREEDY_REALLOC(list, n_allocated, n_list + 1);

View File

@ -0,0 +1,42 @@
From 2bb5cce6ae539dda6cd166ace4d1f14adcef6012 Mon Sep 17 00:00:00 2001
From: George McCollister <george.mccollister@gmail.com>
Date: Wed, 4 Sep 2013 07:12:43 -0500
Subject: [PATCH] journald: fix vacuuming of archived journals
d_name is modified on line 227 so if the entire journal name is needed
again p must be used. Before this change when journal_file_empty was called
on archived journals it would always return with -2.
Signed-off-by: George McCollister <george.mccollister@gmail.com>
---
src/journal/journal-vacuum.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 79572f1fb6..ace772273b 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -265,18 +265,18 @@ int journal_directory_vacuum(
/* We do not vacuum active files or unknown files! */
continue;
- if (journal_file_empty(dirfd(d), de->d_name)) {
+ if (journal_file_empty(dirfd(d), p)) {
/* Always vacuum empty non-online files. */
- if (unlinkat(dirfd(d), de->d_name, 0) >= 0)
- log_debug("Deleted empty journal %s/%s.", directory, de->d_name);
+ if (unlinkat(dirfd(d), p, 0) >= 0)
+ log_debug("Deleted empty journal %s/%s.", directory, p);
else if (errno != ENOENT)
- log_warning("Failed to delete %s/%s: %m", directory, de->d_name);
+ log_warning("Failed to delete %s/%s: %m", directory, p);
continue;
}
- patch_realtime(directory, de->d_name, &st, &realtime);
+ patch_realtime(directory, p, &st, &realtime);
GREEDY_REALLOC(list, n_allocated, n_list + 1);

View File

@ -0,0 +1,32 @@
From e5e1a36447a88efae9f25d39baad592ff3af34f7 Mon Sep 17 00:00:00 2001
From: George McCollister <george.mccollister@gmail.com>
Date: Wed, 4 Sep 2013 07:12:44 -0500
Subject: [PATCH] journald: fix fd leak in journal_file_empty
Before my previous patch, journal_file_empty wasn't be called with the
correct filename. Now that it's being called with the correct filename
it leaks file descriptors. This patch closes the file descriptors before
returning.
Signed-off-by: George McCollister <george.mccollister@gmail.com>
[Edit harald@redhat.com: make use of _cleanup_close_ instead]
---
src/journal/journal-vacuum.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index ace772273b..178c8030db 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -129,8 +129,9 @@ static void patch_realtime(
}
static int journal_file_empty(int dir_fd, const char *name) {
- int fd, r;
+ int r;
le64_t n_entries;
+ _cleanup_close_ int fd;
fd = openat(dir_fd, name, O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
if (fd < 0)

View File

@ -0,0 +1,134 @@
From cb7c7cd374608517f9abf36aa4080f6866950117 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 10 Sep 2013 08:20:24 -0400
Subject: [PATCH] journald: be a bit more verbose when vacuuming
Vacuuming behaviour is a bit confusing, and/or we have some bugs,
so those additional messages should help to find out what's going
on. Also, rotation of journal files shouldn't be happening too
often, so the level of the messages is bumped to info, so that
they'll be logged under normal operation.
---
src/initctl/initctl.c | 10 ++++++----
src/journal/journal-vacuum.c | 20 ++++++++++++++------
src/journal/journalctl.c | 2 +-
src/journal/journald-server.c | 4 ++++
4 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
index 735f1e1450..afdad5e7f2 100644
--- a/src/initctl/initctl.c
+++ b/src/initctl/initctl.c
@@ -223,8 +223,10 @@ static int fifo_process(Fifo *f) {
assert(f);
errno = EIO;
- if ((l = read(f->fd, ((uint8_t*) &f->buffer) + f->bytes_read, sizeof(f->buffer) - f->bytes_read)) <= 0) {
-
+ l = read(f->fd,
+ ((uint8_t*) &f->buffer) + f->bytes_read,
+ sizeof(f->buffer) - f->bytes_read);
+ if (l <= 0) {
if (errno == EAGAIN)
return 0;
@@ -372,8 +374,8 @@ static int process_event(Server *s, struct epoll_event *ev) {
}
f = (Fifo*) ev->data.ptr;
-
- if ((r = fifo_process(f)) < 0) {
+ r = fifo_process(f);
+ if (r < 0) {
log_info("Got error on fifo: %s", strerror(-r));
fifo_free(f);
return r;
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 178c8030db..c73ad8f393 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -159,7 +159,7 @@ int journal_directory_vacuum(
struct vacuum_info *list = NULL;
unsigned n_list = 0, i;
size_t n_allocated = 0;
- uint64_t sum = 0;
+ uint64_t sum = 0, freed = 0;
usec_t retention_limit = 0;
assert(directory);
@@ -267,13 +267,17 @@ int journal_directory_vacuum(
continue;
if (journal_file_empty(dirfd(d), p)) {
-
/* Always vacuum empty non-online files. */
- if (unlinkat(dirfd(d), p, 0) >= 0)
- log_debug("Deleted empty journal %s/%s.", directory, p);
- else if (errno != ENOENT)
+ uint64_t size = 512UL * (uint64_t) st.st_blocks;
+
+ if (unlinkat(dirfd(d), p, 0) >= 0) {
+ log_info("Deleted empty journal %s/%s (%"PRIu64" bytes).",
+ directory, p, size);
+ freed += size;
+ } else if (errno != ENOENT)
log_warning("Failed to delete %s/%s: %m", directory, p);
+
continue;
}
@@ -310,7 +314,9 @@ int journal_directory_vacuum(
break;
if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) {
- log_debug("Deleted archived journal %s/%s.", directory, list[i].filename);
+ log_debug("Deleted archived journal %s/%s (%"PRIu64" bytes).",
+ directory, list[i].filename, list[i].usage);
+ freed += list[i].usage;
if (list[i].usage < sum)
sum -= list[i].usage;
@@ -329,5 +335,7 @@ finish:
free(list[i].filename);
free(list);
+ log_info("Vacuuming done, freed %"PRIu64" bytes", freed);
+
return r;
}
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 7fc2c36c7c..3e6817a581 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1050,7 +1050,7 @@ static int access_check(sd_journal *j) {
int main(int argc, char *argv[]) {
int r;
- _cleanup_journal_close_ sd_journal*j = NULL;
+ _cleanup_journal_close_ sd_journal *j = NULL;
bool need_seek = false;
sd_id128_t previous_boot_id;
bool previous_boot_id_valid = false, first_line = true;
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 8a9957c655..01f46782f2 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -995,6 +995,8 @@ int process_event(Server *s, struct epoll_event *ev) {
}
if (sfsi.ssi_signo == SIGUSR1) {
+ log_info("Received request to flush runtime journal from PID %"PRIu32,
+ sfsi.ssi_pid);
touch("/run/systemd/journal/flushed");
server_flush_to_var(s);
server_sync(s);
@@ -1002,6 +1004,8 @@ int process_event(Server *s, struct epoll_event *ev) {
}
if (sfsi.ssi_signo == SIGUSR2) {
+ log_info("Received request to rotate journal from PID %"PRIu32,
+ sfsi.ssi_pid);
server_rotate(s);
server_vacuum(s);
return 1;

View File

@ -0,0 +1,22 @@
From 77413b84b1c1905a5d2ae537bf73c7cd08ba2deb Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 9 Oct 2013 04:03:45 +0200
Subject: [PATCH] journald: fix minor memory leak
---
src/journal/journal-vacuum.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index c73ad8f393..8d5effb45c 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -278,6 +278,8 @@ int journal_directory_vacuum(
} else if (errno != ENOENT)
log_warning("Failed to delete %s/%s: %m", directory, p);
+ free(p);
+
continue;
}

View File

@ -0,0 +1,36 @@
From 2c7c0ad6b789ace376cc1260d0afe807aad743a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 9 Oct 2013 22:13:13 -0400
Subject: [PATCH] journald: remove rotated file from hashmap when rotation
fails
Before, when the user journal file was rotated, journal_file_rotate
could close the old file and fail to open the new file. In that
case, we would leave the old (deallocated) file in the hashmap.
On subsequent accesses, we could retrieve this stale entry, leading
to a segfault.
When journal_file_rotate fails with the file pointer set to 0,
old file is certainly gone, and cannot be used anymore.
https://bugzilla.redhat.com/show_bug.cgi?id=890463
---
src/journal/journald-server.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 01f46782f2..7a316c271e 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -335,8 +335,10 @@ void server_rotate(Server *s) {
if (r < 0)
if (f)
log_error("Failed to rotate %s: %s", f->path, strerror(-r));
- else
+ else {
log_error("Failed to create user journal: %s", strerror(-r));
+ hashmap_remove(s->user_journals, k);
+ }
else {
hashmap_replace(s->user_journals, k, f);
server_fix_perms(s, f, PTR_TO_UINT32(k));

View File

@ -0,0 +1,31 @@
From fd10c83b138c5811cbc29ce663f6a47613e9e770 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Sun, 13 Oct 2013 17:42:51 -0400
Subject: [PATCH] udevadm.xml: document --resolve-names option for test
And remove documentation of the --subsystem flag which doesn't actually
exist.
---
man/udevadm.xml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/man/udevadm.xml b/man/udevadm.xml
index d0b257dec9..b959216d90 100644
--- a/man/udevadm.xml
+++ b/man/udevadm.xml
@@ -462,9 +462,13 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><option>--subsystem=<replaceable>string</replaceable></option></term>
+ <term><option>--resolve-names=<replaceable>early|late|never</replaceable></option></term>
<listitem>
- <para>The subsystem string.</para>
+ <para>Specify when udevadm should resolve names of users and groups.
+ When set to early (the default) names will be resolved when the
+ rules are parsed. When set to late names will be resolved for
+ every event. When set to never names will never be resolved and
+ all devices will be owned by root.</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -0,0 +1,68 @@
From a570f01e57a9e19d0f6ec6a984bbef3f48ffea8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Oct 2013 19:33:20 -0400
Subject: [PATCH] dbus-common: avoid leak in error path
src/shared/dbus-common.c:968:33: warning: Potential leak of memory pointed to by 'l'
return -EINVAL;
^~~~~~
---
src/shared/dbus-common.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/shared/dbus-common.c b/src/shared/dbus-common.c
index b8c15cb9fc..9ec0343013 100644
--- a/src/shared/dbus-common.c
+++ b/src/shared/dbus-common.c
@@ -934,7 +934,7 @@ int bus_parse_strv_iter(DBusMessageIter *iter, char ***_l) {
int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l) {
DBusMessageIter sub, sub2;
unsigned n = 0, i = 0;
- char **l;
+ _cleanup_strv_free_ char **l = NULL;
assert(iter);
assert(_l);
@@ -953,6 +953,7 @@ int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l) {
l = new(char*, n*2+1);
if (!l)
return -ENOMEM;
+ l[0] = NULL; /* make sure that l is properly terminated at all times */
dbus_message_iter_recurse(iter, &sub);
@@ -968,26 +969,25 @@ int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l) {
return -EINVAL;
l[i] = strdup(a);
- if (!l[i]) {
- strv_free(l);
+ if (!l[i])
return -ENOMEM;
- }
+ i++;
- l[++i] = strdup(b);
- if (!l[i]) {
- strv_free(l);
+ l[i] = strdup(b);
+ if (!l[i])
return -ENOMEM;
- }
-
i++;
+
dbus_message_iter_next(&sub);
}
assert(i == n*2);
l[i] = NULL;
- if (_l)
+ if (_l) {
*_l = l;
+ l = NULL; /* avoid freeing */
+ }
return 0;
}

View File

@ -0,0 +1,29 @@
From a2ead3ec681171cf1f5a29538d1effa68ec2c6e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Oct 2013 19:33:36 -0400
Subject: [PATCH] drop-ins: check return value
If the function failed, nothing serious would happen
because unlink would probably return EFAULT, but this
would obscure the real error and is a bit sloppy.
Conflicts:
src/core/unit.c
---
src/core/unit.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/core/unit.c b/src/core/unit.c
index 9b36b225fa..e744cd3473 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2964,6 +2964,9 @@ int unit_remove_drop_in(Unit *u, bool runtime, const char *name) {
assert(u);
r = drop_in_file(u, runtime, name, &p, &q);
+ if (r < 0)
+ return r;
+
if (unlink(q) < 0)
r = -errno;
else

View File

@ -0,0 +1,94 @@
From e84b40b272c042d2be0026b8eb0cda4852aa6fa3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 13 Oct 2013 19:43:19 -0400
Subject: [PATCH] man: add more markup to udevadm(8)
---
man/udevadm.xml | 49 +++++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 16 deletions(-)
diff --git a/man/udevadm.xml b/man/udevadm.xml
index b959216d90..a1ffe4219c 100644
--- a/man/udevadm.xml
+++ b/man/udevadm.xml
@@ -61,9 +61,10 @@
</refsynopsisdiv>
<refsect1><title>Description</title>
- <para>udevadm expects a command and command specific options. It
- controls the runtime behavior of udev, requests kernel events,
- manages the event queue, and provides simple debugging mechanisms.</para>
+ <para><command>udevadm</command> expects a command and command
+ specific options. It controls the runtime behavior of
+ <command>systemd-udevd</command>, requests kernel events, manages
+ the event queue, and provides simple debugging mechanisms.</para>
</refsect1>
<refsect1><title>OPTIONS</title>
@@ -97,23 +98,37 @@
<varlistentry>
<term><option>--query=<replaceable>type</replaceable></option></term>
<listitem>
- <para>Query the database for specified type of device data. It needs the
- <option>--path</option> or <option>--name</option> to identify the specified
- device. Valid queries are:
- <command>name</command>, <command>symlink</command>, <command>path</command>,
- <command>property</command>, <command>all</command>.</para>
+ <para>Query the database for specified type of device
+ data. It needs the <option>--path</option> or
+ <option>--name</option> to identify the specified
+ device. Valid queries are: <constant>name</constant>,
+ <constant>symlink</constant>, <constant>path</constant>,
+ <constant>property</constant>,
+ <constant>all</constant>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--path=<replaceable>devpath</replaceable></option></term>
<listitem>
- <para>The devpath of the device to query.</para>
+ <para>The <filename>/sys</filename> path of the device to
+ query, e.g.
+ <filename><optional>/sys</optional>/class/block/sda</filename>.
+ Note that this option usually isn't very useful, since
+ <command>udev</command> can guess the type of the
+ argument, so <command>udevadm
+ --devpath=/class/block/sda</command> is equivalent to
+ <command>udevadm /sys/class/block/sda</command>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--name=<replaceable>file</replaceable></option></term>
<listitem>
- <para>The name of the device node or a symlink to query</para>
+ <para>The name of the device node or a symlink to query,
+ e.g. <filename><optional>/dev</optional>/sda</filename>.
+ Note that this option usually isn't very useful, since
+ <command>udev</command> can guess the type of the
+ argument, so <command>udevadm --name=sda</command> is
+ equivalent to <command>udevadm /dev/sda</command>.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -462,13 +477,15 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><option>--resolve-names=<replaceable>early|late|never</replaceable></option></term>
+ <term><option>--resolve-names=<constant>early</constant>|<constant>late</constant>|<constant>never</constant></option></term>
<listitem>
- <para>Specify when udevadm should resolve names of users and groups.
- When set to early (the default) names will be resolved when the
- rules are parsed. When set to late names will be resolved for
- every event. When set to never names will never be resolved and
- all devices will be owned by root.</para>
+ <para>Specify when udevadm should resolve names of users
+ and groups. When set to <constant>early</constant> (the
+ default) names will be resolved when the rules are
+ parsed. When set to <constant>late</constant> names will
+ be resolved for every event. When set to
+ <constant>never</constant> names will never be resolved
+ and all devices will be owned by root.</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -0,0 +1,31 @@
From 0651f1aa4419f65c3c68c6123ef7b96b40b66b16 Mon Sep 17 00:00:00 2001
From: Igor Zhbanov <i.zhbanov@samsung.com>
Date: Tue, 15 Oct 2013 14:35:13 +0400
Subject: [PATCH] Fix for SIGSEGV in systemd-bootchart on short-living
processes
The function svg_ps_bars() dereferencess NULL pointer in the line
endtime = ps->last->sampledata->sampletime;
because of partially initialized ps_struct (ps->last == NULL).
If some process terminates between scaning /proc directory in the log_sample()
function and reading additional information from /proc/PID/... files,
the files couldn't be read, the loop will be continued and partially
initialized structure returned.
---
src/bootchart/store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index b2afb8d13b..660644a4fe 100755
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -275,7 +275,7 @@ schedstat_next:
pscount++;
/* mark our first sample */
- ps->first = ps->sample;
+ ps->first = ps->last = ps->sample;
ps->sample->runtime = atoll(rt);
ps->sample->waittime = atoll(wt);

View File

@ -0,0 +1,34 @@
From 51ef0647f64a5a232d75b9e2eb54365f40593915 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Tue, 15 Oct 2013 08:58:50 +0200
Subject: [PATCH] man: document the -b special boot option
---
man/kernel-command-line.xml | 1 +
man/systemd.xml | 1 +
2 files changed, 2 insertions(+)
diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index 6d064f6373..d8fa29d04b 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -111,6 +111,7 @@
</varlistentry>
<varlistentry>
+ <term><varname>-b</varname></term>
<term><varname>emergency</varname></term>
<term><varname>single</varname></term>
<term><varname>s</varname></term>
diff --git a/man/systemd.xml b/man/systemd.xml
index 8b03417bd4..a46f39db65 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -1127,6 +1127,7 @@
</varlistentry>
<varlistentry>
+ <term><varname>-b</varname></term>
<term><varname>emergency</varname></term>
<listitem><para>Boot into emergency

View File

@ -0,0 +1,32 @@
From 03e3df33ebef4de7f55591022b3684316f47608d Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 16 Oct 2013 02:49:54 +0200
Subject: [PATCH] rules: expose loop block devices to systemd
Since the kernel no longer exposes a large number of "dead" loop devices
it is OK to expose them now in systemd, so let's do that. This has the
benefit that mount dependencies on loop devices start to work.
---
rules/99-systemd.rules.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index d17bdd9a0a..c0e137ea12 100644
--- a/rules/99-systemd.rules.in
+++ b/rules/99-systemd.rules.in
@@ -11,12 +11,12 @@ SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*", TAG+="systemd"
KERNEL=="vport*", TAG+="systemd"
-SUBSYSTEM=="block", KERNEL!="ram*|loop*", TAG+="systemd"
-SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
+SUBSYSTEM=="block", KERNEL!="ram*", TAG+="systemd"
+SUBSYSTEM=="block", KERNEL!="ram*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
# Ignore encrypted devices with no identified superblock on it, since
# we are probably still calling mke2fs or mkswap on it.
-SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0"
+SUBSYSTEM=="block", KERNEL!="ram*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0"
# Ignore raid devices that are not yet assembled and started
SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0"

View File

@ -0,0 +1,29 @@
From b0bd382724a83167b51e16a845ad3bd93d9be6f3 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 16 Oct 2013 02:51:24 +0200
Subject: [PATCH] rules: don't limit some of the rules to the "add" action
Devices should show up in systemd regardless whether the user invoked
"udevadm trigger" or not. Before this change some devices might have
suddenly disappeared due issuing that command.
Conflicts:
rules/99-systemd.rules.in
---
rules/99-systemd.rules.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index c0e137ea12..f15100f45d 100644
--- a/rules/99-systemd.rules.in
+++ b/rules/99-systemd.rules.in
@@ -54,7 +54,7 @@ SUBSYSTEM=="net", KERNEL!="lo", RUN+="@rootlibexecdir@/systemd-sysctl --prefix=/
# Asynchronously mount file systems implemented by these modules as
# soon as they are loaded.
-SUBSYSTEM=="module", KERNEL=="fuse", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-fs-fuse-connections.mount"
-SUBSYSTEM=="module", KERNEL=="configfs", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-kernel-config.mount"
+SUBSYSTEM=="module", KERNEL=="fuse", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-fs-fuse-connections.mount"
+SUBSYSTEM=="module", KERNEL=="configfs", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-kernel-config.mount"
LABEL="systemd_end"

View File

@ -0,0 +1,34 @@
From 354db87b46a4d7332486697745f16cf0933c21dc Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Thu, 17 Oct 2013 03:20:46 +0200
Subject: [PATCH] tmpfiles: log unaccessible FUSE mount points only as debug
message
---
src/tmpfiles/tmpfiles.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index f4885ec942..5822171178 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -272,12 +272,15 @@ static int dir_cleanup(
continue;
if (fstatat(dirfd(d), dent->d_name, &s, AT_SYMLINK_NOFOLLOW) < 0) {
+ if (errno == ENOENT)
+ continue;
- if (errno != ENOENT) {
+ /* FUSE, NFS mounts, SELinux might return EACCES */
+ if (errno == EACCES)
+ log_debug("stat(%s/%s) failed: %m", p, dent->d_name);
+ else
log_error("stat(%s/%s) failed: %m", p, dent->d_name);
- r = -errno;
- }
-
+ r = -errno;
continue;
}

View File

@ -0,0 +1,40 @@
From 86669f78ecb92ca787fff52d1024efbc5a71c7a8 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Mon, 21 Oct 2013 03:49:03 +0200
Subject: [PATCH] rules: remove pointless MODE= settings
Changing the default MODE= for the group accessi, but not specifying
a GROUP= does not provide anything.
It disables the default logic that the mode switches to 0660 as soon
as a GROUP= is specifed, which make custom rules uneccesarily complicated.
https://bugs.freedesktop.org/show_bug.cgi?id=70665
---
rules/50-udev-default.rules | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/rules/50-udev-default.rules b/rules/50-udev-default.rules
index f7647893d4..679dfdfcf4 100644
--- a/rules/50-udev-default.rules
+++ b/rules/50-udev-default.rules
@@ -20,9 +20,7 @@ KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP=
SUBSYSTEM=="mem", KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640"
-SUBSYSTEM=="input", KERNEL=="mouse*|mice|event*", MODE="0640"
-SUBSYSTEM=="input", KERNEL=="ts[0-9]*|uinput", MODE="0640"
-SUBSYSTEM=="input", KERNEL=="js[0-9]*", MODE="0644"
+SUBSYSTEM=="input", KERNEL=="js[0-9]*", MODE="0664"
SUBSYSTEM=="video4linux", GROUP="video"
SUBSYSTEM=="misc", KERNEL=="agpgart", GROUP="video"
@@ -63,7 +61,7 @@ SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", GROUP="disk"
SUBSYSTEM=="aoe", GROUP="disk", MODE="0220"
SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440"
-KERNEL=="rfkill", MODE="0644"
+KERNEL=="rfkill", MODE="0664"
KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun"
KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse"

View File

@ -0,0 +1,80 @@
From f1ba71e2ef49d3e45f1a6246aa3c4b9535a18b2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 21 Oct 2013 14:38:38 -0400
Subject: [PATCH] shell-completion: dump has moved to systemd-analyze
Rename NO_OPTION to STANDALONE for consistency with other files.
Conflicts:
shell-completion/zsh/_systemctl
shell-completion/zsh/_systemd-analyze
---
shell-completion/bash/systemctl | 2 +-
shell-completion/bash/systemd-analyze | 4 ++--
shell-completion/systemd-zsh-completion.zsh | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/shell-completion/bash/systemctl b/shell-completion/bash/systemctl
index f1ec99bdd2..2990482352 100644
--- a/shell-completion/bash/systemctl
+++ b/shell-completion/bash/systemctl
@@ -131,7 +131,7 @@ _systemctl () {
[JOBS]='cancel'
[SNAPSHOTS]='delete'
[ENVS]='set-environment unset-environment'
- [STANDALONE]='daemon-reexec daemon-reload default dump
+ [STANDALONE]='daemon-reexec daemon-reload default
emergency exit halt hibernate hybrid-sleep kexec list-jobs
list-sockets list-units list-unit-files poweroff reboot rescue
show-environment suspend'
diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze
index 11276ef09c..e442ce5446 100644
--- a/shell-completion/bash/systemd-analyze
+++ b/shell-completion/bash/systemd-analyze
@@ -30,7 +30,7 @@ _systemd_analyze() {
local OPTS='--help --version --system --user --from-pattern --to-pattern --order --require'
local -A VERBS=(
- [NO_OPTION]='time blame plot'
+ [STANDALONE]='time blame plot dump'
[CRITICAL_CHAIN]='critical-chain'
[DOT]='dot'
)
@@ -53,7 +53,7 @@ _systemd_analyze() {
if [[ -z $verb ]]; then
comps=${VERBS[*]}
- elif __contains_word "$verb" ${VERBS[NO_OPTION]}; then
+ elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
if [[ $cur = -* ]]; then
comps='--help --version --system --user'
fi
diff --git a/shell-completion/systemd-zsh-completion.zsh b/shell-completion/systemd-zsh-completion.zsh
index ff15da6d37..db8ca1e89a 100644
--- a/shell-completion/systemd-zsh-completion.zsh
+++ b/shell-completion/systemd-zsh-completion.zsh
@@ -301,6 +301,7 @@ _systemd_analyze_command(){
'critical-chain:Print a tree of the time critical chain of units'
'plot:Output SVG graphic showing service initialization'
'dot:Dump dependency graph (in dot(1) format)'
+ 'dump:Dump server status'
)
if (( CURRENT == 1 )); then
@@ -362,7 +363,6 @@ _outputmodes() {
"is-enabled:Check whether unit files are enabled"
"list-jobs:List jobs"
"cancel:Cancel all, one, or more jobs"
- "dump:Dump server status"
"snapshot:Create a snapshot"
"delete:Remove one or more snapshots"
"show-environment:Dump environment"
@@ -588,7 +588,7 @@ done
(( $+functions[_systemctl_link] )) || _systemctl_link() { _files }
# no systemctl completion for:
-# [STANDALONE]='daemon-reexec daemon-reload default dump
+# [STANDALONE]='daemon-reexec daemon-reload default
# emergency exit halt kexec list-jobs list-units
# list-unit-files poweroff reboot rescue show-environment'
# [NAME]='snapshot load'

View File

@ -0,0 +1,31 @@
From 9933e0406fd8b9e848e4471043c705e837cdd94a Mon Sep 17 00:00:00 2001
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
Date: Mon, 21 Oct 2013 17:45:18 -0400
Subject: [PATCH] give priority to /etc/sysctl.conf
---
src/sysctl/sysctl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index c0cce491b6..783c6102a7 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -306,13 +306,15 @@ int main(int argc, char *argv[]) {
goto finish;
}
- r = parse_file(sysctl_options, "/etc/sysctl.conf", true);
-
STRV_FOREACH(f, files) {
k = parse_file(sysctl_options, *f, true);
if (k < 0 && r == 0)
r = k;
}
+
+ k = parse_file(sysctl_options, "/etc/sysctl.conf", true);
+ if (k < 0 && r == 0)
+ r = k;
}
k = apply_all(sysctl_options);

View File

@ -0,0 +1,22 @@
From f872b26251813607032226e124158f5f67385adb Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Thu, 15 Aug 2013 19:54:03 +0200
Subject: [PATCH] libudev: fix hwdb validation to look for the *new* file
---
src/libudev/libudev-hwdb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
index 42ab6d9a6b..c2695b5511 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -354,7 +354,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) {
return false;
if (!hwdb->f)
return false;
- if (fstat(fileno(hwdb->f), &st) < 0)
+ if (stat("/etc/udev/hwdb.bin", &st) < 0)
return true;
if (timespec_load(&hwdb->st.st_mtim) != timespec_load(&st.st_mtim))
return true;

View File

@ -0,0 +1,76 @@
From ed2759e4f3caea9e4780573a6c6d59bcd0db5f5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 24 Oct 2013 00:45:10 -0400
Subject: [PATCH] catalog: remove links to non-existent wiki pages
AFAIK, we don't have even one page with message explanations.
If/when we add them, we can add links.
https://bugzilla.redhat.com/show_bug.cgi?id=1017161
Conflicts:
catalog/systemd.catalog
---
catalog/systemd.catalog | 7 -------
1 file changed, 7 deletions(-)
diff --git a/catalog/systemd.catalog b/catalog/systemd.catalog
index 62635c87b0..8b0c9bfd55 100644
--- a/catalog/systemd.catalog
+++ b/catalog/systemd.catalog
@@ -204,7 +204,6 @@ Unit @UNIT@ has begun shutting down.
Subject: Unit @UNIT@ has finished shutting down
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
Unit @UNIT@ has finished shutting down.
@@ -212,7 +211,6 @@ Unit @UNIT@ has finished shutting down.
Subject: Unit @UNIT@ has failed
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
Unit @UNIT@ has failed.
@@ -222,7 +220,6 @@ The result is @RESULT@.
Subject: Unit @UNIT@ has begun with reloading its configuration
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
Unit @UNIT@ has begun with reloading its configuration
@@ -230,7 +227,6 @@ Unit @UNIT@ has begun with reloading its configuration
Subject: Unit @UNIT@ has finished reloading its configuration
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
Unit @UNIT@ has finished reloading its configuration
@@ -240,7 +236,6 @@ The result is @RESULT@.
Subject: Process @EXECUTABLE@ could not be executed
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
The process @EXECUTABLE@ could not be executed and failed.
@@ -250,7 +245,6 @@ The error number returned while executing this process is @ERRNO@.
Subject: One or more messages could not be forwarded to syslog
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
One or more messages could not be forwarded to the syslog service
running side-by-side with journald. This usually indicates that the
@@ -261,7 +255,6 @@ messages queued.
Subject: Mount point is not empty
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
The directory @WHERE@ is specified as the mount point (second field in
/etc/fstab or Where= field in systemd unit file) and is not empty.

View File

@ -0,0 +1,22 @@
From 335ee33408b0a26cdc87f79c468248f5e7f82851 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Wed, 30 Oct 2013 14:34:58 +0100
Subject: [PATCH] udev: ata_id: log faling ioctls as "debug"
---
src/udev/ata_id/ata_id.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
index 68a06b93b8..d375d43491 100644
--- a/src/udev/ata_id/ata_id.c
+++ b/src/udev/ata_id/ata_id.c
@@ -501,7 +501,7 @@ int main(int argc, char *argv[])
} else {
/* If this fails, then try HDIO_GET_IDENTITY */
if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) {
- log_info("HDIO_GET_IDENTITY failed for '%s': %m\n", node);
+ log_debug("HDIO_GET_IDENTITY failed for '%s': %m\n", node);
rc = 2;
goto close;
}

View File

@ -0,0 +1,23 @@
From 7db9cd15dd8f80157880e948cbf1bc6e4d5276cf Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Wed, 30 Oct 2013 15:09:01 +0100
Subject: [PATCH] libudev: default log_priority to INFO
This brings it in sync with the default config file.
---
src/libudev/libudev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
index 208039a1b2..bc73a5a08c 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -125,7 +125,7 @@ _public_ struct udev *udev_new(void)
return NULL;
udev->refcount = 1;
udev->log_fn = log_stderr;
- udev->log_priority = LOG_ERR;
+ udev->log_priority = LOG_INFO;
udev_list_init(udev, &udev->properties_list, true);
f = fopen("/etc/udev/udev.conf", "re");

View File

@ -0,0 +1,33 @@
From 7f6c814a70a102ba0317e33c6a6bcc21e12a072d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= <vpavlin@redhat.com>
Date: Thu, 31 Oct 2013 14:36:41 +0100
Subject: [PATCH] man: explain NAME in systemctl man page
---
man/systemctl.xml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/man/systemctl.xml b/man/systemctl.xml
index 0afb0cc626..a13661d79c 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -63,6 +63,19 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
introspect and control the state of the
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
system and service manager.</para>
+
+ <para>For Unit Commands the <replaceable>NAME</replaceable> represents full name of unit.
+ <programlisting>
+systemctl start foo.service
+ </programlisting>
+ For Unit File Commands the <replaceable>NAME</replaceable> represents full name of the unit file, or absolute path to the unit file.
+ <programlisting>
+systemctl start /path/to/foo.service
+ </programlisting>
+ While working with services/service files, <command>systemctl</command> is able to append .service suffix when it is missing.
+ <programlisting>
+systemctl start foo
+ </programlisting></para>
</refsect1>
<refsect1>

View File

@ -0,0 +1,27 @@
From 0ea2d31ba70a325242f014c59ee39e927f5579d3 Mon Sep 17 00:00:00 2001
From: Richard Marko <rmarko@fedoraproject.org>
Date: Tue, 5 Nov 2013 15:41:20 +0100
Subject: [PATCH] systemd-python: convert keyword value to string
Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT)
Before this commit this results in
TypeError: cannot concatenate 'str' and 'int' objects
and requires passing PRIORITY value as string to work.
---
src/python-systemd/journal.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index adcc844f46..b1575336b1 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -351,6 +351,8 @@ def get_catalog(mid):
def _make_line(field, value):
if isinstance(value, bytes):
return field.encode('utf-8') + b'=' + value
+ elif isinstance(value, int):
+ return field + '=' + str(value)
else:
return field + '=' + value

View File

@ -0,0 +1,65 @@
From 798a9d956830621afe429678aa1631286e13189a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
Date: Mon, 4 Nov 2013 23:01:17 +0200
Subject: [PATCH] systemctl: make LOAD column width dynamic
Otherwise 'not-found' overflows into the ACTIVE column.
---
src/systemctl/systemctl.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 50f61a3487..e5bfbca078 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -311,14 +311,16 @@ static bool output_show_unit(const struct unit_info *u) {
}
static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
- unsigned id_len, max_id_len, active_len, sub_len, job_len, desc_len, n_shown = 0;
+ unsigned id_len, max_id_len, load_len, active_len, sub_len, job_len, desc_len;
+ unsigned n_shown = 0;
const struct unit_info *u;
int job_count = 0;
- max_id_len = sizeof("UNIT")-1;
- active_len = sizeof("ACTIVE")-1;
- sub_len = sizeof("SUB")-1;
- job_len = sizeof("JOB")-1;
+ max_id_len = strlen("UNIT");
+ load_len = strlen("LOAD");
+ active_len = strlen("ACTIVE");
+ sub_len = strlen("SUB");
+ job_len = strlen("JOB");
desc_len = 0;
for (u = unit_infos; u < unit_infos + c; u++) {
@@ -326,6 +328,7 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
continue;
max_id_len = MAX(max_id_len, strlen(u->id));
+ load_len = MAX(load_len, strlen(u->load_state));
active_len = MAX(active_len, strlen(u->active_state));
sub_len = MAX(sub_len, strlen(u->sub_state));
if (u->job_id != 0) {
@@ -368,7 +371,7 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
continue;
if (!n_shown && !arg_no_legend) {
- printf("%-*s %-6s %-*s %-*s ", id_len, "UNIT", "LOAD",
+ printf("%-*s %-*s %-*s %-*s ", id_len, "UNIT", load_len, "LOAD",
active_len, "ACTIVE", sub_len, "SUB");
if (job_count)
printf("%-*s ", job_len, "JOB");
@@ -394,9 +397,9 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
e = arg_full ? NULL : ellipsize(u->id, id_len, 33);
- printf("%s%-*s%s %s%-6s%s %s%-*s %-*s%s %-*s",
+ printf("%s%-*s%s %s%-*s%s %s%-*s %-*s%s %-*s",
on, id_len, e ? e : u->id, off,
- on_loaded, u->load_state, off_loaded,
+ on_loaded, load_len, u->load_state, off_loaded,
on_active, active_len, u->active_state,
sub_len, u->sub_state, off_active,
job_count ? job_len + 1 : 0, u->job_id ? u->job_type : "");

View File

@ -0,0 +1,25 @@
From a5d9ab7ba1e392e1e7173b6c57ed6dbb10558b85 Mon Sep 17 00:00:00 2001
From: Jan Janssen <medhefgo@web.de>
Date: Thu, 31 Oct 2013 17:22:03 +0100
Subject: [PATCH] Make hibernation test work for swap files
Suspend to disk works for swap files too (even if it is located
on an ecrypted file system):
https://www.kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt
---
src/shared/sleep-config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index d068bfce3c..2bb0493812 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -206,7 +206,7 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
if (!d)
return -ENOMEM;
- if (!streq(type, "partition")) {
+ if (!streq(type, "partition") && !streq(type, "file")) {
log_debug("Partition %s has type %s, ignoring.", d, type);
continue;
}

View File

@ -0,0 +1,22 @@
From 16ba284432f0b24feb4cd28d63c0626bb4e80acd Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 6 Nov 2013 11:18:02 +0100
Subject: [PATCH] systemctl: return r instead of always returning 0
---
src/systemctl/systemctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index e5bfbca078..8fae09efe2 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1329,7 +1329,7 @@ static int list_jobs(DBusConnection *bus, char **args) {
}
free(jobs);
- return 0;
+ return r;
}
static int load_unit(DBusConnection *bus, char **args) {

View File

@ -0,0 +1,22 @@
From 4215779638bb241184f94dd5dfd41fdc68c6d5b7 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sun, 10 Nov 2013 23:05:08 +0100
Subject: [PATCH] button: don't exit if we cannot handle a button press
---
src/login/logind-button.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index ea45c28eef..4f456d21af 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -172,7 +172,7 @@ static int button_handle(
* execute another one until the lid is opened/closed again */
b->lid_close_queued = false;
- return r;
+ return 0;
}
int button_process(Button *b) {

View File

@ -0,0 +1,120 @@
From 3f870c6a21eddd5879943741dcb0dc72d85b1748 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 11 Nov 2013 03:02:52 +0100
Subject: [PATCH] timer: properly format relative timestamps in the future
---
src/shared/time-util.c | 69 ++++++++++++++++++++++++++++++++------------------
1 file changed, 44 insertions(+), 25 deletions(-)
diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 9ee711a49e..3441c81489 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -169,55 +169,62 @@ char *format_timestamp(char *buf, size_t l, usec_t t) {
}
char *format_timestamp_relative(char *buf, size_t l, usec_t t) {
+ const char *s;
usec_t n, d;
n = now(CLOCK_REALTIME);
- if (t <= 0 || t > n || t + USEC_PER_DAY*7 <= t)
+ if (t <= 0 || (t == (usec_t) -1))
return NULL;
- d = n - t;
+ if (n > t) {
+ d = n - t;
+ s = "ago";
+ } else {
+ d = t - n;
+ s = "left";
+ }
if (d >= USEC_PER_YEAR)
- snprintf(buf, l, "%llu years %llu months ago",
+ snprintf(buf, l, "%llu years %llu months %s",
(unsigned long long) (d / USEC_PER_YEAR),
- (unsigned long long) ((d % USEC_PER_YEAR) / USEC_PER_MONTH));
+ (unsigned long long) ((d % USEC_PER_YEAR) / USEC_PER_MONTH), s);
else if (d >= USEC_PER_MONTH)
- snprintf(buf, l, "%llu months %llu days ago",
+ snprintf(buf, l, "%llu months %llu days %s",
(unsigned long long) (d / USEC_PER_MONTH),
- (unsigned long long) ((d % USEC_PER_MONTH) / USEC_PER_DAY));
+ (unsigned long long) ((d % USEC_PER_MONTH) / USEC_PER_DAY), s);
else if (d >= USEC_PER_WEEK)
- snprintf(buf, l, "%llu weeks %llu days ago",
+ snprintf(buf, l, "%llu weeks %llu days %s",
(unsigned long long) (d / USEC_PER_WEEK),
- (unsigned long long) ((d % USEC_PER_WEEK) / USEC_PER_DAY));
+ (unsigned long long) ((d % USEC_PER_WEEK) / USEC_PER_DAY), s);
else if (d >= 2*USEC_PER_DAY)
- snprintf(buf, l, "%llu days ago", (unsigned long long) (d / USEC_PER_DAY));
+ snprintf(buf, l, "%llu days %s", (unsigned long long) (d / USEC_PER_DAY), s);
else if (d >= 25*USEC_PER_HOUR)
- snprintf(buf, l, "1 day %lluh ago",
- (unsigned long long) ((d - USEC_PER_DAY) / USEC_PER_HOUR));
+ snprintf(buf, l, "1 day %lluh %s",
+ (unsigned long long) ((d - USEC_PER_DAY) / USEC_PER_HOUR), s);
else if (d >= 6*USEC_PER_HOUR)
- snprintf(buf, l, "%lluh ago",
- (unsigned long long) (d / USEC_PER_HOUR));
+ snprintf(buf, l, "%lluh %s",
+ (unsigned long long) (d / USEC_PER_HOUR), s);
else if (d >= USEC_PER_HOUR)
- snprintf(buf, l, "%lluh %llumin ago",
+ snprintf(buf, l, "%lluh %llumin %s",
(unsigned long long) (d / USEC_PER_HOUR),
- (unsigned long long) ((d % USEC_PER_HOUR) / USEC_PER_MINUTE));
+ (unsigned long long) ((d % USEC_PER_HOUR) / USEC_PER_MINUTE), s);
else if (d >= 5*USEC_PER_MINUTE)
- snprintf(buf, l, "%llumin ago",
- (unsigned long long) (d / USEC_PER_MINUTE));
+ snprintf(buf, l, "%llumin %s",
+ (unsigned long long) (d / USEC_PER_MINUTE), s);
else if (d >= USEC_PER_MINUTE)
- snprintf(buf, l, "%llumin %llus ago",
+ snprintf(buf, l, "%llumin %llus %s",
(unsigned long long) (d / USEC_PER_MINUTE),
- (unsigned long long) ((d % USEC_PER_MINUTE) / USEC_PER_SEC));
+ (unsigned long long) ((d % USEC_PER_MINUTE) / USEC_PER_SEC), s);
else if (d >= USEC_PER_SEC)
- snprintf(buf, l, "%llus ago",
- (unsigned long long) (d / USEC_PER_SEC));
+ snprintf(buf, l, "%llus %s",
+ (unsigned long long) (d / USEC_PER_SEC), s);
else if (d >= USEC_PER_MSEC)
- snprintf(buf, l, "%llums ago",
- (unsigned long long) (d / USEC_PER_MSEC));
+ snprintf(buf, l, "%llums %s",
+ (unsigned long long) (d / USEC_PER_MSEC), s);
else if (d > 0)
- snprintf(buf, l, "%lluus ago",
- (unsigned long long) d);
+ snprintf(buf, l, "%lluus %s",
+ (unsigned long long) d, s);
else
snprintf(buf, l, "now");
@@ -457,6 +464,18 @@ int parse_timestamp(const char *t, usec_t *usec) {
return r;
goto finish;
+ } else if (endswith(t, " left")) {
+ _cleanup_free_ char *z;
+
+ z = strndup(t, strlen(t) - 4);
+ if (!z)
+ return -ENOMEM;
+
+ r = parse_sec(z, &plus);
+ if (r < 0)
+ return r;
+
+ goto finish;
}
for (i = 0; i < ELEMENTSOF(day_nr); i++) {

Some files were not shown because too many files have changed in this diff Show More