mirror of
https://github.com/systemd/systemd
synced 2025-09-28 08:14:46 +02:00
Compare commits
5 Commits
537ae584c8
...
65ab27211c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
65ab27211c | ||
![]() |
1cf96f68db | ||
![]() |
3f532a5930 | ||
![]() |
fa67d9c0d6 | ||
![]() |
29271da500 |
@ -145,14 +145,17 @@ 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
|
<para>The configuration format is one line per path, containing type, path, mode, ownership, age, and
|
||||||
type, path, mode, ownership, age, and argument fields:</para>
|
argument fields. The lines are separated by newlines, the fields by whitespace:</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 be enclosed within quotes and contain C-style escapes.</para>
|
<para>Fields may contain C-style escapes. With the exception of the seventh field (the "argument") all
|
||||||
|
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>
|
||||||
|
@ -20,11 +20,10 @@
|
|||||||
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 c;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
char quote = 0; /* 0 or ' or " */
|
char quote = 0; /* 0 or ' or " */
|
||||||
bool backslash = false; /* whether we've just seen a backslash */
|
bool backslash = false; /* whether we've just seen a backslash */
|
||||||
|
char c;
|
||||||
|
int r;
|
||||||
|
|
||||||
assert(p);
|
assert(p);
|
||||||
assert(ret);
|
assert(ret);
|
||||||
@ -71,7 +70,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 || flags & EXTRACT_RELAX)) {
|
(quote == 0 || 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.
|
||||||
@ -116,7 +115,7 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
|
|||||||
|
|
||||||
backslash = false;
|
backslash = false;
|
||||||
|
|
||||||
} else if (quote) { /* inside either single or double quotes */
|
} else if (quote != 0) { /* 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)
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
#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"
|
||||||
|
|
||||||
@ -2995,8 +2996,8 @@ static int help(void) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n\n"
|
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n"
|
||||||
"Creates, deletes and cleans up volatile and temporary files and directories.\n\n"
|
"\n%sCreates, deletes and cleans up volatile and temporary files and directories.%s\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"
|
||||||
@ -3014,6 +3015,7 @@ 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
|
||||||
);
|
);
|
||||||
|
|
||||||
|
29
test/units/testsuite-22.10.sh
Executable file
29
test/units/testsuite-22.10.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/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}
|
Loading…
x
Reference in New Issue
Block a user