[systemd-commits] 6 commits - Makefile-man.am man/coredumpctl.xml man/journalctl.xml man/systemd-coredump.xml man/systemd-journald.service.xml man/systemd.unit.xml man/sysusers.d.xml src/shared src/sysusers sysctl.d/50-coredump.conf.in

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Sun Jul 13 18:25:12 PDT 2014


 Makefile-man.am                  |    4 +
 man/coredumpctl.xml              |    2 
 man/journalctl.xml               |    1 
 man/systemd-coredump.xml         |  105 +++++++++++++++++++++++++++++++++++++++
 man/systemd-journald.service.xml |    1 
 man/systemd.unit.xml             |   12 ++++
 man/sysusers.d.xml               |    2 
 src/shared/fileio-label.c        |   20 ++++++-
 src/shared/fileio-label.h        |    2 
 src/shared/path-lookup.c         |   18 ------
 src/sysusers/sysusers.c          |    8 ++
 sysctl.d/50-coredump.conf.in     |    4 +
 12 files changed, 153 insertions(+), 26 deletions(-)

New commits:
commit 667a1cd645c9402921dedff08a86bb35cddbcbf9
Author: Tanu Kaskinen <tanu.kaskinen at linux.intel.com>
Date:   Sat Jul 12 18:59:19 2014 +0300

    path-lookup: don't make ~/.local/share/systemd/user a symlink
    
    We already encourage upstreams to keep the default configuration
    separate from user customizations for software that is installed in
    the system location. Let's allow that separation also for software
    that is installed in the home directory.
    
    Some discussion:
    http://thread.gmane.org/gmane.comp.sysutils.systemd.devel/19627

diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index e0aaf44..7d53d85 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -125,26 +125,8 @@ static char** user_dirs(
                         goto fail;
 
         } else if (home) {
-                _cleanup_free_ char *data_home_parent = NULL;
-
                 if (asprintf(&data_home, "%s/.local/share/systemd/user", home) < 0)
                         goto fail;
-
-                /* There is really no need for two unit dirs in $HOME,
-                 * except to be fully compliant with the XDG spec. We
-                 * now try to link the two dirs, so that we can
-                 * minimize disk seeks a little. Further down we'll
-                 * then filter out this link, if it is actually is
-                 * one. */
-
-                if (path_get_parent(data_home, &data_home_parent) >= 0) {
-                        _cleanup_free_ char *config_home_relative = NULL;
-
-                        if (path_make_relative(data_home_parent, config_home, &config_home_relative) >= 0) {
-                                mkdir_parents_label(data_home, 0777);
-                                (void) symlink(config_home_relative, data_home);
-                        }
-                }
         }
 
         e = getenv("XDG_DATA_DIRS");

commit 91acdc17a5b47e775369c6b907601f44fab07dcb
Author: Tanu Kaskinen <tanu.kaskinen at linux.intel.com>
Date:   Sat Jul 12 19:36:16 2014 +0300

    man: mention XDG_DATA_HOME in systemd.unit

diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index d0431ce..6447584 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -74,6 +74,8 @@
 <filename>$HOME/.config/systemd/user/*</filename>
 <filename>/etc/systemd/user/*</filename>
 <filename>/run/systemd/user/*</filename>
+<filename>$XDG_DATA_HOME/systemd/user/*</filename>
+<filename>$HOME/.local/share/systemd/user/*</filename>
 <filename>/usr/lib/systemd/user/*</filename>
 <filename>...</filename>
                 </literallayout></para>
@@ -339,8 +341,16 @@
                         <entry>Runtime units</entry>
                       </row>
                       <row>
+                        <entry><filename>$XDG_DATA_HOME/systemd/user</filename></entry>
+                        <entry>Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is set)</entry>
+                      </row>
+                      <row>
+                        <entry><filename>$HOME/.local/share/systemd/user</filename></entry>
+                        <entry>Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is not set)</entry>
+                      </row>
+                      <row>
                         <entry><filename>/usr/lib/systemd/user</filename></entry>
-                        <entry>Units of installed packages</entry>
+                        <entry>Units of packages that have been installed system-wide</entry>
                       </row>
                     </tbody>
                   </tgroup>

commit eb34cba76323ea673471e226f97721bd6bdbcbf6
Author: Sjoerd Simons <sjoerd at luon.net>
Date:   Sun Jul 13 16:56:16 2014 +0200

    man: sysusers.d correct default user shell
    
    For the non-root user sysusers uses nologin as the default shell, not
    login. Correct the documentation to match the code.

diff --git a/man/sysusers.d.xml b/man/sysusers.d.xml
index 00eb7ec..1e079b2 100644
--- a/man/sysusers.d.xml
+++ b/man/sysusers.d.xml
@@ -102,7 +102,7 @@ m authd input</programlisting>
                                         group will be set to the group
                                         bearing the same name. The
                                         user's shell will be set to
-                                        <filename>/sbin/login</filename>,
+                                        <filename>/sbin/nologin</filename>,
                                         the home directory to
                                         <filename>/</filename>. The
                                         account will be created

commit 5146e7e8aec2d394c06771d4c9d0d03fc2cd911c
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sun Jul 13 20:32:46 2014 -0400

    man: add systemd-coredump(8) and a bunch of links

diff --git a/Makefile-man.am b/Makefile-man.am
index 5fefbc4..3462c2a 100644
--- a/Makefile-man.am
+++ b/Makefile-man.am
@@ -687,7 +687,8 @@ endif
 if ENABLE_COREDUMP
 MANPAGES += \
 	man/coredump.conf.5 \
-	man/coredumpctl.1
+	man/coredumpctl.1 \
+	man/systemd-coredump.8
 MANPAGES_ALIAS += \
 	#
 
@@ -1601,6 +1602,7 @@ EXTRA_DIST += \
 	man/systemd-cat.xml \
 	man/systemd-cgls.xml \
 	man/systemd-cgtop.xml \
+	man/systemd-coredump.xml \
 	man/systemd-cryptsetup-generator.xml \
 	man/systemd-cryptsetup at .service.xml \
 	man/systemd-debug-generator.xml \
diff --git a/man/coredumpctl.xml b/man/coredumpctl.xml
index 4f1a72f..a7b8793 100644
--- a/man/coredumpctl.xml
+++ b/man/coredumpctl.xml
@@ -210,6 +210,8 @@
         <refsect1>
                 <title>See Also</title>
                 <para>
+                        <citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                         <citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>
                 </para>
diff --git a/man/journalctl.xml b/man/journalctl.xml
index 1f46488..47b5a05 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -908,6 +908,7 @@
                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
                 </para>
diff --git a/man/systemd-coredump.xml b/man/systemd-coredump.xml
new file mode 100644
index 0000000..b83b278
--- /dev/null
+++ b/man/systemd-coredump.xml
@@ -0,0 +1,105 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2014 Zbigniew Jędrzejewski-Szmek
+
+  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
+  Lesser 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/>.
+-->
+
+<refentry id="systemd-coredump" conditional='ENABLE_COREDUMP'
+          xmlns:xi="http://www.w3.org/2001/XInclude">
+
+  <refentryinfo>
+    <title>systemd-coredump</title>
+    <productname>systemd</productname>
+
+    <authorgroup>
+      <author>
+        <contrib>Developer</contrib>
+        <firstname>Lennart</firstname>
+        <surname>Poettering</surname>
+        <email>lennart at poettering.net</email>
+      </author>
+    </authorgroup>
+  </refentryinfo>
+
+  <refmeta>
+    <refentrytitle>systemd-coredump</refentrytitle>
+    <manvolnum>8</manvolnum>
+  </refmeta>
+
+  <refnamediv>
+    <refname>systemd-coredump</refname>
+    <refpurpose>Log and store core dumps</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <para><filename>/usr/lib/systemd/systemd-coredump</filename></para>
+  </refsynopsisdiv>
+
+  <refsect1>
+    <title>Description</title>
+
+    <para><command>systemd-coredump</command> can be used as a helper
+    binary by the kernel when a user space program receives a fatal
+    signal and dumps core. For it to be used in this capacity, it must
+    be specified by the
+    <varname>kernel.core_pattern</varname> <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+    setting. Systemd installs
+    <filename>/usr/lib/sysctl.d/50-coredump.conf</filename> which
+    configures <varname>kernel.core_pattern</varname> to invoke
+    <command>systemd-coredump</command>. This file may be masked or
+    overriden to use a different setting following normal
+    <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> rules.</para>
+
+    <para>The behaviour of a specific program upon reception of a
+    signal is governed by a few factors which are described in detail
+    in <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+    In particular, the coredump will only be processed when the
+    related resource limits are high enough. For programs started by
+    <command>systemd</command> those may be set using
+    <varname>LimitCore=</varname> (see
+    <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
+    </para>
+
+    <para><command>systemd-coredump</command> will log the coredump
+    including a backtrace if possible, and store the core (contents of
+    process' memory contents) in an external file on disk in
+    <filename>/var/lib/systemd/coredump</filename>, or directly in
+    the journal. This behaviour may be modified using
+    <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
+
+    <para>Apart from the
+    <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+    log viewer,
+    <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+    may be used to list and extract coredumps.</para>
+  </refsect1>
+
+  <refsect1>
+    <title>See Also</title>
+    <para>
+      <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+      <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>systemd-sysctl.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
+    </para>
+  </refsect1>
+</refentry>
diff --git a/man/systemd-journald.service.xml b/man/systemd-journald.service.xml
index 7db62d1..1f1a7f1 100644
--- a/man/systemd-journald.service.xml
+++ b/man/systemd-journald.service.xml
@@ -248,6 +248,7 @@
                         <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                         <citerefentry><refentrytitle>setfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                         <command>pydoc systemd.journal</command>.
                 </para>
diff --git a/sysctl.d/50-coredump.conf.in b/sysctl.d/50-coredump.conf.in
index d5795a3..d5f600e 100644
--- a/sysctl.d/50-coredump.conf.in
+++ b/sysctl.d/50-coredump.conf.in
@@ -5,6 +5,8 @@
 #  the Free Software Foundation; either version 2.1 of the License, or
 #  (at your option) any later version.
 
-# See sysctl.d(5) and core(5) for for details.
+# See sysctl.d(5) for the description of the files in this directory,
+# and systemd-coredump(8) and core(5) for the explanation of the
+# setting below.
 
 kernel.core_pattern=|@rootlibexecdir@/systemd-coredump %p %u %g %s %t %e

commit f7f628b5db770feb8b18990436baefaec55c460b
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sun Jul 13 21:10:38 2014 -0400

    Add function to open temp files in selinux mode

diff --git a/src/shared/fileio-label.c b/src/shared/fileio-label.c
index 0711826..417ca56 100644
--- a/src/shared/fileio-label.c
+++ b/src/shared/fileio-label.c
@@ -25,12 +25,13 @@
 
 #include "fileio-label.h"
 #include "label.h"
+#include "util.h"
 
 int write_string_file_atomic_label(const char *fn, const char *line) {
         int r;
 
         r = label_context_set(fn, S_IFREG);
-        if (r  < 0)
+        if (r < 0)
                 return r;
 
         write_string_file_atomic(fn, line);
@@ -44,7 +45,7 @@ int write_env_file_label(const char *fname, char **l) {
         int r;
 
         r = label_context_set(fname, S_IFREG);
-        if (r  < 0)
+        if (r < 0)
                 return r;
 
         write_env_file(fname, l);
@@ -53,3 +54,18 @@ int write_env_file_label(const char *fname, char **l) {
 
         return r;
 }
+
+int fopen_temporary_label(const char *target,
+                          const char *path, FILE **f, char **temp_path) {
+        int r;
+
+        r = label_context_set("/etc/passwd", S_IFREG);
+        if (r < 0)
+                return r;
+
+        r = fopen_temporary(path, f, temp_path);
+
+        label_context_clear();
+
+        return r;
+}
diff --git a/src/shared/fileio-label.h b/src/shared/fileio-label.h
index fce4fe0..25fa351 100644
--- a/src/shared/fileio-label.h
+++ b/src/shared/fileio-label.h
@@ -27,3 +27,5 @@
 
 int write_string_file_atomic_label(const char *fn, const char *line);
 int write_env_file_label(const char *fname, char **l);
+int fopen_temporary_label(const char *target,
+                          const char *path, FILE **f, char **temp_path);
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index e086c72..d679394 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -35,6 +35,8 @@
 #include "conf-files.h"
 #include "copy.h"
 #include "utf8.h"
+#include "label.h"
+#include "fileio-label.h"
 
 typedef enum ItemType {
         ADD_USER = 'u',
@@ -312,11 +314,7 @@ static int write_files(void) {
                 _cleanup_fclose_ FILE *original = NULL;
 
                 group_path = fix_root("/etc/group");
-                r = label_context_set("/etc/group", S_IFREG);
-                if (r < 0)
-                        goto finish;
-                r = fopen_temporary(group_path, &group, &group_tmp);
-                label_context_clear();
+                r = fopen_temporary_label("/etc/group", group_path, &group, &group_tmp);
                 if (r < 0)
                         goto finish;
 
@@ -392,14 +390,9 @@ static int write_files(void) {
                 _cleanup_fclose_ FILE *original = NULL;
 
                 passwd_path = fix_root("/etc/passwd");
-                r = label_context_set("/etc/passwd", S_IFREG);
+                r = fopen_temporary_label("/etc/passwd", passwd_path, &passwd, &passwd_tmp);
                 if (r < 0)
                         goto finish;
-                r = fopen_temporary(passwd_path, &passwd, &passwd_tmp);
-                label_context_clear();
-                if (r < 0) {
-                        goto finish;
-                }
 
                 if (fchmod(fileno(passwd), 0644) < 0) {
                         r = -errno;

commit a334cbba7222d3d7d886c17c828fa4227c656535
Author: Colin Walters <walters at verbum.org>
Date:   Sun Jul 13 13:35:33 2014 -0700

    sysusers: preserve label of /etc/{passwd, group}
    
    These files are specially labeled on SELinux systems, and we need to
    preserve that label.

diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 68c552d..e086c72 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -312,7 +312,11 @@ static int write_files(void) {
                 _cleanup_fclose_ FILE *original = NULL;
 
                 group_path = fix_root("/etc/group");
+                r = label_context_set("/etc/group", S_IFREG);
+                if (r < 0)
+                        goto finish;
                 r = fopen_temporary(group_path, &group, &group_tmp);
+                label_context_clear();
                 if (r < 0)
                         goto finish;
 
@@ -388,9 +392,14 @@ static int write_files(void) {
                 _cleanup_fclose_ FILE *original = NULL;
 
                 passwd_path = fix_root("/etc/passwd");
-                r = fopen_temporary(passwd_path, &passwd, &passwd_tmp);
+                r = label_context_set("/etc/passwd", S_IFREG);
                 if (r < 0)
                         goto finish;
+                r = fopen_temporary(passwd_path, &passwd, &passwd_tmp);
+                label_context_clear();
+                if (r < 0) {
+                        goto finish;
+                }
 
                 if (fchmod(fileno(passwd), 0644) < 0) {
                         r = -errno;
@@ -1491,6 +1500,8 @@ int main(int argc, char *argv[]) {
 
         umask(0022);
 
+        label_init(NULL);
+
         r = 0;
 
         if (optind < argc) {



More information about the systemd-commits mailing list