Dr. Werner Fink 2014-07-28 10:21:09 +00:00 committed by Git OBS Bridge
parent d68a80d042
commit fd3006471f
14 changed files with 802 additions and 42 deletions

View File

@ -0,0 +1,21 @@
Based on e05aa2e02ba35d8b3741dddb79af3c802308414b Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Fri, 25 Jul 2014 10:25:06 +0200
Subject: [PATCH] bus-proxyd: fix incorrect comparison
We should be interested in k variable.
---
src/bus-proxyd/bus-proxyd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- src/bus-proxyd/bus-proxyd.c
+++ src/bus-proxyd/bus-proxyd.c 2014-07-28 09:37:29.274735818 +0000
@@ -698,7 +698,7 @@ int main(int argc, char *argv[]) {
k = sd_bus_send(a, m, NULL);
if (k < 0) {
- if (r == -ECONNRESET)
+ if (k == -ECONNRESET)
r = 0;
else {
r = k;

View File

@ -0,0 +1,67 @@
Based on 6d314eca15f6cbda38d82774b210f784d3d4f52a Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@gmx.com>
Date: Sat, 26 Jul 2014 11:15:52 -0400
Subject: [PATCH] shell-completion: prevent mangling unit names
Units with literal hex '\xFF' in their names has to be read
and printed properly.
dev-disk-byx2dlabel-root.device != dev-disk-by\x2dlabel-root.device
---
shell-completion/zsh/_systemctl.in | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git shell-completion/zsh/_systemctl.in shell-completion/zsh/_systemctl.in
index d364d17..e681ec6 100644
--- shell-completion/zsh/_systemctl
+++ shell-completion/zsh/_systemctl
@@ -100,7 +100,7 @@ _systemctl_all_units()
if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) &&
! _retrieve_cache SYS_ALL_UNITS;
then
- _sys_all_units=( $(__systemctl list-units --all | { while read a b; do echo " $a"; done; }) )
+ _sys_all_units=( $(__systemctl list-units --all | { while read -r a b; do echo -E - " $a"; done; }) )
_store_cache SYS_ALL_UNITS _sys_all_units
fi
}
@@ -113,7 +113,7 @@ _systemctl_really_all_units()
if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS ) &&
! _retrieve_cache SYS_REALLY_ALL_UNITS;
then
- all_unit_files=( $(__systemctl list-unit-files | { while read a b; do echo " $a"; done; }) )
+ all_unit_files=( $(__systemctl list-unit-files | { while read -r a b; do echo -E - " $a"; done; }) )
_systemctl_all_units
really_all_units=($_sys_all_units $all_unit_files)
_sys_really_all_units=(${(u)really_all_units})
@@ -138,12 +138,12 @@ _filter_units_by_property() {
done
}
-_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read a b; do echo " $a"; done; }) )}
-_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all | { while read a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }) )}
-_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read a b; do echo " $a"; done; }) )}
-_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "enabled" ]] && echo " $a"; done; }) )}
-_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read a b; do [[ $b == "disabled" ]] && echo " $a"; done; }) )}
-_systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "masked" ]] && echo " $a"; done; }) )}
+_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )}
+_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo -E - " $a"; done; }) )}
+_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )}
+_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "enabled" ]] && echo -E - " $a"; done; }) )}
+_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read -r a b; do [[ $b == "disabled" ]] && echo -E - " $a"; done; }) )}
+_systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "masked" ]] && echo -E - " $a"; done; }) )}
# Completion functions for ALL_UNITS
for fun in is-active is-failed is-enabled status show cat mask preset help list-dependencies ; do
@@ -219,8 +219,8 @@ for fun in restart reload-or-restart ; do
{
_systemctl_all_units
compadd "$@" - $( _filter_units_by_property CanStart yes \
- ${_sys_all_units[*]} | while read line; do \
- [[ "$line" =~ \.device$ ]] || echo " $line"; \
+ ${_sys_all_units[*]} | while read -r line; do \
+ [[ "$line" =~ \.device$ ]] || echo -E - " $line"; \
done )
}
done
--
1.7.9.2

View File

