[systemd-devel] [PATCH] Hook more properties for transient units

2015-09-10 Thread Gabriel de Perthuis
systemd-run can now launch units with PrivateTmp, PrivateDevices,
PrivateNetwork, NoNewPrivileges set.
---
 src/core/dbus-execute.c | 54 ++---
 src/shared/bus-util.c   |  3 ++-
 2 files changed, 22 insertions(+), 35 deletions(-)

diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index ed55fcf..fd13c6d 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -931,51 +931,37 @@ int bus_exec_context_set_transient_property(
 unit_write_drop_in_private_format(u, mode, name, 
"StandardError=%s\n", exec_output_to_string(p));
 }
 
 return 1;
 
-} else if (streq(name, "IgnoreSIGPIPE")) {
+} else if (STR_IN_SET(name,
+  "IgnoreSIGPIPE", "TTYVHangup", "TTYReset",
+  "PrivateTmp", "PrivateDevices", "PrivateNetwork",
+  "NoNewPrivileges")) {
 int b;
 
 r = sd_bus_message_read(message, "b", );
 if (r < 0)
 return r;
 
 if (mode != UNIT_CHECK) {
-c->ignore_sigpipe = b;
-
-unit_write_drop_in_private_format(u, mode, name, 
"IgnoreSIGPIPE=%s\n", yes_no(b));
-}
-
-return 1;
-
-} else if (streq(name, "TTYVHangup")) {
-int b;
-
-r = sd_bus_message_read(message, "b", );
-if (r < 0)
-return r;
-
-if (mode != UNIT_CHECK) {
-c->tty_vhangup = b;
-
-unit_write_drop_in_private_format(u, mode, name, 
"TTYVHangup=%s\n", yes_no(b));
-}
-
-return 1;
-
-} else if (streq(name, "TTYReset")) {
-int b;
-
-r = sd_bus_message_read(message, "b", );
-if (r < 0)
-return r;
-
-if (mode != UNIT_CHECK) {
-c->tty_reset = b;
-
-unit_write_drop_in_private_format(u, mode, name, 
"TTYReset=%s\n", yes_no(b));
+if (streq(name, "IgnoreSIGPIPE"))
+c->ignore_sigpipe = b;
+else if (streq(name, "TTYVHangup"))
+c->tty_vhangup = b;
+else if (streq(name, "TTYReset"))
+c->tty_reset = b;
+else if (streq(name, "PrivateTmp"))
+c->private_tmp = b;
+else if (streq(name, "PrivateDevices"))
+c->private_devices = b;
+else if (streq(name, "PrivateNetwork"))
+c->private_network = b;
+else if (streq(name, "NoNewPrivileges"))
+c->no_new_privileges = b;
+
+unit_write_drop_in_private_format(u, mode, name, 
"%s=%s\n", name, yes_no(b));
 }
 
 return 1;
 
 } else if (streq(name, "UtmpIdentifier")) {
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 36c4422..c19dc97 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -1421,11 +1421,12 @@ int bus_append_unit_property_assignment(sd_bus_message 
*m, const char *assignmen
 return bus_log_create_error(r);
 
 if (STR_IN_SET(field,
"CPUAccounting", "MemoryAccounting", 
"BlockIOAccounting",
"SendSIGHUP", "SendSIGKILL", "WakeSystem", 
"DefaultDependencies",
-   "IgnoreSIGPIPE", "TTYVHangup", "TTYReset", 
"RemainAfterExit")) {
+   "IgnoreSIGPIPE", "TTYVHangup", "TTYReset", 
"RemainAfterExit",
+   "PrivateTmp", "PrivateDevices", "PrivateNetwork", 
"NoNewPrivileges")) {
 
 r = parse_boolean(eq);
 if (r < 0) {
 log_error("Failed to parse boolean assignment %s.", 
assignment);
 return -EINVAL;
-- 
2.6.0.rc0.29.g24f8d8a

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH v2] bootchart: ship a configuration that will boot without sysvinit compat

2014-12-28 Thread Gabriel de Perthuis
bootchart defaults to chaining to /sbin/init, which is sensible,
but in a pure systemd environment (without systemd-sysvinit)
will make the machine unbootable.

Change the default through /etc/systemd/bootchart.conf.
Keep the /sbin/init default in the source code, in case
some users rely on that.
---

Updated to take the path from autotools.


 Makefile.am | 12 +++-
 src/bootchart/.gitignore|  1 +
 src/bootchart/{bootchart.conf = bootchart.conf.in} |  2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)
 create mode 100644 src/bootchart/.gitignore
 rename src/bootchart/{bootchart.conf = bootchart.conf.in} (95%)

diff --git a/Makefile.am b/Makefile.am
index e1e0843..6be5c4f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4624,23 +4624,25 @@ systemd_bootchart_LDADD = \
libsystemd-shared.la
 
 rootlibexec_PROGRAMS += \
systemd-bootchart
 
-dist_pkgsysconf_DATA += \
+nodist_pkgsysconf_DATA += \
src/bootchart/bootchart.conf
 
 nodist_systemunit_DATA += \
units/systemd-bootchart.service
 
+CLEANFILES += \
+   src/bootchart/bootchart.conf \
+   units/systemd-bootchart.service
+endif
+
 EXTRA_DIST += \
+   src/bootchart/bootchart.conf.in \
units/systemd-bootchart.service.in
 
-CLEANFILES += \
-   units/systemd-bootchart.service
-endif
-
 # 
--
 if ENABLE_QUOTACHECK
 rootlibexec_PROGRAMS += \
systemd-quotacheck
 
diff --git a/src/bootchart/.gitignore b/src/bootchart/.gitignore
new file mode 100644
index 000..371b43b
--- /dev/null
+++ b/src/bootchart/.gitignore
@@ -0,0 +1 @@
+/bootchart.conf
diff --git a/src/bootchart/bootchart.conf b/src/bootchart/bootchart.conf.in
similarity index 95%
rename from src/bootchart/bootchart.conf
rename to src/bootchart/bootchart.conf.in
index c73328f..08e7071 100644
--- a/src/bootchart/bootchart.conf
+++ b/src/bootchart/bootchart.conf.in
@@ -14,11 +14,11 @@
 #Samples=500
 #Frequency=25
 #Relative=no
 #Filter=yes
 #Output=folder name, defaults to /run/log
-#Init=/path/to/init-binary
+Init=@rootlibexecdir@/systemd
 #PlotMemoryUsage=no
 #PlotEntropyGraph=no
 #ScaleX=100
 #ScaleY=20
 #ControlGroup=no
-- 
2.2.0.71.g3365589

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] bootchart: ship a configuration that will boot without sysvinit compat

