SHA256
1
0
forked from pool/systemd
Dr. Werner Fink 2014-07-14 14:10:23 +00:00 committed by Git OBS Bridge
parent b81ceb3b1a
commit dcb30b57d1
8 changed files with 191 additions and 0 deletions

View File

@ -0,0 +1,24 @@
From 138992534878483de28417dfc61c546bba5cb8ad Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 10 Jul 2014 18:25:08 +0200
Subject: [PATCH] event: pull in sd-event.h from event-util.h
---
src/libsystemd/sd-event/event-util.h | 1 +
1 file changed, 1 insertion(+)
diff --git src/libsystemd/sd-event/event-util.h src/libsystemd/sd-event/event-util.h
index e58020d..e7cad9b 100644
--- src/libsystemd/sd-event/event-util.h
+++ src/libsystemd/sd-event/event-util.h
@@ -22,6 +22,7 @@
***/
#include "util.h"
+#include "sd-event.h"
DEFINE_TRIVIAL_CLEANUP_FUNC(sd_event*, sd_event_unref);
DEFINE_TRIVIAL_CLEANUP_FUNC(sd_event_source*, sd_event_source_unref);
--
1.7.9.2

View File

@ -0,0 +1,25 @@
Based on 1cb1767a29458b3d16d6b161b4ee34dd496ff60d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Jul 2014 09:21:15 -0400
Subject: [PATCH] util: fix has cc check and add test
---
src/shared/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/shared/util.c src/shared/util.c
index 3342798..75dc58b 100644
--- src/shared/util.c
+++ src/shared/util.c
@@ -5419,7 +5419,7 @@ bool string_has_cc(const char *p, const char *ok) {
for (t = p; *t; t++) {
if (ok && strchr(ok, *t))
- return false;
+ continue;
if (*t > 0 && *t < ' ')
return true;
--
1.7.9.2

View File

@ -0,0 +1,46 @@
From b63c8d4f0364457b0ead8793504012bb7113974f Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Thu, 10 Jul 2014 00:47:23 +0200
Subject: [PATCH] sd-event: always call epoll_ctl() on mask-updates if
edge-triggered
A call to sd_event_source_set_io_events() skipps calling into the kernel
if the new event-mask matches the old one. This is safe for
level-triggered sources as the kernel moves them onto the ready-list
automatically if events change. However, edge-triggered sources might not
be on the ready-list even though events are present.
A call to sd_event_source_set_io_events() with EPOLLET set might thus be
used to just move the io-source onto the ready-list so the next poll
will return it again. This is very useful to avoid starvation in
priority-based event queues.
Imagine a read() loop on an edge-triggered fd. If we cannot read data fast
enough to drain the receive queue, we might decide to skip reading for now
and schedule it for later. On edge-triggered io-sources we have to make
sure it's put on the ready-list so the next dispatch-round will return it
again if it's still the highest priority task. We could make sd-event
handle edge-triggered sources directly and allow marking them ready again.
However, it's much simpler to let the kernel do that for now via
EPOLL_CTL_MOD.
---
src/libsystemd/sd-event/sd-event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c
index 53f1904..a21f7db 100644
--- src/libsystemd/sd-event/sd-event.c
+++ src/libsystemd/sd-event/sd-event.c
@@ -1282,7 +1282,8 @@ _public_ int sd_event_source_set_io_events(sd_event_source *s, uint32_t events)
assert_return(s->event->state != SD_EVENT_FINISHED, -ESTALE);
assert_return(!event_pid_changed(s->event), -ECHILD);
- if (s->io.events == events)
+ /* edge-triggered updates are never skipped, so we can reset edges */
+ if (s->io.events == events && !(events & EPOLLET))
return 0;
if (s->enabled != SD_EVENT_OFF) {
--
1.7.9.2

View File

@ -0,0 +1,54 @@
From 0ce5a80601597fe4d1a715a8f70ce8d5ccaa2d86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
Date: Sun, 13 Jul 2014 18:49:00 +0300
Subject: [PATCH] fileio: quote more shell characters in envfiles
Turns out, making strings shell-proof is harder than expected:
# machinectl set-hostname "foo|poweroff" && . /etc/machine-info
(This could be simplified by quoting *and* escaping all characters,
which is harmless in shell but unnecessary.)
---
src/shared/fileio.c | 4 ++--
src/shared/util.h | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git src/shared/fileio.c src/shared/fileio.c
index b0ab780..cbb40c2 100644
--- src/shared/fileio.c
+++ src/shared/fileio.c
@@ -738,11 +738,11 @@ static void write_env_var(FILE *f, const char *v) {
p++;
fwrite(v, 1, p-v, f);
- if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE "\'\"\\`$")) {
+ if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE SHELL_NEED_QUOTES)) {
fputc('\"', f);
for (; *p; p++) {
- if (strchr("\'\"\\`$", *p))
+ if (strchr(SHELL_NEED_ESCAPE, *p))
fputc('\\', f);
fputc(*p, f);
diff --git src/shared/util.h src/shared/util.h
index c5eadc9..b3187a9 100644
--- src/shared/util.h
+++ src/shared/util.h
@@ -93,6 +93,12 @@
#define COMMENTS "#;"
#define GLOB_CHARS "*?["
+/* What characters are special in the shell? */
+/* must be escaped outside and inside double-quotes */
+#define SHELL_NEED_ESCAPE "\"\\`$"
+/* can be escaped or double-quoted */
+#define SHELL_NEED_QUOTES SHELL_NEED_ESCAPE GLOB_CHARS "'()<>|&;"
+
#define FORMAT_BYTES_MAX 8
#define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
--
1.7.9.2

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Jul 14 11:43:12 UTC 2014 - werner@suse.de
- Add upstream patch
0001-event-pull-in-sd-event.h-from-event-util.h.patch
0002-util-fix-has-cc-check-and-add-test.patch
0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch
0004-fileio-quote-more-shell-characters-in-envfiles.patch
-------------------------------------------------------------------
Fri Jul 11 12:21:06 UTC 2014 - werner@suse.de

View File

@ -683,6 +683,14 @@ Patch331: 0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch
Patch332: 0002-hostnamed-add-a-new-chassis-type-for-watches.patch
# PATCH-FIX-UPSTREAM added at 2014/07/10
Patch333: 0001-units-make-ExecStopPost-action-part-of-ExecStart.patch
# PATCH-FIX-UPSTREAM added at 2014/07/14
Patch334: 0001-event-pull-in-sd-event.h-from-event-util.h.patch
# PATCH-FIX-UPSTREAM added at 2014/07/14
Patch335: 0002-util-fix-has-cc-check-and-add-test.patch
# PATCH-FIX-UPSTREAM added at 2014/07/14
Patch336: 0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch
# PATCH-FIX-UPSTREAM added at 2014/07/14
Patch337: 0004-fileio-quote-more-shell-characters-in-envfiles.patch
# UDEV PATCHES
# ============
@ -1279,6 +1287,10 @@ cp %{SOURCE7} m4/
%patch331 -p0
%patch332 -p0
%patch333 -p0
%patch334 -p0
%patch335 -p0
%patch336 -p0
%patch337 -p0
# udev patches
%patch1001 -p1

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Jul 14 11:43:12 UTC 2014 - werner@suse.de
- Add upstream patch
0001-event-pull-in-sd-event.h-from-event-util.h.patch
0002-util-fix-has-cc-check-and-add-test.patch
0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch
0004-fileio-quote-more-shell-characters-in-envfiles.patch
-------------------------------------------------------------------
Fri Jul 11 12:21:06 UTC 2014 - werner@suse.de

View File

@ -678,6 +678,14 @@ Patch331: 0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch
Patch332: 0002-hostnamed-add-a-new-chassis-type-for-watches.patch
# PATCH-FIX-UPSTREAM added at 2014/07/10
Patch333: 0001-units-make-ExecStopPost-action-part-of-ExecStart.patch
# PATCH-FIX-UPSTREAM added at 2014/07/14
Patch334: 0001-event-pull-in-sd-event.h-from-event-util.h.patch
# PATCH-FIX-UPSTREAM added at 2014/07/14
Patch335: 0002-util-fix-has-cc-check-and-add-test.patch
# PATCH-FIX-UPSTREAM added at 2014/07/14
Patch336: 0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch
# PATCH-FIX-UPSTREAM added at 2014/07/14
Patch337: 0004-fileio-quote-more-shell-characters-in-envfiles.patch
# UDEV PATCHES
# ============
@ -1274,6 +1282,10 @@ cp %{SOURCE7} m4/
%patch331 -p0
%patch332 -p0
%patch333 -p0
%patch334 -p0
%patch335 -p0
%patch336 -p0
%patch337 -p0
# udev patches
%patch1001 -p1