@ -0,0 +1,223 @@
Based on 7de80bfe2e61d5818601ccfddbadad3b7703ed70 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 25 Jul 2014 15:38:31 +0200
Subject: [PATCH] Always check asprintf return code
There is a small number of the places in sources where we don't check
asprintf() return code and assume that after error the function
returns NULL pointer via the first argument. That's wrong, after
error the content of pointer is undefined.
---
src/core/unit-printf.c | 8 ++++----
src/cryptsetup/cryptsetup.c | 11 ++++++++---
src/journal/journalctl.c | 16 +++++++++++-----
src/run/run.c | 20 ++++++++++----------
src/shared/install.c | 15 +++++++++------
src/systemctl/systemctl.c | 18 +++++++++---------
src/tty-ask-password-agent/tty-ask-password-agent.c | 5 +++--
7 files changed, 54 insertions(+), 39 deletions(-)
--- src/core/unit-printf.c
+++ src/core/unit-printf.c 2014-07-28 09:42:20.726235696 +0000
@@ -182,7 +182,7 @@ static int specifier_user_name(char spec
char *printed = NULL;
Unit *u = userdata;
ExecContext *c;
- int r;
+ int r = 0;
assert(u);
@@ -208,7 +208,7 @@ static int specifier_user_name(char spec
if (r < 0)
return -ENODATA;
- asprintf(&printed, "%lu", (unsigned long) uid);
+ r = asprintf(&printed, "%lu", (unsigned long) uid);
}
}
@@ -231,10 +231,10 @@ static int specifier_user_name(char spec
if (specifier == 'u')
printed = strdup(username);
else
- asprintf(&printed, "%lu", (unsigned long) uid);
+ r = asprintf(&printed, "%lu", (unsigned long) uid);
}
- if (!printed)
+ if (r < 0 || !printed)
return -ENOMEM;
*ret = printed;
--- src/cryptsetup/cryptsetup.c
+++ src/cryptsetup/cryptsetup.c 2014-07-28 00:00:00.000000000 +0000
@@ -535,13 +535,18 @@ int main(int argc, char *argv[]) {
description = NULL;
}
+ k = 0;
if (mount_point && description)
- asprintf(&name_buffer, "%s (%s) on %s", description, argv[2], mount_point);
+ k = asprintf(&name_buffer, "%s (%s) on %s", description, argv[2], mount_point);
else if (mount_point)
- asprintf(&name_buffer, "%s on %s", argv[2], mount_point);
+ k = asprintf(&name_buffer, "%s on %s", argv[2], mount_point);
else if (description)
- asprintf(&name_buffer, "%s (%s)", description, argv[2]);
+ k = asprintf(&name_buffer, "%s (%s)", description, argv[2]);
+ if (k < 0) {
+ log_oom();
+ goto finish;
+ }
name = name_buffer ? name_buffer : argv[2];
k = crypt_init(&cd, argv[3]);
--- src/journal/journalctl.c
+++ src/journal/journalctl.c 2014-07-28 00:00:00.000000000 +0000
@@ -746,11 +746,17 @@ static int add_matches(sd_journal *j, ch
}
} 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));
- else {
+ } else if (S_ISCHR(st.st_mode)) {
+ if (asprintf(&t, "_KERNEL_DEVICE=c%u:%u",
+ major(st.st_rdev),
+ minor(st.st_rdev)) < 0)
+ return -ENOMEM;
+ } else if (S_ISBLK(st.st_mode)) {
+ if (asprintf(&t, "_KERNEL_DEVICE=b%u:%u",
+ major(st.st_rdev),
+ minor(st.st_rdev)) < 0)
+ return -ENOMEM;
+ } else {
log_error("File is neither a device node, nor regular file, nor executable: %s", *i);
return -EINVAL;
}
--- src/run/run.c
+++ src/run/run.c 2014-07-28 09:46:36.846235596 +0000
@@ -309,12 +309,12 @@ static int start_transient_service(
_cleanup_free_ char *name = NULL;
int r;
- if (arg_unit)
+ if (arg_unit) {
name = unit_name_mangle_with_suffix(arg_unit, MANGLE_NOGLOB, ".service");
- else
- asprintf(&name, "run-%lu.service", (unsigned long) getpid());
- if (!name)
- return -ENOMEM;
+ if (!name)
+ return log_oom();
+ } else if (asprintf(&name, "run-%lu.service", (unsigned long) getpid()) < 0)
+ return log_oom();
r = message_start_transient_unit_new(bus, name, &m);
if (r < 0)
@@ -436,12 +436,12 @@ static int start_transient_scope(
assert(bus);
- if (arg_unit)
+ if (arg_unit) {
name = unit_name_mangle_with_suffix(arg_unit, MANGLE_NOGLOB, ".scope");
- else
- asprintf(&name, "run-%lu.scope", (unsigned long) getpid());
- if (!name)
- return -ENOMEM;
+ if (!name)
+ return log_oom();
+ } else if (asprintf(&name, "run-%lu.scope", (unsigned long) getpid()) < 0)
+ return log_oom();
r = message_start_transient_unit_new(bus, name, &m);
if (r < 0)
--- src/shared/install.c
+++ src/shared/install.c 2014-07-28 00:00:00.000000000 +0000
@@ -72,13 +72,16 @@ static int get_config_path(UnitFileScope
case UNIT_FILE_SYSTEM:
- if (root_dir && runtime)
- asprintf(&p, "%s/run/systemd/system", root_dir);
- else if (runtime)
+ if (root_dir && runtime) {
+ if (asprintf(&p, "%s/run/systemd/system", root_dir) < 0)
+ return -ENOMEM;
+ } else if (runtime)
p = strdup("/run/systemd/system");
- else if (root_dir)
- asprintf(&p, "%s/%s", root_dir, SYSTEM_CONFIG_UNIT_PATH);
- else
+ else if (root_dir) {
+ if (asprintf(&p, "%s/%s", root_dir,
+ SYSTEM_CONFIG_UNIT_PATH) < 0)
+ return -ENOMEM;
+ } else
p = strdup(SYSTEM_CONFIG_UNIT_PATH);
break;
--- src/systemctl/systemctl.c
+++ src/systemctl/systemctl.c 2014-07-28 09:51:40.894735541 +0000
@@ -4639,11 +4639,11 @@ static int enable_sysv_units(const char
STRV_FOREACH(k, paths.unit_path) {
if (!isempty(arg_root))
- asprintf(&p, "%s/%s/%s", arg_root, *k, name);
+ j = asprintf(&p, "%s/%s/%s", arg_root, *k, name);
else
- asprintf(&p, "%s/%s", *k, name);
+ j = asprintf(&p, "%s/%s", *k, name);
- if (!p) {
+ if (j < 0) {
r = log_oom();
goto finish;
}
@@ -4660,10 +4660,10 @@ static int enable_sysv_units(const char
continue;
if (!isempty(arg_root))
- asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name);
+ j = asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name);
else
- asprintf(&p, SYSTEM_SYSVINIT_PATH "/%s", name);
- if (!p) {
+ j = asprintf(&p, SYSTEM_SYSVINIT_PATH "/%s", name);
+ if (j < 0) {
r = log_oom();
goto finish;
}
@@ -4676,10 +4676,10 @@ static int enable_sysv_units(const char
free(p);
p = NULL;
if (!isempty(arg_root))
- asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/boot.%s", arg_root, name);
+ j = asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/boot.%s", arg_root, name);
else
- asprintf(&p, SYSTEM_SYSVINIT_PATH "/boot.%s", name);
- if (!p) {
+ j = asprintf(&p, SYSTEM_SYSVINIT_PATH "/boot.%s", name);
+ if (j < 0) {
r = log_oom();
goto finish;
}
--- src/tty-ask-password-agent/tty-ask-password-agent.c
+++ src/tty-ask-password-agent/tty-ask-password-agent.c 2014-07-28 00:00:00.000000000 +0000
@@ -102,8 +102,9 @@ static int ask_password_plymouth(
if (accept_cached) {
packet = strdup("c");
n = 1;
- } else
- asprintf(&packet, "*\002%c%s%n", (int) (strlen(message) + 1), message, &n);
+ } else if (asprintf(&packet, "*\002%c%s%n", (int) (strlen(message) + 1),
+ message, &n) < 0)
+ packet = NULL;
if (!packet) {
r = -ENOMEM;

View File

@ -0,0 +1,39 @@
Based on c6a373a26348544d944b08bf0c5dea4f72f6980b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 26 Jul 2014 20:11:58 -0400
Subject: [PATCH] bash-completion: use list-unit-files to get "all" units
I think that it is better to return good results slightly more slowly,
than partial quickly. Also reading from disk seems fast enough. Even
the delay on first try with completely cold cache is acceptable.
This is just for bash, 'cause zsh was already doing this.
https://bugzilla.redhat.com/show_bug.cgi?id=790768
---
shell-completion/bash/systemctl.in | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git shell-completion/bash/systemctl.in shell-completion/bash/systemctl.in
index c5950cc..69ef04b 100644
--- shell-completion/bash/systemctl
+++ shell-completion/bash/systemctl
@@ -51,11 +51,13 @@ __filter_units_by_property () {
done
}
-__get_all_units () { __systemctl $1 list-units --all \
+__get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list-units --all; } \
| { while read -r a b; do echo " $a"; done; }; }
__get_active_units () { __systemctl $1 list-units \
| { while read -r a b; do echo " $a"; done; }; }
-__get_startable_units () { __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap \
+__get_startable_units () { {
+ __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap
+ __systemctl $1 list-unit-files -t service,timer,socket,mount,automount,path,snapshot,swap; } \
| { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }; }
__get_failed_units () { __systemctl $1 list-units \
| { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; }
--
1.7.9.2

View File

@ -0,0 +1,121 @@
Based on c264aeab4b0e7b69f469e12e78d4a48b3ed7a66e Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Sun, 27 Jul 2014 00:11:08 +0200
Subject: [PATCH] core: only set the kernel's timezone when the RTC runs in
local time
We can not reliably manage any notion of local time. Every daylight
saving time change or time zone change by traveling will make the
time jump, and the local time might jump backwards which creates
unsolvable problems with file timestamps.
We will no longer tell the kernel our local time zone and leave
everything set to UTC. This will effectively turn FAT timestamps
into UTC timestamps.
If and only if the machine is configured to read the RTC in local
time mode, the kernel's time zone will be configured, but
systemd-timesysnc will disable the kernel's system time to RTC
syncing. In this mode, the RTC will not be managed, and external
tools like Windows bootups are expected to manage the RTC's time.
https://bugs.freedesktop.org/show_bug.cgi?id=81538
---
src/core/main.c | 23 +++++++++++++++--------
src/shared/hwclock.c | 15 ++++++++-------
src/shared/hwclock.h | 2 +-
3 files changed, 24 insertions(+), 16 deletions(-)
--- src/core/main.c
+++ src/core/main.c 2014-07-28 09:59:35.778235585 +0000
@@ -1349,7 +1349,14 @@ int main(int argc, char *argv[]) {
if (hwclock_is_localtime() > 0) {
int min;
- /* The first-time call to settimeofday() does a time warp in the kernel */
+ /*
+ * The very first call of settimeofday() also does a time warp in the kernel.
+ *
+ * In the rtc-in-local time mode, we set the kernel's timezone, and rely on
+ * external tools to take care of maintaining the RTC and do all adjustments.
+ * This matches the behavior of Windows, which leaves the RTC alone if the
+ * registry tells that the RTC runs in UTC.
+ */
r = hwclock_set_timezone(&min);
if (r < 0)
log_error("Failed to apply local time delta, ignoring: %s", strerror(-r));
@@ -1357,19 +1364,19 @@ int main(int argc, char *argv[]) {
log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
} else if (!in_initrd()) {
/*
- * Do dummy first-time call to seal the kernel's time warp magic
+ * Do a dummy very first call to seal the kernel's time warp magic.
*
* Do not call this this from inside the initrd. The initrd might not
* carry /etc/adjtime with LOCAL, but the real system could be set up
* that way. In such case, we need to delay the time-warp or the sealing
* until we reach the real system.
+ *
+ * Do no set the kernel's timezone. The concept of local time cannot
+ * be supported reliably, the time will jump or be incorrect at every daylight
+ * saving time change. All kernel local time concepts will be treated
+ * as UTC that way.
*/
- hwclock_reset_timezone();
-
- /* Tell the kernel our timezone */
- r = hwclock_set_timezone(NULL);
- if (r < 0)
- log_error("Failed to set the kernel's timezone, ignoring: %s", strerror(-r));
+ hwclock_reset_timewarp();
}
}
--- src/shared/hwclock.c
+++ src/shared/hwclock.c 2014-07-28 09:59:12.914235566 +0000
@@ -124,9 +124,10 @@ int hwclock_set_timezone(int *min) {
tz.tz_dsttime = 0; /* DST_NONE*/
/*
- * If the hardware clock does not run in UTC, but in local time:
- * The very first time we set the kernel's timezone, it will warp
- * the clock so that it runs in UTC instead of local time.
+ * If the RTC does not run in UTC but in local time, the very first
+ * call to settimeofday() will set the kernel's timezone and will warp the
+ * system clock, so that it runs in UTC instead of the local time we
+ * have read from the RTC.
*/
if (settimeofday(tv_null, &tz) < 0)
return -errno;
@@ -135,7 +136,7 @@ int hwclock_set_timezone(int *min) {
return 0;
}
-int hwclock_reset_timezone(void) {
+int hwclock_reset_timewarp(void) {
const struct timeval *tv_null = NULL;
struct timezone tz;
@@ -143,9 +144,9 @@ int hwclock_reset_timezone(void) {
tz.tz_dsttime = 0; /* DST_NONE*/
/*
- * The very first time we set the kernel's timezone, it will warp
- * the clock. Do a dummy call here, so the time warping is sealed
- * and we set only the timezone with next call.
+ * The very first call to settimeofday() does time warp magic. Do a
+ * dummy call here, so the time warping is sealed and all later calls
+ * behave as expected.
*/
if (settimeofday(tv_null, &tz) < 0)
return -errno;
--- src/shared/hwclock.h
+++ src/shared/hwclock.h 2014-07-28 09:59:25.034736002 +0000
@@ -23,6 +23,6 @@
int hwclock_is_localtime(void);
int hwclock_set_timezone(int *min);
-int hwclock_reset_timezone(void);
+int hwclock_reset_timewarp(void);
int hwclock_get_time(struct tm *tm);
int hwclock_set_time(const struct tm *tm);

View File

@ -0,0 +1,48 @@
From 0f625d0b87139fc18cd565c9b6da05c53a0eb7ab Mon Sep 17 00:00:00 2001
From: Ansgar Burchardt <ansgar@debian.org>
Date: Sun, 27 Jul 2014 15:19:00 +0200
Subject: [PATCH] parse_boolean: require exact matches
Require exact matches in all cases instead of treating strings
starting with 't' ('f') as true (false).
This is required for config_parse_protect_system to parse ProtectSystem=full
correctly: it uses parse_boolean and only tries a more specific parsing
function if that did not return a valid result. Thus "full" was treated as
"false" before.
---
src/shared/util.c | 4 ++--
src/test/test-util.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git src/shared/util.c src/shared/util.c
index 4fda31c..49c17ef 100644
--- src/shared/util.c
+++ src/shared/util.c
@@ -231,9 +231,9 @@ int unlink_noerrno(const char *path) {
int parse_boolean(const char *v) {
assert(v);
- if (streq(v, "1") || v[0] == 'y' || v[0] == 'Y' || v[0] == 't' || v[0] == 'T' || strcaseeq(v, "on"))
+ if (streq(v, "1") || strcaseeq(v, "yes") || strcaseeq(v, "y") || strcaseeq(v, "true") || strcaseeq(v, "t") || strcaseeq(v, "on"))
return 1;
- else if (streq(v, "0") || v[0] == 'n' || v[0] == 'N' || v[0] == 'f' || v[0] == 'F' || strcaseeq(v, "off"))
+ else if (streq(v, "0") || strcaseeq(v, "no") || strcaseeq(v, "n") || strcaseeq(v, "false") || strcaseeq(v, "f") || strcaseeq(v, "off"))
return 0;
return -EINVAL;
diff --git src/test/test-util.c src/test/test-util.c
index ed91a67..9a28ef9 100644
--- src/test/test-util.c
+++ src/test/test-util.c
@@ -129,6 +129,7 @@ static void test_parse_boolean(void) {
assert_se(parse_boolean("garbage") < 0);
assert_se(parse_boolean("") < 0);
+ assert_se(parse_boolean("full") < 0);
}
static void test_parse_pid(void) {
--
1.7.9.2

View File

@ -0,0 +1,31 @@
From e2d7c1a0758ce80d7cb439745deefefdffd67655 Mon Sep 17 00:00:00 2001
From: Ansgar Burchardt <ansgar@debian.org>
Date: Sun, 27 Jul 2014 16:32:13 +0200
Subject: [PATCH] drop_duplicates: copy full BindMount struct
At least
t->ignore = f->ignore;
is missing here. Just copy the full struct to be sure.
---
src/core/namespace.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git src/core/namespace.c src/core/namespace.c
index 5466b7b..fe95377 100644
--- src/core/namespace.c
+++ src/core/namespace.c
@@ -124,8 +124,7 @@ static void drop_duplicates(BindMount *m, unsigned *n) {
if (previous && path_equal(f->path, previous->path))
continue;
- t->path = f->path;
- t->mode = f->mode;
+ *t = *f;
previous = t;
--
1.7.9.2

View File

@ -0,0 +1,87 @@
Based on c317a1a19cd9584e07ee43f1b6fafc26c2c75cca Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@gmx.com>
Date: Sun, 27 Jul 2014 15:07:03 -0400
Subject: [PATCH] shell-completion: prevent mangling unit names (bash)
This fixes the issue noted by Zbigniew in most cases.
if a unit's name is enclosed in single quotes completion still
will not happen after the first `\'.
https://bugs.freedesktop.org/show_bug.cgi?id=78388
---
shell-completion/bash/systemctl.in | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git shell-completion/bash/systemctl.in shell-completion/bash/systemctl.in
index 69ef04b..64b15df 100644
--- shell-completion/bash/systemctl
+++ shell-completion/bash/systemctl
@@ -158,20 +158,25 @@ _systemctl () {
elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then
comps=$( __get_all_units $mode )
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then
comps=$( __get_enabled_units $mode )
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then
comps=$( __get_disabled_units $mode )
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then
comps=$( __get_disabled_units $mode;
__get_enabled_units $mode )
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then
comps=$( __filter_units_by_property $mode CanStart yes \
$( __get_startable_units $mode))
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
comps=$( __filter_units_by_property $mode CanStart yes \
@@ -179,24 +184,30 @@ _systemctl () {
| while read -r line; do \
[[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo " $line"; \
done ))
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
comps=$( __filter_units_by_property $mode CanStop yes \
$( __get_active_units $mode ) )
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then
comps=$( __filter_units_by_property $mode CanReload yes \
$( __get_active_units $mode ) )
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then
comps=$( __filter_units_by_property $mode AllowIsolate yes \
$( __get_all_units $mode ) )
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then
comps=$( __get_failed_units $mode )
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then
comps=$( __get_masked_units $mode )
+ compopt -o filenames
elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then
comps=''
@@ -221,7 +232,7 @@ _systemctl () {
| { while read -r a b; do echo " $a"; done; } )
fi
- COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur") )
return 0
}
--
1.7.9.2

View File

@ -0,0 +1,40 @@
From 36dd072cdf03dcac0fcd2d6b42f261444dc7ac88 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Fri, 25 Jul 2014 14:38:22 +0200
Subject: [PATCH] journald: always add syslog facility for messages coming
from kmsg
Set SYSLOG_FACILITY field for kernel log messages too. Setting only
SYSLOG_IDENTIFIER="kernel" is not sufficient and tools reading journal
maybe confused by missing SYSLOG_FACILITY field for kernel log messages.
---
src/journal/journald-kmsg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git src/journal/journald-kmsg.c src/journal/journald-kmsg.c
index 12992e7..bb62a76 100644
--- src/journal/journald-kmsg.c
+++ src/journal/journald-kmsg.c
@@ -274,6 +274,9 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) {
if (asprintf(&syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK) >= 0)
IOVEC_SET_STRING(iovec[n++], syslog_priority);
+ if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0)
+ IOVEC_SET_STRING(iovec[n++], syslog_facility);
+
if ((priority & LOG_FACMASK) == LOG_KERN)
IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel");
else {
@@ -295,9 +298,6 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) {
if (syslog_pid)
IOVEC_SET_STRING(iovec[n++], syslog_pid);
}
-
- if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0)
- IOVEC_SET_STRING(iovec[n++], syslog_facility);
}
message = cunescape_length_with_prefix(p, pl, "MESSAGE=");
--
1.7.9.2

View File

@ -0,0 +1,19 @@
--- systemd-210/Makefile.am
+++ systemd-210/Makefile.am 2014-07-28 09:05:41.002735451 +0000
@@ -3242,11 +3242,11 @@ noinst_LTLIBRARIES += \
libsystemd-journal-core.la
journal-install-hook:
- -$(MKDIR_P) $(DESTDIR)/var/log/journal
- -chown 0:0 $(DESTDIR)/var/log/journal
- -chmod 755 $(DESTDIR)/var/log/journal
- -setfacl -nm g:adm:rx,d:g:adm:rx $(DESTDIR)/var/log/journal/
- -setfacl -nm g:wheel:rx,d:g:wheel:rx $(DESTDIR)/var/log/journal/
+ -$(MKDIR_P) $(DESTDIR)/var/log/journal/
+ -@echo chown 0:0 $(DESTDIR)/var/log/journal/
+ -chmod 755 $(DESTDIR)/var/log/journal/
+ -@echo setfacl -nm g:adm:rx,d:g:adm:rx $(DESTDIR)/var/log/journal/
+ -@echo setfacl -nm g:wheel:rx,d:g:wheel:rx $(DESTDIR)/var/log/journal/
journal-uninstall-hook:
-rmdir $(DESTDIR)/var/log/journal/

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Mon Jul 28 10:08:15 UTC 2014 - werner@suse.de
- Add patch shut-up-rpmlint-on-var-log-journal.patch to avoid
rpmlinkt warning
- Add upstream patches
0001-bus-proxyd-fix-incorrect-comparison.patch
0002-shell-completion-prevent-mangling-unit-names.patch
0003-Always-check-asprintf-return-code.patch
0004-bash-completion-use-list-unit-files-to-get-all-units.patch
0005-core-only-set-the-kernel-s-timezone-when-the-RTC-run.patch
0006-parse_boolean-require-exact-matches.patch
0007-drop_duplicates-copy-full-BindMount-struct.patch
0008-shell-completion-prevent-mangling-unit-names-bash.patch
0009-journald-always-add-syslog-facility-for-messages-com.patch
-------------------------------------------------------------------
Fri Jul 25 11:06:54 UTC 2014 - werner@suse.de

View File

@ -31,11 +31,12 @@
%else
%define has_efi 0
%endif
%bcond_with permission
%if 0%{?suse_version} > 1315
%bcond_without permission
%bcond_without blkrrpart
%bcond_without udevsettle
%else
%bcond_with permission
%bcond_with blkrrpart
%bcond_with udevsettle
%endif
@ -714,6 +715,8 @@ Patch342: 0002-man-document-yearly-and-annually-in-systemd.time-7.patch
Patch343: 0003-core-nicer-message-when-inotify-watches-are-exhauste.patch
# PATCH-FIX-UPSTREAM Fix patch 0004-systemd-detect-virt-only-discover-Xen-domU.patch
Patch344: 0001-detect-virt-Fix-Xen-domU-discovery.patch
# PATCH-FIX-SUSE Shut up rpmlint warning
Patch345: shut-up-rpmlint-on-var-log-journal.patch
# PATCH-FIX-UPSTREAM added at 2014/07/21
Patch346: 0002-Be-more-verbose-when-bind-or-listen-fails.patch
# PATCH-FIX-UPSTREAM added at 2014/07/21
@ -728,6 +731,24 @@ Patch350: 0002-journalctl-man-allow-only-between-terms.patch
Patch351: 0003-systemd-use-pager-for-test-and-help.patch
# PATCH-FIX-SUSE
Patch352: set-and-use-default-logconsole.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch353: 0001-bus-proxyd-fix-incorrect-comparison.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch354: 0002-shell-completion-prevent-mangling-unit-names.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch355: 0003-Always-check-asprintf-return-code.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch356: 0004-bash-completion-use-list-unit-files-to-get-all-units.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch357: 0005-core-only-set-the-kernel-s-timezone-when-the-RTC-run.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch358: 0006-parse_boolean-require-exact-matches.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch359: 0007-drop_duplicates-copy-full-BindMount-struct.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch360: 0008-shell-completion-prevent-mangling-unit-names-bash.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch361: 0009-journald-always-add-syslog-facility-for-messages-com.patch
# UDEV PATCHES
# ============
@ -1346,6 +1367,7 @@ cp %{SOURCE7} m4/
%patch342 -p0
%patch343 -p0
%patch344 -p0
%patch345 -p1
%patch346 -p0
%patch347 -p0
%patch348 -p0
@ -1353,6 +1375,15 @@ cp %{SOURCE7} m4/
%patch350 -p0
%patch351 -p0
%patch352 -p0
%patch353 -p0
%patch354 -p0
%patch355 -p0
%patch356 -p0
%patch357 -p0
%patch358 -p0
%patch359 -p0
%patch360 -p0
%patch361 -p0
# udev patches
%patch1001 -p1
@ -1688,7 +1719,7 @@ done
ln -s /usr/lib/udev %{buildroot}/lib/udev
# Create the /var/log/journal directory to change the volatile journal to a persistent one
mkdir -p %{buildroot}%{_localstatedir}/log/journal
mkdir -p %{buildroot}%{_localstatedir}/log/journal/
# Make sure directories in /var exist
mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/coredump
@ -1804,17 +1835,6 @@ do
ln -sf ../systemd-update-utmp-runlevel.service %{buildroot}%{_prefix}/lib/systemd/system/${runlevel}.target.wants/
done
# Add permission files for logger
%if %{with permission}
mkdir -p %{buildroot}%{_sysconfdir}/permissions.d
cat > %{buildroot}%{_sysconfdir}/permissions.d/systemd-logger <<-'EOF'
%{_localstatedir}/log/journal/ root:systemd-journal 2755
EOF
cat > %{buildroot}%{_sysconfdir}/permissions.d/systemd-logger.paranoid <<-'EOF'
%{_localstatedir}/log/journal/ root:systemd-journal 2755
EOF
%endif
%find_lang systemd
%pre
@ -1988,7 +2008,7 @@ fi
%if %{with permission}
%verifyscript logger
%verify_permissions -e %{_localstatedir}/log/journal
%verify_permissions -e %{_localstatedir}/log/journal/
%endif
%pre logger
@ -1997,7 +2017,7 @@ exit 0
%post logger
%if %{with permission}
%set_permissions %{_localstatedir}/log/journal
%set_permissions %{_localstatedir}/log/journal/
%endif
getent group wheel && setfacl -Rnm g:wheel:rx,d:g:wheel:rx %{_localstatedir}/log/journal/ > /dev/null 2>&1 || :
getent group adm && setfacl -Rnm g:adm:rx,d:g:adm:rx %{_localstatedir}/log/journal/ > /dev/null 2>&1 || :
@ -2016,7 +2036,7 @@ fi
%postun -n nss-myhostname -p /sbin/ldconfig
%pre journal-gateway
getent passwd systemd-journal-gateway >/dev/null || useradd -r -l -g systemd-journal-gateway -d %{_localstatedir}/log/journal -s /usr/sbin/nologin -c "Journal Gateway" systemd-journal-gateway >/dev/null 2>&1 || :
getent passwd systemd-journal-gateway >/dev/null || useradd -r -l -g systemd-journal-gateway -d %{_localstatedir}/log/journal/ -s /usr/sbin/nologin -c "Journal Gateway" systemd-journal-gateway >/dev/null 2>&1 || :
getent group systemd-journal-gateway >/dev/null || groupadd -r systemd-journal-gateway || :
%service_add_pre systemd-journal-gatewayd.socket systemd-journal-gatewayd.service
exit 0
@ -2400,11 +2420,7 @@ exit 0
%files logger
%defattr(-,root,root)
%if %{with permission}
%config %{_sysconfdir}/permissions.d/systemd-logger
%config %{_sysconfdir}/permissions.d/systemd-logger.paranoid
%endif
%dir %attr(2755,root,systemd-journal) %{_localstatedir}/log/journal
%dir %attr(2755,root,systemd-journal) %{_localstatedir}/log/journal/
%{_localstatedir}/log/README
/etc/init.d/systemd-journald

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Mon Jul 28 10:08:15 UTC 2014 - werner@suse.de
- Add patch shut-up-rpmlint-on-var-log-journal.patch to avoid
rpmlinkt warning
- Add upstream patches
0001-bus-proxyd-fix-incorrect-comparison.patch
0002-shell-completion-prevent-mangling-unit-names.patch
0003-Always-check-asprintf-return-code.patch
0004-bash-completion-use-list-unit-files-to-get-all-units.patch
0005-core-only-set-the-kernel-s-timezone-when-the-RTC-run.patch
0006-parse_boolean-require-exact-matches.patch
0007-drop_duplicates-copy-full-BindMount-struct.patch
0008-shell-completion-prevent-mangling-unit-names-bash.patch
0009-journald-always-add-syslog-facility-for-messages-com.patch
-------------------------------------------------------------------
Fri Jul 25 11:06:54 UTC 2014 - werner@suse.de

View File

@ -29,11 +29,12 @@
%else
%define has_efi 0
%endif
%bcond_with permission
%if 0%{?suse_version} > 1315
%bcond_without permission
%bcond_without blkrrpart
%bcond_without udevsettle
%else
%bcond_with permission
%bcond_with blkrrpart
%bcond_with udevsettle
%endif
@ -709,6 +710,8 @@ Patch342: 0002-man-document-yearly-and-annually-in-systemd.time-7.patch
Patch343: 0003-core-nicer-message-when-inotify-watches-are-exhauste.patch
# PATCH-FIX-UPSTREAM Fix patch 0004-systemd-detect-virt-only-discover-Xen-domU.patch
Patch344: 0001-detect-virt-Fix-Xen-domU-discovery.patch
# PATCH-FIX-SUSE Shut up rpmlint warning
Patch345: shut-up-rpmlint-on-var-log-journal.patch
# PATCH-FIX-UPSTREAM added at 2014/07/21
Patch346: 0002-Be-more-verbose-when-bind-or-listen-fails.patch
# PATCH-FIX-UPSTREAM added at 2014/07/21
@ -723,6 +726,24 @@ Patch350: 0002-journalctl-man-allow-only-between-terms.patch
Patch351: 0003-systemd-use-pager-for-test-and-help.patch
# PATCH-FIX-SUSE
Patch352: set-and-use-default-logconsole.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch353: 0001-bus-proxyd-fix-incorrect-comparison.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch354: 0002-shell-completion-prevent-mangling-unit-names.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch355: 0003-Always-check-asprintf-return-code.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch356: 0004-bash-completion-use-list-unit-files-to-get-all-units.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch357: 0005-core-only-set-the-kernel-s-timezone-when-the-RTC-run.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch358: 0006-parse_boolean-require-exact-matches.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch359: 0007-drop_duplicates-copy-full-BindMount-struct.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch360: 0008-shell-completion-prevent-mangling-unit-names-bash.patch
# PATCH-FIX-UPSTREAM added at 2014/07/28
Patch361: 0009-journald-always-add-syslog-facility-for-messages-com.patch
# UDEV PATCHES
# ============
@ -1341,6 +1362,7 @@ cp %{SOURCE7} m4/
%patch342 -p0
%patch343 -p0
%patch344 -p0
%patch345 -p1
%patch346 -p0
%patch347 -p0
%patch348 -p0
@ -1348,6 +1370,15 @@ cp %{SOURCE7} m4/
%patch350 -p0
%patch351 -p0
%patch352 -p0
%patch353 -p0
%patch354 -p0
%patch355 -p0
%patch356 -p0
%patch357 -p0
%patch358 -p0
%patch359 -p0
%patch360 -p0
%patch361 -p0
# udev patches
%patch1001 -p1
@ -1683,7 +1714,7 @@ done
ln -s /usr/lib/udev %{buildroot}/lib/udev
# Create the /var/log/journal directory to change the volatile journal to a persistent one
mkdir -p %{buildroot}%{_localstatedir}/log/journal
mkdir -p %{buildroot}%{_localstatedir}/log/journal/
# Make sure directories in /var exist
mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/coredump
@ -1799,17 +1830,6 @@ do
ln -sf ../systemd-update-utmp-runlevel.service %{buildroot}%{_prefix}/lib/systemd/system/${runlevel}.target.wants/
done
# Add permission files for logger
%if %{with permission}
mkdir -p %{buildroot}%{_sysconfdir}/permissions.d
cat > %{buildroot}%{_sysconfdir}/permissions.d/systemd-logger <<-'EOF'
%{_localstatedir}/log/journal/ root:systemd-journal 2755
EOF
cat > %{buildroot}%{_sysconfdir}/permissions.d/systemd-logger.paranoid <<-'EOF'
%{_localstatedir}/log/journal/ root:systemd-journal 2755
EOF
%endif
%find_lang systemd
%pre
@ -1983,7 +2003,7 @@ fi
%if %{with permission}
%verifyscript logger
%verify_permissions -e %{_localstatedir}/log/journal
%verify_permissions -e %{_localstatedir}/log/journal/
%endif
%pre logger
@ -1992,7 +2012,7 @@ exit 0
%post logger
%if %{with permission}
%set_permissions %{_localstatedir}/log/journal
%set_permissions %{_localstatedir}/log/journal/
%endif
getent group wheel && setfacl -Rnm g:wheel:rx,d:g:wheel:rx %{_localstatedir}/log/journal/ > /dev/null 2>&1 || :
getent group adm && setfacl -Rnm g:adm:rx,d:g:adm:rx %{_localstatedir}/log/journal/ > /dev/null 2>&1 || :
@ -2011,7 +2031,7 @@ fi
%postun -n nss-myhostname -p /sbin/ldconfig
%pre journal-gateway
getent passwd systemd-journal-gateway >/dev/null || useradd -r -l -g systemd-journal-gateway -d %{_localstatedir}/log/journal -s /usr/sbin/nologin -c "Journal Gateway" systemd-journal-gateway >/dev/null 2>&1 || :
getent passwd systemd-journal-gateway >/dev/null || useradd -r -l -g systemd-journal-gateway -d %{_localstatedir}/log/journal/ -s /usr/sbin/nologin -c "Journal Gateway" systemd-journal-gateway >/dev/null 2>&1 || :
getent group systemd-journal-gateway >/dev/null || groupadd -r systemd-journal-gateway || :
%service_add_pre systemd-journal-gatewayd.socket systemd-journal-gatewayd.service
exit 0
@ -2395,11 +2415,7 @@ exit 0
%files logger
%defattr(-,root,root)
%if %{with permission}
%config %{_sysconfdir}/permissions.d/systemd-logger
%config %{_sysconfdir}/permissions.d/systemd-logger.paranoid
%endif
%dir %attr(2755,root,systemd-journal) %{_localstatedir}/log/journal
%dir %attr(2755,root,systemd-journal) %{_localstatedir}/log/journal/
%{_localstatedir}/log/README
/etc/init.d/systemd-journald