2014-12-27 Thread Gabriel de Perthuis
bootchart defaults to chaining to /sbin/init, which is sensible,
but in a pure systemd environment (without systemd-sysvinit)
will make the machine unbootable.

Change the default through /etc/systemd/bootchart.conf.
Keep the /sbin/init default in the source code, in case
some users rely on that.
---
 src/bootchart/bootchart.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bootchart/bootchart.conf b/src/bootchart/bootchart.conf
index c73328f..61ba0c1 100644
--- a/src/bootchart/bootchart.conf
+++ b/src/bootchart/bootchart.conf
@@ -14,11 +14,11 @@
 #Samples=500
 #Frequency=25
 #Relative=no
 #Filter=yes
 #Output=folder name, defaults to /run/log
-#Init=/path/to/init-binary
+Init=/usr/lib/systemd/systemd
 #PlotMemoryUsage=no
 #PlotEntropyGraph=no
 #ScaleX=100
 #ScaleY=20
 #ControlGroup=no
-- 
2.2.0.71.g3365589

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] blkid: Warn when rejecting a superblock with a bad csum

2014-12-12 Thread Gabriel de Perthuis
Bump libblkid requirement from 2.20 to 2.24.
util-linux 2.25 is actually required since 
fdbbad981cc5da8bb4ed7e9b6646e7a114745ec5
---
 configure.ac  |  2 +-
 src/udev/udev-builtin-blkid.c | 13 -
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9218ed3..453f5de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -430,11 +430,11 @@ AM_CONDITIONAL(HAVE_XKBCOMMON, [test $have_xkbcommon = 
yes])
 
 # 
--
 have_blkid=no
 AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [disable blkid 
support]))
 if test x$enable_blkid != xno; then
-PKG_CHECK_MODULES(BLKID, [ blkid = 2.20 ],
+PKG_CHECK_MODULES(BLKID, [ blkid = 2.24 ],
 [AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) 
have_blkid=yes], have_blkid=no)
 if test x$have_blkid = xno -a x$enable_blkid = xyes; then
 AC_MSG_ERROR([*** blkid support requested but libraries not 
found])
 fi
 fi
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
index 810f27d..83bd8c4 100644
--- a/src/udev/udev-builtin-blkid.c
+++ b/src/udev/udev-builtin-blkid.c
@@ -219,10 +219,11 @@ static int builtin_blkid(struct udev_device *dev, int 
argc, char *argv[], bool t
 bool noraid = false;
 _cleanup_close_ int fd = -1;
 blkid_probe pr;
 const char *data;
 const char *name;
+const char *prtype = NULL;
 int nvals;
 int i;
 int err = 0;
 bool is_gpt = false;
 
@@ -254,11 +255,12 @@ static int builtin_blkid(struct udev_device *dev, int 
argc, char *argv[], bool t
 return EXIT_FAILURE;
 
 blkid_probe_set_superblocks_flags(pr,
 BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID |
 BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE |
-BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION);
+BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION |
+BLKID_SUBLKS_BADCSUM);
 
 if (noraid)
 blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, 
BLKID_USAGE_RAID);
 
 fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC);
