1
0
mirror of https://github.com/systemd/systemd synced 2025-09-28 08:14:46 +02:00

Compare commits

..

No commits in common. "65ab27211c32089e038de7352091b46903c91ee6" and "537ae584c80fa16d585c5e7b909331807d725fbf" have entirely different histories.

4 changed files with 11 additions and 44 deletions

View File

@ -145,17 +145,14 @@ A+ /path-or-glob/to/append/acls/recursively - - - - POSIX
<refsect1> <refsect1>
<title>Configuration File Format</title> <title>Configuration File Format</title>
<para>The configuration format is one line per path, containing type, path, mode, ownership, age, and <para>The configuration format is one line per path containing
argument fields. The lines are separated by newlines, the fields by whitespace:</para> type, path, mode, ownership, age, and argument fields:</para>
<programlisting>#Type Path Mode User Group Age Argument <programlisting>#Type Path Mode User Group Age Argument
d /run/user 0755 root root 10d - d /run/user 0755 root root 10d -
L /tmp/foobar - - - - /dev/null</programlisting> L /tmp/foobar - - - - /dev/null</programlisting>
<para>Fields may contain C-style escapes. With the exception of the seventh field (the "argument") all <para>Fields may be enclosed within quotes and contain C-style escapes.</para>
fields may be enclosed in quotes. Note that any whitespace found in the line after the beginning of the
argument field will be considered part of the argument field. To begin the argument field with a
whitespace character, use C-style escapes (e.g. <literal>\x20</literal>).</para>
<refsect2> <refsect2>
<title>Type</title> <title>Type</title>

View File

@ -20,11 +20,12 @@
int extract_first_word(const char **p, char **ret, const char *separators, ExtractFlags flags) { int extract_first_word(const char **p, char **ret, const char *separators, ExtractFlags flags) {
_cleanup_free_ char *s = NULL; _cleanup_free_ char *s = NULL;
size_t allocated = 0, sz = 0; size_t allocated = 0, sz = 0;
char quote = 0; /* 0 or ' or " */
bool backslash = false; /* whether we've just seen a backslash */
char c; char c;
int r; int r;
char quote = 0; /* 0 or ' or " */
bool backslash = false; /* whether we've just seen a backslash */
assert(p); assert(p);
assert(ret); assert(ret);
@ -70,7 +71,7 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
if (c == 0) { if (c == 0) {
if ((flags & EXTRACT_CUNESCAPE_RELAX) && if ((flags & EXTRACT_CUNESCAPE_RELAX) &&
(quote == 0 || flags & EXTRACT_RELAX)) { (!quote || flags & EXTRACT_RELAX)) {
/* If we find an unquoted trailing backslash and we're in /* If we find an unquoted trailing backslash and we're in
* EXTRACT_CUNESCAPE_RELAX mode, keep it verbatim in the * EXTRACT_CUNESCAPE_RELAX mode, keep it verbatim in the
* output. * output.
@ -115,7 +116,7 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
backslash = false; backslash = false;
} else if (quote != 0) { /* inside either single or double quotes */ } else if (quote) { /* inside either single or double quotes */
for (;; (*p)++, c = **p) { for (;; (*p)++, c = **p) {
if (c == 0) { if (c == 0) {
if (flags & EXTRACT_RELAX) if (flags & EXTRACT_RELAX)

View File

@ -60,7 +60,6 @@
#include "string-table.h" #include "string-table.h"
#include "string-util.h" #include "string-util.h"
#include "strv.h" #include "strv.h"
#include "terminal-util.h"
#include "umask-util.h" #include "umask-util.h"
#include "user-util.h" #include "user-util.h"
@ -2996,8 +2995,8 @@ static int help(void) {
if (r < 0) if (r < 0)
return log_oom(); return log_oom();
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n" printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n\n"
"\n%sCreates, deletes and cleans up volatile and temporary files and directories.%s\n\n" "Creates, deletes and cleans up volatile and temporary files and directories.\n\n"
" -h --help Show this help\n" " -h --help Show this help\n"
" --user Execute user configuration\n" " --user Execute user configuration\n"
" --version Show package version\n" " --version Show package version\n"
@ -3015,7 +3014,6 @@ static int help(void) {
" --no-pager Do not pipe output into a pager\n" " --no-pager Do not pipe output into a pager\n"
"\nSee the %s for details.\n" "\nSee the %s for details.\n"
, program_invocation_short_name , program_invocation_short_name
, ansi_highlight(), ansi_normal()
, link , link
); );

View File

@ -1,29 +0,0 @@
#!/usr/bin/env bash
set -e
set -x
set -o pipefail
systemd-tmpfiles --create - <<EOF
f /tmp/xxx1 0644 - - - foo
f /tmp/xxx2 0644 - - - foo bar
f /tmp/xxx3 0644 - - - foo\x20bar
f /tmp/xxx4 0644 - - - \x20foobar
f /tmp/xxx5 0644 - - - foobar\x20
f /tmp/xxx6 0644 - - - foo bar
f /tmp/xxx7 0644 - - - foo bar \n
f /tmp/xxx8 0644 - - - " foo bar "
f /tmp/xxx9 0644 - - - ' foo bar '
EOF
echo -n "foo" | cmp /tmp/xxx1 -
echo -n "foo bar" | cmp /tmp/xxx2 -
echo -n "foo bar" | cmp /tmp/xxx3 -
echo -n " foobar" | cmp /tmp/xxx4 -
echo -n "foobar " | cmp /tmp/xxx5 -
echo -n "foo bar" | cmp /tmp/xxx6 -
echo "foo bar " | cmp /tmp/xxx7 -
echo -n "\" foo bar \"" | cmp /tmp/xxx8 -
echo -n "' foo bar '" | cmp /tmp/xxx9 -
rm /tmp/xxx{1,2,3,4,5,6,7,8,9}