[systemd-commits] 10 commits - src/core src/cryptsetup src/gpt-auto-generator src/journal src/libudev src/shared src/sysctl src/sysv-generator src/tmpfiles units/systemd-udevd.service.in
Zbigniew Jędrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Sat Mar 14 20:58:29 PDT 2015
src/core/main.c | 4 +-
src/cryptsetup/cryptsetup-generator.c | 7 ---
src/gpt-auto-generator/gpt-auto-generator.c | 52 +++++++++++++-------------
src/journal/journald-audit.c | 6 ++-
src/libudev/libudev-device.c | 4 +-
src/shared/install.c | 55 ++++++++++++++++------------
src/shared/install.h | 11 +++++
src/shared/path-lookup.c | 1
src/shared/path-lookup.h | 3 +
src/shared/util.c | 3 -
src/sysctl/sysctl.c | 2 -
src/sysv-generator/sysv-generator.c | 14 +++----
src/tmpfiles/tmpfiles.c | 2 -
units/systemd-udevd.service.in | 2 -
14 files changed, 91 insertions(+), 75 deletions(-)
New commits:
commit cd556b6ca8aec8dd371806afedec45f852f8f724
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Wed Mar 4 10:31:42 2015 -0500
journald: add syslog fields for audit messages
Audit messages would be displayed as "unknown[1]".
Also specify AUTH as facility... This seems to be the closest match
(/* security/authorization messages */).
diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c
index c2f1545..46eb82f 100644
--- a/src/journal/journald-audit.c
+++ b/src/journal/journald-audit.c
@@ -373,7 +373,7 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s
if (isempty(p))
return;
- n_iov_allocated = N_IOVEC_META_FIELDS + 5;
+ n_iov_allocated = N_IOVEC_META_FIELDS + 7;
iov = new(struct iovec, n_iov_allocated);
if (!iov) {
log_oom();
@@ -392,6 +392,10 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s
sprintf(id_field, "_AUDIT_ID=%" PRIu64, id);
IOVEC_SET_STRING(iov[n_iov++], id_field);
+ assert_cc(32 == LOG_AUTH);
+ IOVEC_SET_STRING(iov[n_iov++], "SYSLOG_FACILITY=32");
+ IOVEC_SET_STRING(iov[n_iov++], "SYSLOG_IDENTIFIER=audit");
+
m = alloca(strlen("MESSAGE=<audit-") + DECIMAL_STR_MAX(int) + strlen("> ") + strlen(p) + 1);
sprintf(m, "MESSAGE=<audit-%i> %s", type, p);
IOVEC_SET_STRING(iov[n_iov++], m);
commit 924bc14fef39373f4523664207007a6c82c2b2d5
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 14 22:56:01 2015 -0400
sysctl: tweak debug message
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index dd2e118..43c765f 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -77,7 +77,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
return log_error_errno(r, "Failed to open file '%s', ignoring: %m", path);
}
- log_debug("parse: %s", path);
+ log_debug("Parsing %s", path);
while (!feof(f)) {
char l[LINE_MAX], *p, *value, *new_value, *property, *existing;
void *v;
commit 71e4e1258436e7e81d772aed52a02bb5d9c87cb8
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 14 22:35:30 2015 -0400
cryptsetup-generator: remove warning about crypttab access mode
This file contains no privileged data — just names of devices to decrypt
and files containing keys. On a running system most of this can be inferred from
the device tree anyway.
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 5a0611a..5d234e6 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -374,13 +374,6 @@ static int add_crypttab_devices(void) {
return 0;
}
- /* If we readd support for specifying passphrases
- * directly in crypttab we should upgrade the warning
- * below, though possibly only if a passphrase is
- * specified directly. */
- if (st.st_mode & 0005)
- log_debug("/etc/crypttab is world-readable. This is usually not a good idea.");
-
for (;;) {
int r, k;
char line[LINE_MAX], *l, *uuid;
commit cdd45c1ffbf790facd1817757832aa25d9211967
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 14 22:22:49 2015 -0400
udev: downgrade "has devpath" and "filled with db file" messages
Udev debug messages have to be significantly overhauled... For now
just downgrade those two. They are responsible for approximately 25%
of debug output during boot and are rather useless.
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index b518a2f..c182f07 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -642,7 +642,7 @@ int udev_device_read_db(struct udev_device *udev_device)
}
fclose(f);
- log_debug("device %p filled with db file data", udev_device);
+ log_trace("device %p filled with db file data", udev_device);
return 0;
}
@@ -804,7 +804,7 @@ _public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
return NULL;
udev_device_set_syspath(udev_device, path);
- log_debug("device %p has devpath '%s'", udev_device, udev_device_get_devpath(udev_device));
+ log_trace("device %p has devpath '%s'", udev_device, udev_device_get_devpath(udev_device));
return udev_device;
}
commit d2a623823f8d83c97c35fcd28f90e8cd59066f8a
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 14 22:15:05 2015 -0400
gpt-auto-generator: prefix messages with device name
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 9f2da79..99dc50f 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -346,7 +346,7 @@ static int enumerate_partitions(dev_t devnum) {
_cleanup_free_ char *home = NULL, *srv = NULL;
struct udev_list_entry *first, *item;
struct udev_device *parent = NULL;
- const char *node, *pttype, *devtype;
+ const char *name, *node, *pttype, *devtype;
int home_nr = -1, srv_nr = -1;
bool home_rw = true, srv_rw = true;
blkid_partlist pl;
@@ -361,33 +361,42 @@ static int enumerate_partitions(dev_t devnum) {
if (!d)
return log_oom();
+ name = udev_device_get_devnode(d);
+ if (!name)
+ name = udev_device_get_syspath(d);
+ if (!name) {
+ log_debug("Device %u:%u does not have a name, ignoring.",
+ major(devnum), minor(devnum));
+ return 0;
+ }
+
parent = udev_device_get_parent(d);
if (!parent) {
- log_debug("Not a partitioned device, ignoring.");
+ log_debug("%s: not a partitioned device, ignoring.", name);
return 0;
}
/* Does it have a devtype? */
devtype = udev_device_get_devtype(parent);
if (!devtype) {
- log_debug("Parent doesn't have a device type, ignoring.");
+ log_debug("%s: parent doesn't have a device type, ignoring.", name);
return 0;
}
/* Is this a disk or a partition? We only care for disks... */
if (!streq(devtype, "disk")) {
- log_debug("Parent isn't a raw disk, ignoring.");
+ log_debug("%s: parent isn't a raw disk, ignoring.", name);
return 0;
}
/* Does it have a device node? */
node = udev_device_get_devnode(parent);
if (!node) {
- log_debug("Parent device does not have device node, ignoring.");
+ log_debug("%s: parent device does not have device node, ignoring.", name);
return 0;
}
- log_debug("Root device %s.", node);
+ log_debug("%s: root device %s.", name, node);
pn = udev_device_get_devnum(parent);
if (major(pn) == 0)
@@ -399,8 +408,7 @@ static int enumerate_partitions(dev_t devnum) {
if (errno == 0)
return log_oom();
- log_error_errno(errno, "Failed allocate prober: %m");
- return -errno;
+ return log_error_errno(errno, "%s: failed to allocate prober: %m", node);
}
blkid_probe_enable_partitions(b, 1);
@@ -410,25 +418,18 @@ static int enumerate_partitions(dev_t devnum) {
r = blkid_do_safeprobe(b);
if (r == -2 || r == 1) /* no result or uncertain */
return 0;
- else if (r != 0) {
- if (errno == 0)
- errno = EIO;
- log_error_errno(errno, "Failed to probe %s: %m", node);
- return -errno;
- }
+ else if (r != 0)
+ return log_error_errno(errno ?: EIO, "%s: failed to probe: %m", node);
errno = 0;
r = blkid_probe_lookup_value(b, "PTTYPE", &pttype, NULL);
- if (r != 0) {
- if (errno == 0)
- errno = EIO;
- log_error_errno(errno, "Failed to determine partition table type of %s: %m", node);
- return -errno;
- }
+ if (r != 0)
+ return log_error_errno(errno ?: EIO,
+ "%s: failed to determine partition table type: %m", node);
/* We only do this all for GPT... */
if (!streq_ptr(pttype, "gpt")) {
- log_debug("Not a GPT partition table, ignoring.");
+ log_debug("%s: not a GPT partition table, ignoring.", node);
return 0;
}
@@ -438,8 +439,7 @@ static int enumerate_partitions(dev_t devnum) {
if (errno == 0)
return log_oom();
- log_error_errno(errno, "Failed to list partitions of %s: %m", node);
- return -errno;
+ return log_error_errno(errno, "%s: failed to list partitions: %m", node);
}
e = udev_enumerate_new(udev);
@@ -456,7 +456,7 @@ static int enumerate_partitions(dev_t devnum) {
r = udev_enumerate_scan_devices(e);
if (r < 0)
- return log_error_errno(r, "Failed to enumerate partitions on %s: %m", node);
+ return log_error_errno(r, "%s: failed to enumerate partitions: %m", node);
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
@@ -511,7 +511,7 @@ static int enumerate_partitions(dev_t devnum) {
if (sd_id128_equal(type_id, GPT_SWAP)) {
if (flags & GPT_FLAG_READ_ONLY) {
- log_debug("%s marked as read-only swap partition, which is bogus, ignoring.", subnode);
+ log_debug("%s marked as read-only swap partition, which is bogus. Ignoring.", subnode);
continue;
}
@@ -597,7 +597,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
r = parse_boolean(value);
if (r < 0)
- log_warning("Failed to parse gpt-auto switch %s. Ignoring.", value);
+ log_warning("Failed to parse gpt-auto switch \"%s\". Ignoring.", value);
else
arg_enabled = r;
commit d3f86679783aee216d60b125acfb5f39a0df555f
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 14 21:49:10 2015 -0400
core: do not use quotes around virt and arch
Quotes are useful when the string can contain spaces or be otherwise
confusing. Not possible with those two.
diff --git a/src/core/main.c b/src/core/main.c
index d68e737..3ec70f9 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1532,11 +1532,11 @@ int main(int argc, char *argv[]) {
detect_virtualization(&virtualization);
if (virtualization)
- log_info("Detected virtualization '%s'.", virtualization);
+ log_info("Detected virtualization %s.", virtualization);
write_container_id();
- log_info("Detected architecture '%s'.", architecture_to_string(uname_architecture()));
+ log_info("Detected architecture %s.", architecture_to_string(uname_architecture()));
if (in_initrd())
log_info("Running in initial RAM disk.");
commit a8ffe6fbcbfdba39aef8dce8b298b3e0cb377c0e
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 14 21:46:59 2015 -0400
sysv-generator: initialize LookupPaths just once
With debugging on, sysv-generator would print the full set of
lookup paths for *every* sysv script.
While at it, pass LookupPaths as a pointer in sysv-generator,
and constify it everywhere.
diff --git a/src/shared/install.c b/src/shared/install.c
index 7a7ec19..9c680a7 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1083,7 +1083,7 @@ static int unit_file_load(
static int unit_file_search(
InstallContext *c,
InstallInfo *info,
- LookupPaths *paths,
+ const LookupPaths *paths,
const char *root_dir,
bool allow_symlink,
bool load,
@@ -1152,7 +1152,7 @@ static int unit_file_search(
}
static int unit_file_can_install(
- LookupPaths *paths,
+ const LookupPaths *paths,
const char *root_dir,
const char *name,
bool allow_symlink,
@@ -1316,7 +1316,7 @@ static int install_info_symlink_wants(
static int install_info_symlink_link(
InstallInfo *i,
- LookupPaths *paths,
+ const LookupPaths *paths,
const char *config_path,
const char *root_dir,
bool force,
@@ -1344,7 +1344,7 @@ static int install_info_symlink_link(
static int install_info_apply(
InstallInfo *i,
- LookupPaths *paths,
+ const LookupPaths *paths,
const char *config_path,
const char *root_dir,
bool force,
@@ -1376,7 +1376,7 @@ static int install_info_apply(
static int install_context_apply(
InstallContext *c,
- LookupPaths *paths,
+ const LookupPaths *paths,
const char *config_path,
const char *root_dir,
bool force,
@@ -1423,7 +1423,7 @@ static int install_context_apply(
static int install_context_mark_for_removal(
InstallContext *c,
- LookupPaths *paths,
+ const LookupPaths *paths,
Set **remove_symlinks_to,
const char *config_path,
const char *root_dir) {
@@ -1784,39 +1784,28 @@ int unit_file_get_default(
return -ENOENT;
}
-UnitFileState unit_file_get_state(
+UnitFileState unit_file_lookup_state(
UnitFileScope scope,
const char *root_dir,
+ const LookupPaths *paths,
const char *name) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
UnitFileState state = _UNIT_FILE_STATE_INVALID;
char **i;
_cleanup_free_ char *path = NULL;
int r;
- assert(scope >= 0);
- assert(scope < _UNIT_FILE_SCOPE_MAX);
- assert(name);
-
- if (root_dir && scope != UNIT_FILE_SYSTEM)
- return -EINVAL;
+ assert(paths);
if (!unit_name_is_valid(name, TEMPLATE_VALID))
return -EINVAL;
- r = lookup_paths_init_from_scope(&paths, scope, root_dir);
- if (r < 0)
- return r;
-
- STRV_FOREACH(i, paths.unit_path) {
+ STRV_FOREACH(i, paths->unit_path) {
struct stat st;
char *partial;
bool also = false;
free(path);
- path = NULL;
-
path = path_join(root_dir, *i, name);
if (!path)
return -ENOMEM;
@@ -1857,7 +1846,7 @@ UnitFileState unit_file_get_state(
else if (r > 0)
return state;
- r = unit_file_can_install(&paths, root_dir, partial, true, &also);
+ r = unit_file_can_install(paths, root_dir, partial, true, &also);
if (r < 0 && errno != ENOENT)
return r;
else if (r > 0)
@@ -1872,6 +1861,28 @@ UnitFileState unit_file_get_state(
return r < 0 ? r : state;
}
+UnitFileState unit_file_get_state(
+ UnitFileScope scope,
+ const char *root_dir,
+ const char *name) {
+
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ int r;
+
+ assert(scope >= 0);
+ assert(scope < _UNIT_FILE_SCOPE_MAX);
+ assert(name);
+
+ if (root_dir && scope != UNIT_FILE_SYSTEM)
+ return -EINVAL;
+
+ r = lookup_paths_init_from_scope(&paths, scope, root_dir);
+ if (r < 0)
+ return r;
+
+ return unit_file_lookup_state(scope, root_dir, &paths, name);
+}
+
int unit_file_query_preset(UnitFileScope scope, const char *root_dir, const char *name) {
_cleanup_strv_free_ char **files = NULL;
char **p;
diff --git a/src/shared/install.h b/src/shared/install.h
index 357be0f..3ca3939 100644
--- a/src/shared/install.h
+++ b/src/shared/install.h
@@ -23,6 +23,7 @@
#include "hashmap.h"
#include "unit-name.h"
+#include "path-lookup.h"
typedef enum UnitFileScope {
UNIT_FILE_SYSTEM,
@@ -98,7 +99,15 @@ int unit_file_set_default(UnitFileScope scope, const char *root_dir, const char
int unit_file_get_default(UnitFileScope scope, const char *root_dir, char **name);
int unit_file_add_dependency(UnitFileScope scope, bool runtime, const char *root_dir, char **files, char *target, UnitDependency dep, bool force, UnitFileChange **changes, unsigned *n_changes);
-UnitFileState unit_file_get_state(UnitFileScope scope, const char *root_dir, const char *filename);
+UnitFileState unit_file_lookup_state(
+ UnitFileScope scope,
+ const char *root_dir,
+ const LookupPaths *paths,
+ const char *name);
+UnitFileState unit_file_get_state(
+ UnitFileScope scope,
+ const char *root_dir,
+ const char *filename);
int unit_file_get_list(UnitFileScope scope, const char *root_dir, Hashmap *h);
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index fbf46cd..fb2c2c2 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -28,6 +28,7 @@
#include "strv.h"
#include "path-util.h"
#include "path-lookup.h"
+#include "install.h"
int user_config_home(char **config_home) {
const char *e;
diff --git a/src/shared/path-lookup.h b/src/shared/path-lookup.h
index 2ec888d..f1925ee 100644
--- a/src/shared/path-lookup.h
+++ b/src/shared/path-lookup.h
@@ -22,7 +22,8 @@
***/
#include "macro.h"
-#include "install.h"
+
+typedef enum UnitFileScope UnitFileScope;
typedef struct LookupPaths {
char **unit_path;
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 25b10c1..4beea4d 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -719,10 +719,10 @@ static int fix_order(SysvStub *s, Hashmap *all_services) {
return 0;
}
-static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
+static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
char **path;
- STRV_FOREACH(path, lp.sysvinit_path) {
+ STRV_FOREACH(path, lp->sysvinit_path) {
_cleanup_closedir_ DIR *d = NULL;
struct dirent *de;
@@ -764,7 +764,7 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
if (!fpath)
return log_oom();
- if (unit_file_get_state(UNIT_FILE_SYSTEM, NULL, name) >= 0) {
+ if (unit_file_lookup_state(UNIT_FILE_SYSTEM, NULL, lp, name) >= 0) {
log_debug("Native unit for %s already exists, skipping", name);
continue;
}
@@ -789,7 +789,7 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
return 0;
}
-static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
+static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_services) {
char **p;
unsigned i;
_cleanup_closedir_ DIR *d = NULL;
@@ -800,7 +800,7 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
_cleanup_set_free_ Set *shutdown_services = NULL;
int r = 0;
- STRV_FOREACH(p, lp.sysvrcnd_path)
+ STRV_FOREACH(p, lp->sysvrcnd_path)
for (i = 0; i < ELEMENTSOF(rcnd_table); i ++) {
struct dirent *de;
@@ -950,13 +950,13 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- r = enumerate_sysv(lp, all_services);
+ r = enumerate_sysv(&lp, all_services);
if (r < 0) {
log_error("Failed to generate units for all init scripts.");
return EXIT_FAILURE;
}
- r = set_dependencies_from_rcnd(lp, all_services);
+ r = set_dependencies_from_rcnd(&lp, all_services);
if (r < 0) {
log_error("Failed to read runlevels from rcnd links.");
return EXIT_FAILURE;
commit 51bfdaf66c381793d2f39ad891f3411a55927da6
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 14 20:24:47 2015 -0400
tmpfiles: remove redundant debug message
Mar 13 19:48:30 adam.happyassassin.net systemd-tmpfiles[970]: "/var/lib/machines" has right mode 40700
Mar 13 19:48:30 adam.happyassassin.net systemd-tmpfiles[970]: /var/lib/machines created successfully.
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index a0ff76d..bb4d41a 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1205,8 +1205,6 @@ static int create_item(Item *i) {
break;
}
- log_debug("%s created successfully.", i->path);
-
return 0;
}
commit 7034e9db51d0b6f8e1dbbe9127393c6fbc06fe28
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 14 20:14:39 2015 -0400
util: remove redundant debug message
mar 14 20:05:34 fedora22 systemd[4058]: /usr/lib/systemd/system-generators/kdump-dep-generator.sh will be executed.
mar 14 20:05:34 fedora22 systemd[4058]: Spawned /usr/lib/systemd/system-generators/kdump-dep-generator.sh as 4059.
The second line already says everything.
diff --git a/src/shared/util.c b/src/shared/util.c
index 1994c7e..f1f7a5d 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4122,8 +4122,7 @@ static int do_execute(char **directories, usec_t timeout, char *argv[]) {
if (null_or_empty_path(path)) {
log_debug("%s is empty (a mask).", path);
continue;
- } else
- log_debug("%s will be executed.", path);
+ }
pid = fork();
if (pid < 0) {
commit d99ce93383028f08470b6d334bc1a31ca8d16b22
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Mar 14 17:56:13 2015 -0400
units: there is no systemd-udev-hwdb-update.service
diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in
index f6acd6f..2791f73 100644
--- a/units/systemd-udevd.service.in
+++ b/units/systemd-udevd.service.in
@@ -10,7 +10,7 @@ Description=udev Kernel Device Manager
Documentation=man:systemd-udevd.service(8) man:udev(7)
DefaultDependencies=no
Wants=systemd-udevd-control.socket systemd-udevd-kernel.socket
-After=systemd-udevd-control.socket systemd-udevd-kernel.socket systemd-udev-hwdb-update.service systemd-sysusers.service
+After=systemd-udevd-control.socket systemd-udevd-kernel.socket systemd-hwdb-update.service systemd-sysusers.service
Before=sysinit.target
ConditionPathIsReadWrite=/sys
More information about the systemd-commits
mailing list