@@ -276,10 +278,19 @@ static int builtin_blkid(struct udev_device *dev, int 
argc, char *argv[], bool t
   noraid ? no : , offset);
 
 err = probe_superblocks(pr);
 if (err  0)
 goto out;
+if (blkid_probe_has_value(pr, SBBADCSUM)) {
+if (!blkid_probe_lookup_value(pr, TYPE, prtype, NULL))
+log_warning(incorrect %s checksum on %s,
+prtype, udev_device_get_devnode(dev));
+else
+log_warning(incorrect checksum on %s,
+udev_device_get_devnode(dev));
+goto out;
+}
 
 /* If we are a partition then our parent passed on the root
  * partition UUID to us */
 root_partition = udev_device_get_property_value(dev, 
ID_PART_GPT_AUTO_ROOT_UUID);
 
-- 
2.1.2.457.g0cd6422

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [HEADSUP] What to backport?

2013-09-13 Thread Gabriel de Perthuis
   -- You need to pull the notes from the git repo using a command like
   the following:
 
   $ git fetch fetch origin refs/notes/*:refs/notes/*
 
   I added an alias to my ~/.gitconfig for this:
 
   [alias]
   pullnotes = fetch origin refs/notes/*:refs/notes/*
 
   That way I can just do:
 
   $ git pullnotes

You can fetch origin notes automatically with this:

git config --add remote.origin.fetch '+refs/notes/*:refs/notes/*'

The idea comes from http://git-scm.com/blog/2010/08/25/notes.html



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] systemd-analyze: Show critical chains for listed units

2013-06-11 Thread Gabriel de Perthuis
---
 src/analyze/systemd-analyze.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

Nb: it might be even better to show the critical chain of a fictive
unit that would depend on everything in argv, but that's more
complicated to implement.

diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index fe1abdc..ffdcd14 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -824,11 +824,11 @@ static int list_dependencies_one(DBusConnection *bus, 
const char *name, unsigned
 
 }
 return 0;
 }
 
-static int list_dependencies(DBusConnection *bus) {
+static int list_dependencies(DBusConnection *bus, const char *name) {
 _cleanup_strv_free_ char **units = NULL;
 char ts[FORMAT_TIMESPAN_MAX];
 struct unit_times *times;
 int r;
 const char
@@ -839,11 +839,11 @@ static int list_dependencies(DBusConnection *bus) {
 _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
 struct boot_times *boot;
 
 assert(bus);
 
-path = unit_dbus_path_from_name(SPECIAL_DEFAULT_TARGET);
+path = unit_dbus_path_from_name(name);
 if (path == NULL)
 return -EINVAL;
 
 r = bus_method_call_with_reply (
 bus,
@@ -888,14 +888,14 @@ static int list_dependencies(DBusConnection *bus) {
 printf(%s @%s\n, id, format_timespan(ts, sizeof(ts), 
times-aet - boot-userspace_time, USEC_PER_MSEC));
 else
 printf(%s\n, id);
 }
 
-return list_dependencies_one(bus, SPECIAL_DEFAULT_TARGET, 0, units, 
0);
+return list_dependencies_one(bus, name, 0, units, 0);
 }
 
-static int analyze_critical_chain(DBusConnection *bus) {
+static int analyze_critical_chain(DBusConnection *bus, char *names[]) {
 struct unit_times *times;
 int n, r;
 unsigned int i;
 Hashmap *h;
 
@@ -915,11 +915,17 @@ static int analyze_critical_chain(DBusConnection *bus) {
 unit_times_hashmap = h;
 
 puts(The time after the unit is active or started is printed after 
the \@\ character.\n
  The time the unit takes to start is printed after the \+\ 
character.\n);
 
-list_dependencies(bus);
+if (!strv_isempty(names)) {
+char **name;
+STRV_FOREACH(name, names)
+list_dependencies(bus, *name);
+} else {
+list_dependencies(bus, SPECIAL_DEFAULT_TARGET);
+}
 
 hashmap_free(h);
 free_unit_times(times, (unsigned) n);
 return 0;
 }
@@ -1299,11 +1305,11 @@ int main(int argc, char *argv[]) {
 if (!argv[optind] || streq(argv[optind], time))
 r = analyze_time(bus);
 else if (streq(argv[optind], blame))
 r = analyze_blame(bus);
 else if (streq(argv[optind], critical-chain))
-r = analyze_critical_chain(bus);
+r = analyze_critical_chain(bus, argv+optind+1);
 else if (streq(argv[optind], plot))
 r = analyze_plot(bus);
 else if (streq(argv[optind], dot))
 r = dot(bus, argv+optind+1);
 else
-- 
1.8.3.222.g430da9e

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel