[systemd-commits] stable Branch 'v210-stable' - 22 commits - hwdb/20-bluetooth-vendor-product.hwdb Makefile.am man/daemon.xml man/systemd-bootchart.xml man/systemd-run.xml man/udevadm.xml shell-completion/bash src/core src/journal src/login src/run src/shared src/test units/systemd-backlight at .service.in
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Thu Mar 6 21:55:22 PST 2014
Makefile.am | 10 +++-
hwdb/20-bluetooth-vendor-product.hwdb | 9 +++
man/daemon.xml | 4 -
man/systemd-bootchart.xml | 4 -
man/systemd-run.xml | 71 +++++++++++++++++++++++++-----
man/udevadm.xml | 2
shell-completion/bash/systemd-analyze | 24 +++++++++-
shell-completion/bash/systemd-cat | 57 ++++++++++++++++++++++++
shell-completion/bash/systemd-cgls | 56 +++++++++++++++++++++++
shell-completion/bash/systemd-cgtop | 40 ++++++++++++++++
shell-completion/bash/systemd-detect-virt | 40 ++++++++++++++++
src/core/execute.c | 18 ++++++-
src/core/load-fragment.c | 11 +---
src/core/unit.c | 42 +++++++----------
src/journal/journal-file.c | 26 ++++++++--
src/journal/sd-journal.c | 16 +++++-
src/login/logind-session.c | 2
src/run/run.c | 4 -
src/shared/architecture.c | 3 +
src/shared/architecture.h | 3 +
src/shared/conf-parser.c | 6 --
src/shared/conf-parser.h | 6 ++
src/shared/fileio.c | 9 ++-
src/shared/util.c | 24 +++++++++-
src/test/test-util.c | 42 +++++++++++++++--
units/systemd-backlight at .service.in | 6 +-
26 files changed, 452 insertions(+), 83 deletions(-)
New commits:
commit 50ab7a793277bd976ea68c1d74b999ce483af50b
Author: Thomas Bächler <thomas at archlinux.org>
Date: Fri Mar 7 01:50:34 2014 +0100
units: Do not unescape instance name in systemd-backlight at .service
The instance name is never escaped in the udev rule, but unescaped in the unit.
This results in the following error message on Asus boards:
Failed to get backlight or LED device 'backlight:eeepc/wmi': No such file or directory
(cherry picked from commit 6c49212741253dae05b89d22374186f092ef1e5a)
diff --git a/units/systemd-backlight at .service.in b/units/systemd-backlight at .service.in
index 5caa5d5..e945d87 100644
--- a/units/systemd-backlight at .service.in
+++ b/units/systemd-backlight at .service.in
@@ -6,7 +6,7 @@
# (at your option) any later version.
[Unit]
-Description=Load/Save Screen Backlight Brightness of %I
+Description=Load/Save Screen Backlight Brightness of %i
Documentation=man:systemd-backlight at .service(8)
DefaultDependencies=no
RequiresMountsFor=/var/lib/systemd/backlight
@@ -17,5 +17,5 @@ Before=sysinit.target shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=@rootlibexecdir@/systemd-backlight load %I
-ExecStop=@rootlibexecdir@/systemd-backlight save %I
+ExecStart=@rootlibexecdir@/systemd-backlight load %i
+ExecStop=@rootlibexecdir@/systemd-backlight save %i
commit 66f231f4c71dfb11dc4552cb337571d3e3019c81
Author: Armin K <krejzi at email.com>
Date: Tue Mar 4 16:23:41 2014 +0100
build-sys: Don't distribute generated udev rule
It contains hardcoded path to systemd-sysctl executable which
is /usr/lib/systemd/systemd-sysctl on latest stable release and
as such it will complain at runtime if rootprefix != prefix
[zj: readd the file to nodist_udevrules_DATA]
(cherry picked from commit e2eb18d56b14eeb405706970f0460d8539cdcf23)
diff --git a/Makefile.am b/Makefile.am
index 7187b8d..8093526 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2518,7 +2518,6 @@ dist_network_DATA = \
network/80-container-host0.network
dist_udevrules_DATA += \
- rules/99-systemd.rules \
rules/42-usb-hid-pm.rules \
rules/50-udev-default.rules \
rules/60-drm.rules \
@@ -2535,6 +2534,9 @@ dist_udevrules_DATA += \
rules/80-net-setup-link.rules \
rules/95-udev-late.rules
+nodist_udevrules_DATA += \
+ rules/99-systemd.rules
+
dist_udevhwdb_DATA = \
hwdb/20-pci-vendor-model.hwdb \
hwdb/20-pci-classes.hwdb \
commit a478182ddc3abcacd006ecef8de8829c3ec51b13
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Mar 6 23:54:13 2014 -0500
man: add missing comma
marcosf0> missing comma in udevadm "see also" section
(cherry picked from commit 7d06ef0a5cd2f0a4e021d3d12f3841cce529e0f2)
diff --git a/man/udevadm.xml b/man/udevadm.xml
index a3f8d54..21d1443 100644
--- a/man/udevadm.xml
+++ b/man/udevadm.xml
@@ -594,7 +594,7 @@
<title>See Also</title>
<para><citerefentry>
<refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum>
- </citerefentry>
+ </citerefentry>,
<citerefentry>
<refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
</citerefentry></para>
commit 7117b40be2484d2f318c14d42b8c1f47d44a4465
Author: Zachary Cook <zachcook1991 at gmail.com>
Date: Thu Mar 6 03:49:49 2014 -0500
man: systemd-bootchart - fix spacing in command
Use the same formatting as the systemd-analyze man page, so that man shows a space.
(cherry picked from commit 82ed60080d327d7301fcd55f5a1f8511f894b9d5)
diff --git a/man/systemd-bootchart.xml b/man/systemd-bootchart.xml
index d0adaad..1715d5d 100644
--- a/man/systemd-bootchart.xml
+++ b/man/systemd-bootchart.xml
@@ -78,8 +78,8 @@
in which order, and where possible problems
exist in the startup sequence of the system.
It is essentially a more detailed version of
- the <command>systemd-analyze</command>
- <command>plot</command> function.
+ the <command>systemd-analyze plot</command>
+ function.
</para>
<para>
Of course, bootchart can also be used at any
commit bc447bbd474ed77da1a9cce0dcf85fb4f0e7cb35
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Mar 6 08:10:19 2014 -0500
man: update link to LSB
https://bugzilla.redhat.com/show_bug.cgi?id=1073402
(cherry picked from commit 27d14fb331ba8144f99f4da2d13f15cf5c8b8a9f)
diff --git a/man/daemon.xml b/man/daemon.xml
index fd29ba7..ab58d08 100644
--- a/man/daemon.xml
+++ b/man/daemon.xml
@@ -252,7 +252,7 @@
detect service errors and problems. It
is recommended to follow the exit code
scheme as defined in the <ulink
- url="http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB
+ url="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB
recommendations for SysV init
scripts</ulink>.</para></listitem>
@@ -395,7 +395,7 @@
exclusively on boot (and manually by the
administrator) via SysV init scripts, as
detailed in the <ulink
- url="http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB
+ url="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB
Linux Standard Base Core
Specification</ulink>. This method of
activation is supported ubiquitously on Linux
commit b7bc83734b75499d3bf9d5446adcb43818796da5
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 6 04:52:31 2014 +0100
logind: fix reference to systemd-user-sessions.service
(cherry picked from commit 646e392e10924454576f10b072f78d7676422816)
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 548f049..3700522 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -490,7 +490,7 @@ static int session_start_scope(Session *s) {
if (!scope)
return log_oom();
- r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "systemd-logind.service", "systemd-user-session.service", &error, &job);
+ r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "systemd-logind.service", "systemd-user-sessions.service", &error, &job);
if (r < 0) {
log_error("Failed to start session scope %s: %s %s",
scope, bus_error_message(&error, r), error.name);
commit dd935122a989eeb31a0ab4d42ad5381f1f48446e
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 6 02:19:42 2014 +0100
core: correctly unregister PIDs from PID hashtables
(cherry picked from commit bd44e61b0480712ec5585ff7b0295362a5f9dd36)
diff --git a/src/core/unit.c b/src/core/unit.c
index 1bbcb39..5a5592c 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1703,11 +1703,11 @@ int unit_watch_pid(Unit *u, pid_t pid) {
/* Watch a specific PID. We only support one or two units
* watching each PID for now, not more. */
- r = hashmap_ensure_allocated(&u->manager->watch_pids1, trivial_hash_func, trivial_compare_func);
+ r = set_ensure_allocated(&u->pids, trivial_hash_func, trivial_compare_func);
if (r < 0)
return r;
- r = set_ensure_allocated(&u->pids, trivial_hash_func, trivial_compare_func);
+ r = hashmap_ensure_allocated(&u->manager->watch_pids1, trivial_hash_func, trivial_compare_func);
if (r < 0)
return r;
@@ -1736,7 +1736,17 @@ void unit_unwatch_pid(Unit *u, pid_t pid) {
set_remove(u->pids, LONG_TO_PTR(pid));
}
-static int watch_pids_in_path(Unit *u, const char *path) {
+void unit_unwatch_all_pids(Unit *u) {
+ assert(u);
+
+ while (!set_isempty(u->pids))
+ unit_unwatch_pid(u, PTR_TO_LONG(set_first(u->pids)));
+
+ set_free(u->pids);
+ u->pids = NULL;
+}
+
+static int unit_watch_pids_in_path(Unit *u, const char *path) {
_cleanup_closedir_ DIR *d = NULL;
_cleanup_fclose_ FILE *f = NULL;
int ret = 0, r;
@@ -1774,7 +1784,7 @@ static int watch_pids_in_path(Unit *u, const char *path) {
if (!p)
return -ENOMEM;
- r = watch_pids_in_path(u, p);
+ r = unit_watch_pids_in_path(u, p);
if (r < 0 && ret >= 0)
ret = r;
}
@@ -1787,31 +1797,15 @@ static int watch_pids_in_path(Unit *u, const char *path) {
return ret;
}
-
int unit_watch_all_pids(Unit *u) {
assert(u);
- if (!u->cgroup_path)
- return -ENOENT;
-
/* Adds all PIDs from our cgroup to the set of PIDs we watch */
- return watch_pids_in_path(u, u->cgroup_path);
-}
-
-void unit_unwatch_all_pids(Unit *u) {
- Iterator i;
- void *e;
-
- assert(u);
-
- SET_FOREACH(e, u->pids, i) {
- hashmap_remove_value(u->manager->watch_pids1, e, u);
- hashmap_remove_value(u->manager->watch_pids2, e, u);
- }
+ if (!u->cgroup_path)
+ return -ENOENT;
- set_free(u->pids);
- u->pids = NULL;
+ return unit_watch_pids_in_path(u, u->cgroup_path);
}
void unit_tidy_watch_pids(Unit *u, pid_t except1, pid_t except2) {
@@ -1829,7 +1823,7 @@ void unit_tidy_watch_pids(Unit *u, pid_t except1, pid_t except2) {
continue;
if (!pid_is_unwaited(pid))
- set_remove(u->pids, e);
+ unit_unwatch_pid(u, pid);
}
}
commit c360d2f3141cdc8ec67cddef3df99e4045b6c6d8
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Feb 27 00:11:54 2014 -0500
journal: forget file after encountering an error
If we encounter an inconsistency in a file, let's just
ignore it. Otherwise, after previous patch, we would try,
and fail, to use this file in every invocation of sd_journal_next
or sd_journal_previous that happens afterwards.
(cherry picked from commit a9a245c128af6c0418085062c60251bc51fa4a94)
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 3740a9a..2dbfda0 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -51,6 +51,8 @@
#define DEFAULT_DATA_THRESHOLD (64*1024)
+static void remove_file_real(sd_journal *j, JournalFile *f);
+
static bool journal_pid_changed(sd_journal *j) {
assert(j);
@@ -885,6 +887,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) {
r = next_beyond_location(j, f, direction, &o, &p);
if (r < 0) {
log_debug("Can't iterate through %s, ignoring: %s", f->path, strerror(-r));
+ remove_file_real(j, f);
continue;
} else if (r == 0)
continue;
@@ -1339,7 +1342,7 @@ static int add_file(sd_journal *j, const char *prefix, const char *filename) {
}
static int remove_file(sd_journal *j, const char *prefix, const char *filename) {
- char *path;
+ _cleanup_free_ char *path;
JournalFile *f;
assert(j);
@@ -1351,10 +1354,17 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename)
return -ENOMEM;
f = hashmap_get(j->files, path);
- free(path);
if (!f)
return 0;
+ remove_file_real(j, f);
+ return 0;
+}
+
+static void remove_file_real(sd_journal *j, JournalFile *f) {
+ assert(j);
+ assert(f);
+
hashmap_remove(j->files, f->path);
log_debug("File %s removed.", f->path);
@@ -1372,8 +1382,6 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename)
journal_file_close(f);
j->current_invalidate_counter ++;
-
- return 0;
}
static int add_directory(sd_journal *j, const char *prefix, const char *dirname) {
commit c77f203a510d27ab08729454bc865547c6111d02
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Feb 27 00:07:29 2014 -0500
journal: assume that next entry is after previous entry
With a corrupted file, we can get in a situation where two entries
in the entry array point to the same object. Then journal_file_next_entry
will find the first one using generic_arrray_bisect, and try to move to
the second one, but since the address is the same, generic_array_get will
return the first one. journal_file_next_entry ends up in an infinite loop.
https://bugzilla.redhat.com/show_bug.cgi?id=1047039
(cherry picked from commit fb099c8d2af6620db2709e826a258089d10cdfe8)
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 23c4d28..c27289c 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1359,7 +1359,7 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st
}
typedef struct ChainCacheItem {
- uint64_t first; /* the array at the begin of the chain */
+ uint64_t first; /* the array at the beginning of the chain */
uint64_t array; /* the cached array */
uint64_t begin; /* the first item in the cached array */
uint64_t total; /* the total number of items in all arrays before this one in the chain */
@@ -1945,7 +1945,7 @@ int journal_file_next_entry(
direction_t direction,
Object **ret, uint64_t *offset) {
- uint64_t i, n;
+ uint64_t i, n, ofs;
int r;
assert(f);
@@ -1986,10 +1986,24 @@ int journal_file_next_entry(
}
/* And jump to it */
- return generic_array_get(f,
- le64toh(f->header->entry_array_offset),
- i,
- ret, offset);
+ r = generic_array_get(f,
+ le64toh(f->header->entry_array_offset),
+ i,
+ ret, &ofs);
+ if (r <= 0)
+ return r;
+
+ if (p > 0 &&
+ (direction == DIRECTION_DOWN ? ofs <= p : ofs >= p)) {
+ log_debug("%s: entry array corrupted at entry %"PRIu64,
+ f->path, i);
+ return -EBADMSG;
+ }
+
+ if (offset)
+ *offset = ofs;
+
+ return 1;
}
int journal_file_skip_entry(
commit 37c3628037acb728660222ad836047c8bb81363f
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Mar 5 03:38:36 2014 +0100
systemd-run: add some extra safety checks
(cherry picked from commit 1ac67edb7c4d31a287fa98c0b554ae98bd34e71b)
diff --git a/src/run/run.c b/src/run/run.c
index 885d881..7f08c41 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -37,7 +37,7 @@ static const char *arg_description = NULL;
static const char *arg_slice = NULL;
static bool arg_send_sighup = false;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
-static char *arg_host = NULL;
+static const char *arg_host = NULL;
static bool arg_user = false;
static const char *arg_service_type = NULL;
static const char *arg_exec_user = NULL;
@@ -183,7 +183,7 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_NICE:
r = safe_atoi(optarg, &arg_nice);
- if (r < 0) {
+ if (r < 0 || arg_nice < PRIO_MIN || arg_nice >= PRIO_MAX) {
log_error("Failed to parse nice value");
return -EINVAL;
}
commit 4c626a758f12c2e5862b185de8ae954e0bd795d7
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Mar 5 03:37:48 2014 +0100
man: document missing options of systemd-run
(cherry picked from commit 981ee551945f4e00de52fcbb7780fd7476bcd47e)
diff --git a/man/systemd-run.xml b/man/systemd-run.xml
index 064195a..dc44186 100644
--- a/man/systemd-run.xml
+++ b/man/systemd-run.xml
@@ -109,9 +109,9 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<varlistentry>
<term><option>--description=</option></term>
- <listitem><para>Provide description for the unit. If not
- specified, the command itself will be used as a description.
- See <varname>Description=</varname> in
+ <listitem><para>Provide description for the service or scope
+ unit. If not specified, the command itself will be used as a
+ description. See <varname>Description=</varname> in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para></listitem>
</varlistentry>
@@ -128,10 +128,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<varlistentry>
<term><option>--remain-after-exit</option></term>
- <listitem><para>After the service's process has terminated, keep
- the service around until it is explicitly stopped. This is
- useful to collect runtime information about the service after
- it finished running. Also see
+ <listitem><para>After the service or scope process has
+ terminated, keep the service around until it is explicitly
+ stopped. This is useful to collect runtime information about
+ the service after it finished running. Also see
<varname>RemainAfterExit=</varname> in
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
@@ -141,15 +141,64 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<varlistentry>
<term><option>--send-sighup</option></term>
- <listitem><para>When terminating the scope unit, send a SIGHUP
- immediately after SIGTERM. This is useful to indicate to
- shells and shell-like processes that the connection has been
- severed. Also see <varname>SendSIGHUP=</varname> in
+ <listitem><para>When terminating the scope or service unit,
+ send a SIGHUP immediately after SIGTERM. This is useful to
+ indicate to shells and shell-like processes that the
+ connection has been severed. Also see
+ <varname>SendSIGHUP=</varname> in
<citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--service-type=</option></term>
+
+ <listitem><para>Sets the service type. Also see
+ <varname>Type=</varname> in
+ <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
+ option has no effect in conjunction with
+ <option>--scope</option>. Defaults to
+ <constant>simple</constant>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--uid=</option></term>
+ <term><option>--gid=</option></term>
+
+ <listitem><para>Runs the service process under the UNIX user
+ and group. Also see <varname>User=</varname> and
+ <varname>Group=</varname> in
+ <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
+ option has no effect in conjunction with
+ <option>--scope</option>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--nice=</option></term>
+
+ <listitem><para>Runs the service process with the specified
+ nice level. Also see <varname>Nice=</varname> in
+ <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
+ option has no effect in conjunction with
+ <option>--scope</option>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--setenv=</option></term>
+
+ <listitem><para>Runs the service process with the specified
+ environment variables set. Also see
+ <varname>Environment=</varname> in
+ <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
+ option has no effect in conjunction with
+ <option>--scope</option>.</para>
+ </listitem>
+ </varlistentry>
+
<xi:include href="user-system-options.xml" xpointer="user" />
<xi:include href="user-system-options.xml" xpointer="system" />
<xi:include href="user-system-options.xml" xpointer="host" />
commit 7f197e46c944bdb43fa1cedbd97708ac2ea72558
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date: Tue Mar 4 23:16:30 2014 +0100
add bash completion for systemd-cat
(cherry picked from commit 207017017db91232189226bfcf29e61926310a9b)
diff --git a/Makefile.am b/Makefile.am
index 834ed6f..7187b8d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -352,6 +352,7 @@ dist_bashcompletion_DATA = \
shell-completion/bash/journalctl \
shell-completion/bash/systemctl \
shell-completion/bash/systemd-analyze \
+ shell-completion/bash/systemd-cat \
shell-completion/bash/systemd-cgls \
shell-completion/bash/systemd-cgtop \
shell-completion/bash/systemd-delta \
diff --git a/shell-completion/bash/systemd-cat b/shell-completion/bash/systemd-cat
new file mode 100644
index 0000000..8d84042
--- /dev/null
+++ b/shell-completion/bash/systemd-cat
@@ -0,0 +1,57 @@
+# systemd-cat(1) completion -*- shell-script -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2014 Thomas H.P. Andersen
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+__contains_word() {
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
+}
+
+_systemd_cat() {
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
+ local i verb comps
+
+ local -A OPTS=(
+ [STANDALONE]='-h --help --version'
+ [ARG]='-t --identifier -p --priority --level-prefix'
+ )
+
+ _init_completion || return
+
+ if __contains_word "$prev" ${OPTS[ARG]}; then
+ case $prev in
+ --identifier|-t)
+ comps=''
+ ;;
+ --priority|-p)
+ comps='emerg alert crit err warning notice info debug'
+ ;;
+ --level-prefix)
+ comps='yes no'
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ return 0
+ fi
+
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
+}
+
+complete -F _systemd_cat systemd-cat
commit b4fb5c323dc77954867e0d896dce03edd094617a
Author: Umut Tezduyar Lindskog <umut.tezduyar at axis.com>
Date: Tue Mar 4 13:58:35 2014 +0100
architecture: Add cris
(cherry picked from commit 86bafac9540ba9e111ccba2fdf4161fe3a67cd3b)
diff --git a/src/shared/architecture.c b/src/shared/architecture.c
index fcdb3d5..9e0c3ef 100644
--- a/src/shared/architecture.c
+++ b/src/shared/architecture.c
@@ -114,6 +114,8 @@ Architecture uname_architecture(void) {
{ "m68k", ARCHITECTURE_M68K },
#elif defined(__tilegx__)
{ "tilegx", ARCHITECTURE_TILEGX },
+#elif defined(__cris__)
+ { "cris", ARCHITECTURE_CRIS },
#else
#error "Please register your architecture here!"
#endif
@@ -161,6 +163,7 @@ static const char *const architecture_table[_ARCHITECTURE_MAX] = {
[ARCHITECTURE_SH64] = "sh64",
[ARCHITECTURE_M68K] = "m68k",
[ARCHITECTURE_TILEGX] = "tilegx",
+ [ARCHITECTURE_CRIS] = "cris",
};
DEFINE_STRING_TABLE_LOOKUP(architecture, Architecture);
diff --git a/src/shared/architecture.h b/src/shared/architecture.h
index e589a91..20e848b 100644
--- a/src/shared/architecture.h
+++ b/src/shared/architecture.h
@@ -48,6 +48,7 @@ typedef enum Architecture {
ARCHITECTURE_SH64,
ARCHITECTURE_M68K,
ARCHITECTURE_TILEGX,
+ ARCHITECTURE_CRIS,
_ARCHITECTURE_MAX,
_ARCHITECTURE_INVALID = -1
} Architecture;
@@ -110,6 +111,8 @@ Architecture uname_architecture(void);
# define native_architecture() ARCHITECTURE_M68K
#elif defined(__tilegx__)
# define native_architecture() ARCHITECTURE_TILEGX
+#elif defined(__cris__)
+# define native_architecture() ARCHITECTURE_CRIS
#else
#error "Please register your architecture here!"
#endif
commit 799f37dd06946958dfed2aec54788c5e81bf340a
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Tue Mar 4 09:50:26 2014 -0500
Do not print invalid UTF-8 in error messages
Inexplicably, 550a40ec ('core: do not print invalid utf-8 in error
messages') only fixed two paths. Convert all of them now.
(cherry picked from commit b5d742138f71e87312541a89aac5657015f50f48)
Conflicts:
src/core/load-fragment.c
src/shared/conf-parser.c
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 82aed1e..027ec5f 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -535,9 +535,7 @@ int config_parse_exec(const char *unit,
}
if (!utf8_is_valid(path)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Path is not UTF-8 clean, ignoring assignment: %s",
- rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
r = 0;
goto fail;
}
@@ -552,9 +550,7 @@ int config_parse_exec(const char *unit,
}
if (!utf8_is_valid(c)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Path is not UTF-8 clean, ignoring assignment: %s",
- rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
r = 0;
goto fail;
}
@@ -1959,8 +1955,7 @@ int config_parse_unit_requires_mounts_for(
return log_oom();
if (!utf8_is_valid(n)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Path is not UTF-8 clean, ignoring assignment: %s", rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
continue;
}
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index cfa669b..b6aa856 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -656,8 +656,7 @@ int config_parse_path(const char *unit,
assert(data);
if (!utf8_is_valid(rvalue)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Path is not UTF-8 clean, ignoring assignment: %s", rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
return 0;
}
@@ -725,8 +724,7 @@ int config_parse_strv(const char *unit,
return log_oom();
if (!utf8_is_valid(n)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "String is not UTF-8 clean, ignoring: %s", rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
continue;
}
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index 4ccdadd..7e1c493 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -124,6 +124,12 @@ int log_syntax_internal(const char *unit, int level,
config_file, config_line, \
error, __VA_ARGS__)
+#define log_invalid_utf8(unit, level, config_file, config_line, error, rvalue) { \
+ _cleanup_free_ char *__p = utf8_escape_invalid(rvalue); \
+ log_syntax(unit, level, config_file, config_line, error, \
+ "String is not UTF-8 clean, ignoring assignment: %s", __p); \
+ }
+
#define DEFINE_CONFIG_PARSE_ENUM(function,name,type,msg) \
int function(const char *unit, \
const char *filename, \
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 0d3f2e9..fcd1b8a 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -598,15 +598,18 @@ static int load_env_file_push(const char *filename, unsigned line,
int r;
if (!utf8_is_valid(key)) {
+ _cleanup_free_ char *t = utf8_escape_invalid(key);
+
log_error("%s:%u: invalid UTF-8 for key '%s', ignoring.",
- filename, line, key);
+ filename, line, t);
return -EINVAL;
}
if (value && !utf8_is_valid(value)) {
- /* FIXME: filter UTF-8 */
+ _cleanup_free_ char *t = utf8_escape_invalid(value);
+
log_error("%s:%u: invalid UTF-8 value for key %s: '%s', ignoring.",
- filename, line, key, value);
+ filename, line, key, t);
return -EINVAL;
}
commit 191479e0e4fb43f667ce743e82aac8bcccfbd6e1
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date: Mon Mar 3 22:16:04 2014 +0100
add bash completion for systemd-detect-virt
(cherry picked from commit 3bfe58cbd4a9b1d2520f425f95de718f3a583d39)
diff --git a/Makefile.am b/Makefile.am
index bc5e719..834ed6f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -355,6 +355,7 @@ dist_bashcompletion_DATA = \
shell-completion/bash/systemd-cgls \
shell-completion/bash/systemd-cgtop \
shell-completion/bash/systemd-delta \
+ shell-completion/bash/systemd-detect-virt \
shell-completion/bash/systemd-nspawn \
shell-completion/bash/systemd-run \
shell-completion/bash/udevadm \
diff --git a/shell-completion/bash/systemd-detect-virt b/shell-completion/bash/systemd-detect-virt
new file mode 100644
index 0000000..df06c29
--- /dev/null
+++ b/shell-completion/bash/systemd-detect-virt
@@ -0,0 +1,40 @@
+# systemd-detect-virt(1) completion -*- shell-script -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2014 Thomas H.P. Andersen
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+__contains_word() {
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
+}
+
+_systemd_detect_virt() {
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
+ local i verb comps
+
+ local -A OPTS=(
+ [STANDALONE]='-h --help --version -c --container -v --vm -q --quiet'
+ )
+
+ _init_completion || return
+
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
+}
+
+complete -F _systemd_detect_virt systemd-detect-virt
commit 1ec5be9a85b46c697fc87405038427eaf9bebe1b
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date: Mon Mar 3 22:01:42 2014 +0100
update bash completion for systemd-analyze
(cherry picked from commit 64ae7f1864d54f38d62e258322a7ea9756c7284b)
diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze
index 6afcd96..5575beb 100644
--- a/shell-completion/bash/systemd-analyze
+++ b/shell-completion/bash/systemd-analyze
@@ -25,10 +25,19 @@ __contains_word () {
done
}
+__get_machines() {
+ local a b
+ machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; };
+}
+
_systemd_analyze() {
local i verb comps
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
- local OPTS='--help --version --system --user --from-pattern --to-pattern --order --require'
+
+ local -A OPTS=(
+ [STANDALONE]='--help --version --system --user --from-pattern --to-pattern --order --require --no-pager'
+ [ARG]='-H --host -M --machine'
+ )
local -A VERBS=(
[STANDALONE]='time blame plot dump'
@@ -47,6 +56,19 @@ _systemd_analyze() {
fi
done
+ if __contains_word "$prev" ${OPTS[ARG]}; then
+ case $prev in
+ --host|-H)
+ comps=$(compgen -A hostname)
+ ;;
+ --machine|-M)
+ comps=$( __get_machines )
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ return 0
+ fi
+
if [[ -z $verb && $cur = -* ]]; then
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
return 0
commit f0eb7735d8cdf44ebf7064613add363ddda329b0
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Mar 3 17:11:39 2014 +0100
execute: free directory path if we fail to remove it because we cannot allocate a thread
(cherry picked from commit 98b47d54ce946ad3524f84eb38d2413498a333dc)
diff --git a/src/core/execute.c b/src/core/execute.c
index a328fc2..bb06507 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -2579,6 +2579,8 @@ static void *remove_tmpdir_thread(void *p) {
}
void exec_runtime_destroy(ExecRuntime *rt) {
+ int r;
+
if (!rt)
return;
@@ -2588,13 +2590,25 @@ void exec_runtime_destroy(ExecRuntime *rt) {
if (rt->tmp_dir) {
log_debug("Spawning thread to nuke %s", rt->tmp_dir);
- asynchronous_job(remove_tmpdir_thread, rt->tmp_dir);
+
+ r = asynchronous_job(remove_tmpdir_thread, rt->tmp_dir);
+ if (r < 0) {
+ log_warning("Failed to nuke %s: %s", rt->tmp_dir, strerror(-r));
+ free(rt->tmp_dir);
+ }
+
rt->tmp_dir = NULL;
}
if (rt->var_tmp_dir) {
log_debug("Spawning thread to nuke %s", rt->var_tmp_dir);
- asynchronous_job(remove_tmpdir_thread, rt->var_tmp_dir);
+
+ r = asynchronous_job(remove_tmpdir_thread, rt->var_tmp_dir);
+ if (r < 0) {
+ log_warning("Failed to nuke %s: %s", rt->var_tmp_dir, strerror(-r));
+ free(rt->var_tmp_dir);
+ }
+
rt->var_tmp_dir = NULL;
}
commit 877c2fccf76afdd7364040f9b859c8d84226b9cc
Author: Mike Gilbert <floppym at gentoo.org>
Date: Sun Mar 2 23:37:39 2014 -0500
Fix systemd-stdio-bridge symlink
The symlink is created in bindir (/usr/bin), and points to a binary
which lives in rootlibexecdir (/lib/systemd or /usr/lib/systemd). A
relative symlink does not work here.
(cherry picked from commit 8100c1a8f58b2fb5d97e156420a7e16562e93bc4)
diff --git a/Makefile.am b/Makefile.am
index 9cabd1d..bc5e719 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1955,7 +1955,7 @@ systemd_bus_proxyd_LDADD = \
bus-proxyd-install-hook:
$(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
- $(AM_V_LN)$(LN_S) -f ../lib/systemd/systemd-bus-proxyd $(DESTDIR)$(bindir)/systemd-stdio-bridge
+ $(AM_V_LN)$(LN_S) -f $(rootlibexecdir)/systemd-bus-proxyd $(DESTDIR)$(bindir)/systemd-stdio-bridge
bus-proxyd-uninstall-hook:
rm -f $(DESTDIR)$(bindir)/systemd-stdio-bridge
commit 6b4293393eb0a15e4f73ba9f08554178ccc4c222
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date: Sun Mar 2 22:58:18 2014 +0100
add bash completion for systemd-cgtop
(cherry picked from commit d9256bac4da4241cb5d97960c899390839f2c6e5)
diff --git a/Makefile.am b/Makefile.am
index 0b83823..9cabd1d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -353,6 +353,7 @@ dist_bashcompletion_DATA = \
shell-completion/bash/systemctl \
shell-completion/bash/systemd-analyze \
shell-completion/bash/systemd-cgls \
+ shell-completion/bash/systemd-cgtop \
shell-completion/bash/systemd-delta \
shell-completion/bash/systemd-nspawn \
shell-completion/bash/systemd-run \
diff --git a/shell-completion/bash/systemd-cgtop b/shell-completion/bash/systemd-cgtop
new file mode 100644
index 0000000..d7ea42d
--- /dev/null
+++ b/shell-completion/bash/systemd-cgtop
@@ -0,0 +1,40 @@
+# systemd-cgtop(1) completion -*- shell-script -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2014 Thomas H.P. Andersen
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+__contains_word() {
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
+}
+
+_systemd_cgtop() {
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
+ local comps
+
+ local -A OPTS=(
+ [STANDALONE]='-h --help --version -p -t -c -m -i -b --batch -n --iterations -d --delay'
+ )
+
+ _init_completion || return
+
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
+}
+
+complete -F _systemd_cgtop systemd-cgtop
commit 4cae8946d581a6ecf0b26e154bf9c00e390024b2
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Mar 2 00:05:16 2014 -0500
Allow fractional parts in disk sizes
It seems natural to be able to say SystemMaxUsage=1.5G.
https://bugzilla.redhat.com/show_bug.cgi?id=1047568
(cherry picked from commit 9480794b277b5ce33e467578ed669996df576bb9)
diff --git a/src/shared/util.c b/src/shared/util.c
index 5cb598c..3164515 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2198,6 +2198,8 @@ int parse_size(const char *t, off_t base, off_t *size) {
p = t;
do {
long long l;
+ unsigned long long l2;
+ double frac = 0;
char *e;
unsigned i;
@@ -2213,14 +2215,32 @@ int parse_size(const char *t, off_t base, off_t *size) {
if (e == p)
return -EINVAL;
+ if (*e == '.') {
+ e++;
+ if (*e >= '0' && *e <= '9') {
+ char *e2;
+
+ /* strotoull itself would accept space/+/- */
+ l2 = strtoull(e, &e2, 10);
+
+ if (errno == ERANGE)
+ return -errno;
+
+ /* Ignore failure. E.g. 10.M is valid */
+ frac = l2;
+ for (; e < e2; e++)
+ frac /= 10;
+ }
+ }
+
e += strspn(e, WHITESPACE);
for (i = 0; i < n_entries; i++)
if (startswith(e, table[i].suffix)) {
unsigned long long tmp;
- if ((unsigned long long) l > ULLONG_MAX / table[i].factor)
+ if ((unsigned long long) l + (frac > 0) > ULLONG_MAX / table[i].factor)
return -ERANGE;
- tmp = l * table[i].factor;
+ tmp = l * table[i].factor + (unsigned long long) (frac * table[i].factor);
if (tmp > ULLONG_MAX - r)
return -ERANGE;
diff --git a/src/test/test-util.c b/src/test/test-util.c
index b718206..74f83a2 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -30,6 +30,7 @@
#include "strv.h"
#include "def.h"
#include "fileio.h"
+#include "conf-parser.h"
static void test_streq_ptr(void) {
assert_se(streq_ptr(NULL, NULL));
@@ -441,17 +442,32 @@ static void test_parse_size(void) {
assert_se(parse_size("111", 1024, &bytes) == 0);
assert_se(bytes == 111);
+ assert_se(parse_size("111.4", 1024, &bytes) == 0);
+ assert_se(bytes == 111);
+
assert_se(parse_size(" 112 B", 1024, &bytes) == 0);
assert_se(bytes == 112);
- assert_se(parse_size("3 K", 1024, &bytes) == 0);
+ assert_se(parse_size(" 112.6 B", 1024, &bytes) == 0);
+ assert_se(bytes == 112);
+
+ assert_se(parse_size("3.5 K", 1024, &bytes) == 0);
+ assert_se(bytes == 3*1024 + 512);
+
+ assert_se(parse_size("3. K", 1024, &bytes) == 0);
+ assert_se(bytes == 3*1024);
+
+ assert_se(parse_size("3.0 K", 1024, &bytes) == 0);
assert_se(bytes == 3*1024);
- assert_se(parse_size(" 4 M 11K", 1024, &bytes) == 0);
- assert_se(bytes == 4*1024*1024 + 11 * 1024);
+ assert_se(parse_size("3. 0 K", 1024, &bytes) == 0);
+ assert_se(bytes == 3);
- assert_se(parse_size("3B3G", 1024, &bytes) == 0);
- assert_se(bytes == 3ULL*1024*1024*1024 + 3);
+ assert_se(parse_size(" 4 M 11.5K", 1024, &bytes) == 0);
+ assert_se(bytes == 4*1024*1024 + 11 * 1024 + 512);
+
+ assert_se(parse_size("3B3.5G", 1024, &bytes) == 0);
+ assert_se(bytes == 3ULL*1024*1024*1024 + 512*1024*1024 + 3);
assert_se(parse_size("3B3G4T", 1024, &bytes) == 0);
assert_se(bytes == (4ULL*1024 + 3)*1024*1024*1024 + 3);
@@ -464,6 +480,10 @@ static void test_parse_size(void) {
assert_se(parse_size("12X", 1024, &bytes) == -EINVAL);
+ assert_se(parse_size("12.5X", 1024, &bytes) == -EINVAL);
+
+ assert_se(parse_size("12.5e3", 1024, &bytes) == -EINVAL);
+
assert_se(parse_size("1024E", 1024, &bytes) == -ERANGE);
assert_se(parse_size("-1", 1024, &bytes) == -ERANGE);
assert_se(parse_size("-1024E", 1024, &bytes) == -ERANGE);
@@ -473,6 +493,14 @@ static void test_parse_size(void) {
assert_se(parse_size("-10B 20K", 1024, &bytes) == -ERANGE);
}
+static void test_config_parse_iec_off(void) {
+ off_t offset = 0;
+ assert_se(config_parse_iec_off(NULL, "/this/file", 11, "Section", 22, "Size", 0, "4M", &offset, NULL) == 0);
+ assert_se(offset == 4 * 1024 * 1024);
+
+ assert_se(config_parse_iec_off(NULL, "/this/file", 11, "Section", 22, "Size", 0, "4.5M", &offset, NULL) == 0);
+}
+
static void test_strextend(void) {
_cleanup_free_ char *str = strdup("0123");
strextend(&str, "456", "78", "9", NULL);
@@ -589,6 +617,9 @@ static void test_writing_tmpfile(void) {
}
int main(int argc, char *argv[]) {
+ log_parse_environment();
+ log_open();
+
test_streq_ptr();
test_first_word();
test_close_many();
@@ -618,6 +649,7 @@ int main(int argc, char *argv[]) {
test_get_process_comm();
test_protect_errno();
test_parse_size();
+ test_config_parse_iec_off();
test_strextend();
test_strrep();
test_split_pair();
commit a63a8b12c107215fa8b84ca792e84bc2789e6163
Author: Marcel Holtmann <marcel at holtmann.org>
Date: Sun Mar 2 10:02:10 2014 -0800
hwdb: Update database of Bluetooth company identifiers
(cherry picked from commit e525326bd07ebf3cabcfd730bc479166723f2d44)
diff --git a/hwdb/20-bluetooth-vendor-product.hwdb b/hwdb/20-bluetooth-vendor-product.hwdb
index db3bc24..0335a71 100644
--- a/hwdb/20-bluetooth-vendor-product.hwdb
+++ b/hwdb/20-bluetooth-vendor-product.hwdb
@@ -902,3 +902,12 @@ bluetooth:v0129*
bluetooth:v012A*
ID_VENDOR_FROM_DATABASE=Changzhou Yongse Infotech Co., Ltd
+
+bluetooth:v012B*
+ ID_VENDOR_FROM_DATABASE=SportIQ
+
+bluetooth:v012C*
+ ID_VENDOR_FROM_DATABASE=TEMEC Instruments B.V.
+
+bluetooth:v012D*
+ ID_VENDOR_FROM_DATABASE=Sony Corporation
commit 8523c2a84f3d8a8b163a17aad5c55cb0234ebff2
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date: Sat Mar 1 23:08:38 2014 +0100
add bash completion for systemd-cgls
(cherry picked from commit abdab4f602745952030a37b1521cd0374d51d3ea)
diff --git a/Makefile.am b/Makefile.am
index 8e6c392..0b83823 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -352,6 +352,7 @@ dist_bashcompletion_DATA = \
shell-completion/bash/journalctl \
shell-completion/bash/systemctl \
shell-completion/bash/systemd-analyze \
+ shell-completion/bash/systemd-cgls \
shell-completion/bash/systemd-delta \
shell-completion/bash/systemd-nspawn \
shell-completion/bash/systemd-run \
diff --git a/shell-completion/bash/systemd-cgls b/shell-completion/bash/systemd-cgls
new file mode 100644
index 0000000..0570438
--- /dev/null
+++ b/shell-completion/bash/systemd-cgls
@@ -0,0 +1,56 @@
+# systemd-cgls(1) completion -*- shell-script -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2014 Thomas H.P. Andersen
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+__contains_word() {
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
+}
+
+__get_machines() {
+ local a b
+ machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; };
+}
+
+_systemd_cgls() {
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
+ local i verb comps
+
+ local -A OPTS=(
+ [STANDALONE]='-h --help --version --all -l --full -k --no-pager'
+ [ARG]='-M --machine'
+ )
+
+ _init_completion || return
+
+ if __contains_word "$prev" ${OPTS[ARG]}; then
+ case $prev in
+ --machine|-M)
+ comps=$( __get_machines )
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ return 0
+ fi
+
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
+}
+
+complete -F _systemd_cgls systemd-cgls
More information about the systemd-commits
mailing list