1
0
mirror of https://github.com/systemd/systemd synced 2025-10-07 12:44:45 +02:00

Compare commits

..

25 Commits

Author SHA1 Message Date
Aakash Singh
d6bf675f0b hwdb: 60-keyboard:: Update MSI Modern backslash and hotkeys
fix typos
2021-04-09 12:03:13 +02:00
Jérôme Carretero
aba9c92896
login: logind-dbus: support scheduled kexec (#19162)
login: logind-dbus: support delayed kexec
2021-04-09 10:55:58 +02:00
Zbigniew Jędrzejewski-Szmek
5c91fdf3f8 man: document system-systemd\x2dcryptsetup.slice
As discussed in
1dc85eff1d (r606821495),
follow-up for commit 1dc85eff1d0dff18aaeaae530c91bf53f34b726e.
2021-04-09 10:38:09 +02:00
Zbigniew Jędrzejewski-Szmek
276dc7af74 docs: use new URL for package-notes 2021-04-09 10:27:36 +02:00
simmon
d1e6dec669 po: Translated using Weblate (Korean)
Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: simmon <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main
2021-04-09 09:31:00 +02:00
Yu Watanabe
8cd37e4354 network: do not require DHCPv6 addresses when UseAddress=no
Follow-up for 1536b7b2d00819615bf8eba194de7ccd20c3689f.

Fixes #19196.
2021-04-09 08:15:34 +02:00
Zbigniew Jędrzejewski-Szmek
708b299203
Merge pull request #19254 from poettering/native-journal-proto-doc
document native journal protocol
2021-04-09 08:13:21 +02:00
Zbigniew Jędrzejewski-Szmek
33ea9e9c97
Merge pull request #19255 from poettering/glyph-love
some SpecialGlyph tweaks
2021-04-09 08:05:14 +02:00
Zbigniew Jędrzejewski-Szmek
8649ec4725
Merge pull request #19248 from keszybz/make-tests-test
Make tests test
2021-04-09 07:56:04 +02:00
Lennart Poettering
eeb6923d5a core: rework unit_active_state_to_glyph() to use a translation table
Let's make this a bit more readable by implementing this via a
translation table, indexed by the state.
2021-04-08 23:01:25 +02:00
Lennart Poettering
eff60d8cea locale-util: make SpecialGlyph more like our usual enums
Let's define both an enum and a typedef named SpecialGlyph, the way we
usually do it.

Also, introduce an "invalid" special glyph, assigned to -EINVAL, also
like we always do it. (And handle it somewhat sanely in special_glyph()
2021-04-08 23:00:43 +02:00
Lennart Poettering
8ee62e53e8 man: link up new journal protocol docs 2021-04-08 22:16:58 +02:00
Lennart Poettering
1a80f4e0d7 docs: document native journal protocol
Fixes: #17748
2021-04-08 22:16:58 +02:00
Zbigniew Jędrzejewski-Szmek
b1e1e5ac25 TEST-17: make the test test
'! grep -v' does *not* test that there are no matching lines.
Instead, it checks that whether there are any non-matching lines.

And of course, for the test to fail, '! grep' cannot be part of
an expression with &&.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
68bb821e21 TEST-46: simplify lossy diff invocation 2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
b9bfa250f2 homectl,TEST-46: fix test and fix homectl return value, update docs
The usual: the test wasn't testing, so we didn't notice that the
command wasn't returning as expected.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
f49467b959 TEST-44: fix test
We were grepping for 'hello world', and in the namespace we would
match on 'hello world', and outside, on 'echo "hello world"'. When
the condition check was fixed, the test gave a false positive.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
d933ccd30b TEST-43: fix exit condition testing
We were invoking 'systemd-run bash', but the test invoked by bash
was not effective. When the result of that check is propagated, the
outer command fails.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
0ee994836c TEST-*: use spacing before redirection operator, but not after
<< EOF → <<EOF
> foo < bar → >foo <bar
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
4e20fe2795 TEST-*: make failure tests actually fail on failure
Here the intent was actually correct, and the tests still pass when the check
is made effective.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
61494724ee TEST-42-EXECSTOPPOST: un-invert test
Since we test for the file right below, it seems we expected the
command to succeed.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
b88ba6c761 tmpfiles: make handling of existing-but-different targets more consistent
create_fifo() was added in a2fc2f8dd30c17ad1e23a31fc6ff2aeba4c6fa27, and
would always ignore failure. The test was trying to fail in this case, but
we actually don't fail, which seems to be correct. We didn't notice before
because the test was ineffective.

To make things consistent, generally log at warning level, but don't propagate
the error. For symlinks, log at debug level, as before.

For 'e', failure is not propagated now. The test is adjusted to match.

I think warning is appropriate in most cases: we do not expect a device node to
be replaced by a different device node or even a non-device file. This would
most likely be an error somewhere. An exception is made for symlinks, which are
mismatched on purpose, for example /etc/resolv.conf. With this patch, we don't
get any warnings with the any of the 74 tmpfiles.d files, which suggests that
increasing the warning levels will not cause too many unexpected warnings. If
it turns out that there are valid cases where people have expected mismatches
for non-symlink types, we can always decrease the log levels again.
2021-04-08 20:16:37 +02:00
Zbigniew Jędrzejewski-Szmek
b065dfc8ed TEST-33-CLEAN-UNIT: fix broken test exposed by condition check fix 2021-04-08 11:46:07 +02:00
Zbigniew Jędrzejewski-Szmek
4e324ce42c TEST-22-TMPFILES: fix broken test exposed by condition check fix 2021-04-08 11:46:07 +02:00
Zbigniew Jędrzejewski-Szmek
ffa328f060 tests: make inverted tests actually count
"! test ..." does not cause the script to fail, even with set -e.
IIUC, bash treats this command as part of an expression line, as it
would if 'test ... && ...' was used. Failing expression lines do not
terminate the script.

This fixes the obvious cases by changing '! test' → 'test !'.
Then the inversion happens internally in test and bash will propagate
the failure.
2021-04-08 11:45:59 +02:00
72 changed files with 703 additions and 449 deletions

View File

@ -61,7 +61,7 @@ Value: a JSON string with the structure described below
} }
``` ```
A reference implementations of a [build-time tool is provided](https://github.com/keszybz/rpm-version-note/) A reference implementations of a [build-time tool is provided](https://github.com/systemd/package-notes)
and can be used to generate a linker script, which can then be used at build time via and can be used to generate a linker script, which can then be used at build time via
```LDFLAGS="-Wl,-T,/path/to/generated/script"``` to include the note in the binary. ```LDFLAGS="-Wl,-T,/path/to/generated/script"``` to include the note in the binary.

View File

@ -0,0 +1,190 @@
---
title: Native Journal Protocol
category: Interfaces
layout: default
---
# Native Journal Protocol
`systemd-journald.service` accepts log data via various protocols:
* Classic RFC3164 BSD syslog via the `/dev/log` socket
* STDOUT/STDERR of programs via `StandardOutput=journal` + `StandardError=journal` in service files (both of which are default settings)
* Kernel log messages via the `/dev/kmsg` device node
* Audit records via the kernel's audit subsystem
* Structured log messages via `journald`'s native protocol
The latter is what this document is about: if you are developing a program and
want to pass structured log data to `journald`, it's the Journal's native
protocol what you want to use. The systemd project provides the
[`sd_journal_print(3)`](https://www.freedesktop.org/software/systemd/man/sd_journal_print.html)
API that implements the client side of this protocol. This document explains
what this interface does behind the scenes, in case you'd like to implement a
client for it yourself, without linking to `libsystemd` — for example because
you work in a programming language other than C or otherwise want to avoid the
dependency.
## Basics
The native protocol of `journald` is spoken on the
`/run/systemd/journal/socket` `AF_UNIX`/`SOCK_DGRAM` socket on which
`systemd-journald.service` listens. Each datagram sent to this socket
encapsulates one journal entry that shall be written. Since datagrams are
subject to a size limit and we want to allow large journal entries, datagrams
sent over this socket may come in one of two formats:
* A datagram with the literal journal entry data as payload, without
any file descriptors attached.
* A datagram with an empty payload, but with a single
[`memfd`](https://man7.org/linux/man-pages/man2/memfd_create.2.html)
file descriptor that contains the literal journal entry data.
Other combinations are not permitted, i.e. datagrams with both payload and file
descriptors, or datagrams with neither, or more than one file descriptor. Such
datagrams are ignored. The `memfd` file descriptor should be fully sealed. The
binary format in the datagram payload and in the `memfd` memory is
identical. Typically a client would attempt to first send the data as datagram
payload, but if this fails with an `EMSGSIZE` error it would immediately retry
via the `memfd` logic.
A client probably should bump up the `SO_SNDBUF` socket option of its `AF_UNIX`
socket towards `journald` in order to delay blocking I/O as much as possible.
## Data Format
Each datagram should consist of a number of environment-like key/value
assignments. Unlike environment variable assignments the value may contain NUL
bytes however, as well as any other binary data. Keys may not include the `=`
or newline characters (or any other control characters or non-ASCII characters)
and may not be empty.
Serialization into the datagram payload or `memfd` is straight-forward: each
key/value pair is serialized via one of two methods:
* The first method inserts a `=` character between key and value, and suffixes
the result with `\n` (i.e. the newline character, ASCII code 10). Example: a
key `FOO` with a value `BAR` is serialized `F`, `O`, `O`, `=`, `B`, `A`, `R`,
`\n`.
* The second method should be used if the value of a field contains a `\n`
byte. In this case, the key name is serialized as is, followed by a `\n`
character, followed by a (non-aligned) little-endian unsigned 64bit integer
encoding the size of the value, followed by the literal value data, followed by
`\n`. Example: a key `FOO` with a value `BAR` may be serialized using this
second method as: `F`, `O`, `O`, `\n`, `\003`, `\000`, `\000`, `\000`, `\000`,
`\000`, `\000`, `\000`, `B`, `A`, `R`, `\n`.
If the value of a key/value pair contains a newline character (`\n`), it *must*
be serialized using the second method. If it does not, either method is
permitted. However, it is generally recommended to use the first method if
possible for all key/value pairs where applicable since the generated datagrams
are easily recognized and understood by the human eye this way, without any
manual binary decoding — which improves the debugging experience a lot, in
particular with tools such as `strace` that can show datagram content as text
dump. After all, log messages are highly relevant for debugging programs, hence
optimizing log traffic for readability without special tools is generally
desirable.
Note that keys that begin with `_` have special semantics in `journald`: they
are *trusted* and implicitly appended by `journald` on the receiving
side. Clients should not send them — if they do anyway, they will be ignored.
The most important key/value pair to send is `MESSAGE=`, as that contains the
actual log message text. Other relevant keys a client should send in most cases
are `PRIORITY=`, `CODE_FILE=`, `CODE_LINE=`, `CODE_FUNC=`, `ERRNO=`. It's
recommended to generate these fields implicitly on the client side. For further
information see the [relevant documentation of these
fields](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html).
The order in which the fields are serialized within one datagram is undefined
and may be freely chosen by the client. The server side might or might not
retain or reorder it when writing it to the Journal.
Some programs might generate multi-line log messages (e.g. a stack unwinder
generating log output about a stack trace, with one line for each stack
frame). It's highly recommended to send these as a single datagram, using a
single `MESSAGE=` field with embedded newline characters between the lines (the
second serialization method described above must hence be used for this
field). If possible do not split up individual events into multiple Journal
events that might then be processed and written into the Journal as separate
entries. The Journal toolchain is capable of handling multi-line log entries
just fine, and it's generally preferred to have a single set of metadata fields
associated with each multi-line message.
Note that the same keys may be used multiple times within the same datagram,
with different values. The Journal supports this and will write such entries to
disk without complaining. This is useful for associating a single log entry
with multiple suitable objects of the same type at once. This should only be
used for specific Journal fields however, where this is expected. Do not use
this for Journal fields where this is not expected and where code reasonably
assumes per-event uniqueness of the keys. In most cases code that consumes and
displays log entries is likely to ignore such non-unique fields or only
consider the first of the specified values. Specifically, if a Journal entry
contains multiple `MESSAGE=` fields, likely only the first one is
displayed. Note that a well-written logging client library thus will not use a
plain dictionary for accepting structured log metadata, but rather a data
structure that allows non-unique keys, for example an array, or a dictionary
that optionally maps to a set of values instead of a single value.
## Example Datagram
Here's an encoded message, with various common fields, all encoded according to
the first serialization method, with the exception of one, where the value
contains a newline character, and thus the second method is needed to be used.
```
PRIORITY=3\n
SYSLOG_FACILITY=3\n
CODE_FILE=src/foobar.c\n
CODE_LINE=77\n
BINARY_BLOB\n
\004\000\000\000\000\000\000\000xx\nx\n
CODE_FUNC=some_func\n
SYSLOG_IDENTIFIER=footool\n
MESSAGE=Something happened.\n
```
(Lines are broken here after each `\n` to make things more readable. C-style
backslash escaping is used.)
## Automatic Protocol Upgrading
It might be wise to automatically upgrade to logging via the Journal's native
protocol in clients that previously used the BSD syslog protocol. Behaviour in
this case should be pretty obvious: try connecting a socket to
`/run/systemd/journal/socket` first (on success use the native Journal
protocol), and if that fails fall back to `/dev/log` (and use the BSD syslog
protocol).
Programs normally logging to STDERR might also choose to upgrade to native
Journal logging in case they are invoked via systemd's service logic, where
STDOUT and STDERR are going to the Journal anyway. By preferring the native
protocol over STDERR-based logging, structured metadata can be passed along,
including priority information and more — which is not available on STDERR
based logging. If a program wants to detect automatically whether its STDERR is
connected to the Journal's stream transport, look for the `$JOURNAL_STREAM`
environment variable. The systemd service logic sets this variable to a
colon-separated pair of device and inode number (formatted in decimal ASCII) of
the STDERR file descriptor. If the `.st_dev` and `.st_ino` fields of the
`struct stat` data returned by `fstat(STDERR_FILENO, …)` match these values a
program can be sure its STDERR is connected to the Journal, and may then opt to
upgrade to the native Journal protocol via an `AF_UNIX` socket of its own, and
cease to use STDERR.
Why bother with this environment variable check? A service program invoked by
systemd might employ shell-style I/O redirection on invoked subprograms, and
those should likely not upgrade to the native Journal protocol, but instead
continue to use the redirected file descriptors passed to them. Thus, by
comparing the device and inode number of the actual STDERR file descriptor with
the one the service manager passed, one can make sure that no I/O redirection
took place for the current program.
## Alternative Implementations
If you are looking for alternative implementations of this protocol (besides
systemd's own in `sd_journal_print()`), consider
[GLib's](https://gitlab.gnome.org/GNOME/glib/-/blob/master/glib/gmessages.c) or
[`dbus-broker`'s](https://github.com/bus1/dbus-broker/blob/main/src/util/log.c).
And that's already all there is to it.

View File

@ -1297,13 +1297,18 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnMicro-Star*:pn*A10SC*:*
# MSI Modern series # MSI Modern series
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnMicro-StarInternational*:pnModern*:* evdev:atkbd:dmi:bvn*:bvr*:bd*:svnMicro-StarInternational*:pnModern*:*
KEYBOARD_KEY_56=backslash # secondary backslash key
KEYBOARD_KEY_f1=f20 # Fn+F5 micmute KEYBOARD_KEY_f1=f20 # Fn+F5 micmute
KEYBOARD_KEY_76=f21 # Fn+F4 touchpad, becomes meta+ctrl+toggle KEYBOARD_KEY_76=f21 # Fn+F4 touchpad, becomes meta+ctrl+toggle
KEYBOARD_KEY_91=prog1 # Fn+F7 Creation Center, sometime F7 KEYBOARD_KEY_91=prog1 # Fn+F7 Creation Center, sometime F7
KEYBOARD_KEY_f2=prog2 # Fn+F12 screen rotation KEYBOARD_KEY_f2=prog2 # Fn+F12 screen rotation
KEYBOARD_KEY_8d=prog3 # Fn+a
KEYBOARD_KEY_8c=prog4 # Fn+z
KEYBOARD_KEY_f5=fn_esc # Fn+esc toggle the behaviour of Fn keys
KEYBOARD_KEY_97=unknown # lid close KEYBOARD_KEY_97=unknown # lid close
KEYBOARD_KEY_98=unknown # lid open KEYBOARD_KEY_98=unknown # lid open
#Fn+PrntScr sends meta+shif+s # Fn+PrntScr sends meta+shift+s
########################################################### ###########################################################
# MSI # MSI

View File

@ -846,6 +846,10 @@
<title>Exit status</title> <title>Exit status</title>
<para>On success, 0 is returned, a non-zero failure code otherwise.</para> <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
<para>When a command is invoked with <command>with</command>, the exit status of the child is
propagated. Effectively, <command>homectl</command> will exit without error if the command is
successfully invoked <emphasis>and</emphasis> finishes successfully.</para>
</refsect1> </refsect1>
<xi:include href="common-variables.xml" /> <xi:include href="common-variables.xml" />

View File

@ -218,6 +218,9 @@ sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(
<function>sd_journal_send()</function>. Using <function>sd_journal_send()</function>. Using
<function>syslog()</function> has the benefit of being <function>syslog()</function> has the benefit of being
more portable.</para> more portable.</para>
<para>These functions implement a client to the <ulink
url="https://systemd.io/JOURNAL_NATIVE_PROTOCOL">Native Journal Protocol</ulink>.</para>
</refsect1> </refsect1>
<refsect1> <refsect1>

View File

@ -17,22 +17,29 @@
<refnamediv> <refnamediv>
<refname>systemd-cryptsetup@.service</refname> <refname>systemd-cryptsetup@.service</refname>
<!-- <refname>system-systemd\x2dcryptsetup.slice</refname> — this causes meson to go haywire because it
thinks this is a (windows) path. Let's just not create the alias for this name, and only include it
in the synopsis. -->
<refname>systemd-cryptsetup</refname> <refname>systemd-cryptsetup</refname>
<refpurpose>Full disk decryption logic</refpurpose> <refpurpose>Full disk decryption logic</refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<para><filename>systemd-cryptsetup@.service</filename></para> <para><filename>systemd-cryptsetup@.service</filename></para>
<para><filename>system-systemd\x2dcryptsetup.slice</filename></para>
<para><filename>/usr/lib/systemd/systemd-cryptsetup</filename></para> <para><filename>/usr/lib/systemd/systemd-cryptsetup</filename></para>
</refsynopsisdiv> </refsynopsisdiv>
<refsect1> <refsect1>
<title>Description</title> <title>Description</title>
<para><filename>systemd-cryptsetup@.service</filename> is a <para><filename>systemd-cryptsetup@.service</filename> is a service responsible for setting up encrypted
service responsible for setting up encrypted block devices. It is block devices. It is instantiated for each device that requires decryption for access.</para>
instantiated for each device that requires decryption for
access.</para> <para><filename>systemd-cryptsetup@.service</filename> instances are part of the
<filename>system-systemd\x2dcryptsetup.slice</filename> slice, which is destroyed only very late in the
shutdown procedure. This allows the encrypted devices to remain up until filesystems have been unmounted.
</para>
<para><filename>systemd-cryptsetup@.service</filename> will ask <para><filename>systemd-cryptsetup@.service</filename> will ask
for hard disk passwords via the <ulink for hard disk passwords via the <ulink

View File

@ -53,9 +53,10 @@
project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry> project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
call</para></listitem> call</para></listitem>
<listitem><para>Structured system log messages via the native <listitem><para>Structured system log messages via the native Journal API, see
Journal API, see <citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry></para></listitem> and <ulink url="https://systemd.io/JOURNAL_NATIVE_PROTOCOL">Native Journal
Protocol</ulink></para></listitem>
<listitem><para>Standard output and standard error of service units. For further details see <listitem><para>Standard output and standard error of service units. For further details see
below.</para></listitem> below.</para></listitem>

View File

@ -263,16 +263,18 @@
<refsect1> <refsect1>
<title>Exit status</title> <title>Exit status</title>
<para>On success, 0 is returned. If the configuration was syntactically invalid (syntax errors, <para>On success, 0 is returned. If the configuration was syntactically invalid (syntax errors, missing
missing arguments, …), so some lines had to be ignored, but no other errors occurred, arguments, …), so some lines had to be ignored, but no other errors occurred, <constant>65</constant> is
<constant>65</constant> is returned (<constant>EX_DATAERR</constant> from returned (<constant>EX_DATAERR</constant> from <filename>/usr/include/sysexits.h</filename>). If the
<filename>/usr/include/sysexits.h</filename>). If the configuration was syntactically valid, but configuration was syntactically valid, but could not be executed (lack of permissions, creation of files
could not be executed (lack of permissions, creation of files in missing directories, invalid in missing directories, invalid contents when writing to <filename>/sys/</filename> values, …),
contents when writing to <filename>/sys/</filename> values, …), <constant>73</constant> is <constant>73</constant> is returned (<constant>EX_CANTCREAT</constant> from
returned (<constant>EX_CANTCREAT</constant> from <filename>/usr/include/sysexits.h</filename>). <filename>/usr/include/sysexits.h</filename>). Otherwise, <constant>1</constant> is returned
Otherwise, <constant>1</constant> is returned (<constant>EXIT_FAILURE</constant> from (<constant>EXIT_FAILURE</constant> from <filename>/usr/include/stdlib.h</filename>).</para>
<filename>/usr/include/stdlib.h</filename>).
</para> <para>Note: when creating items, if the target already exists, but is of the wrong type or otherwise does
not match the requested state, and forced operation has not been requested with <literal>+</literal>,
a message is emitted, but the failure is otherwise ignored.</para>
</refsect1> </refsect1>
<refsect1> <refsect1>

View File

@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: systemd\n" "Project-Id-Version: systemd\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-08 17:48+0100\n" "POT-Creation-Date: 2021-01-08 17:48+0100\n"
"PO-Revision-Date: 2021-03-25 03:01+0000\n" "PO-Revision-Date: 2021-04-09 07:01+0000\n"
"Last-Translator: simmon <simmon@nplob.com>\n" "Last-Translator: simmon <simmon@nplob.com>\n"
"Language-Team: Korean <https://translate.fedoraproject.org/projects/systemd/" "Language-Team: Korean <https://translate.fedoraproject.org/projects/systemd/"
"master/ko/>\n" "master/ko/>\n"
@ -18,7 +18,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n" "Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.5.1\n" "X-Generator: Weblate 4.5.3\n"
"X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SourceCharset: UTF-8\n"
#: src/core/org.freedesktop.systemd1.policy.in:22 #: src/core/org.freedesktop.systemd1.policy.in:22
@ -132,7 +132,7 @@ msgstr "정적 호스트 이름 설정"
msgid "" msgid ""
"Authentication is required to set the statically configured local hostname, " "Authentication is required to set the statically configured local hostname, "
"as well as the pretty hostname." "as well as the pretty hostname."
msgstr "로컬호스트 이름을 모양새를 갖춘 호스트이름 처럼 정적으로 설정하려면 인증이 필요합니다." msgstr "로컬호스트 이름을 지정 호스트이름 처럼 정적으로 설정하려면 인증이 필요합니다."
#: src/hostname/org.freedesktop.hostname1.policy:41 #: src/hostname/org.freedesktop.hostname1.policy:41
msgid "Set machine information" msgid "Set machine information"

View File

@ -427,8 +427,10 @@ const char *special_glyph(SpecialGlyph code) {
}, },
}; };
assert(code < _SPECIAL_GLYPH_MAX); if (code < 0)
return NULL;
assert(code < _SPECIAL_GLYPH_MAX);
return draw_table[code >= _SPECIAL_GLYPH_FIRST_EMOJI ? emoji_enabled() : is_locale_utf8()][code]; return draw_table[code >= _SPECIAL_GLYPH_FIRST_EMOJI ? emoji_enabled() : is_locale_utf8()][code];
} }

View File

@ -39,7 +39,7 @@ void init_gettext(void);
bool is_locale_utf8(void); bool is_locale_utf8(void);
typedef enum { typedef enum SpecialGlyph {
SPECIAL_GLYPH_TREE_VERTICAL, SPECIAL_GLYPH_TREE_VERTICAL,
SPECIAL_GLYPH_TREE_BRANCH, SPECIAL_GLYPH_TREE_BRANCH,
SPECIAL_GLYPH_TREE_RIGHT, SPECIAL_GLYPH_TREE_RIGHT,
@ -70,6 +70,7 @@ typedef enum {
SPECIAL_GLYPH_LOCK_AND_KEY, SPECIAL_GLYPH_LOCK_AND_KEY,
SPECIAL_GLYPH_TOUCH, SPECIAL_GLYPH_TOUCH,
_SPECIAL_GLYPH_MAX, _SPECIAL_GLYPH_MAX,
_SPECIAL_GLYPH_INVALID = -EINVAL,
} SpecialGlyph; } SpecialGlyph;
const char *special_glyph(SpecialGlyph code) _const_; const char *special_glyph(SpecialGlyph code) _const_;

View File

@ -296,22 +296,19 @@ static const char* const notify_access_table[_NOTIFY_ACCESS_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(notify_access, NotifyAccess); DEFINE_STRING_TABLE_LOOKUP(notify_access, NotifyAccess);
SpecialGlyph unit_active_state_to_glyph(UnitActiveState state) { SpecialGlyph unit_active_state_to_glyph(UnitActiveState state) {
switch (state) { static const SpecialGlyph map[_UNIT_ACTIVE_STATE_MAX] = {
case UNIT_ACTIVE: [UNIT_ACTIVE] = SPECIAL_GLYPH_BLACK_CIRCLE,
return SPECIAL_GLYPH_BLACK_CIRCLE; [UNIT_RELOADING] = SPECIAL_GLYPH_CIRCLE_ARROW,
case UNIT_RELOADING: [UNIT_INACTIVE] = SPECIAL_GLYPH_WHITE_CIRCLE,
return SPECIAL_GLYPH_CIRCLE_ARROW; [UNIT_FAILED] = SPECIAL_GLYPH_MULTIPLICATION_SIGN,
case UNIT_INACTIVE: [UNIT_ACTIVATING] = SPECIAL_GLYPH_BLACK_CIRCLE,
return SPECIAL_GLYPH_WHITE_CIRCLE; [UNIT_DEACTIVATING] = SPECIAL_GLYPH_BLACK_CIRCLE,
case UNIT_FAILED: [UNIT_MAINTENANCE] = SPECIAL_GLYPH_WHITE_CIRCLE,
return SPECIAL_GLYPH_MULTIPLICATION_SIGN; };
case UNIT_ACTIVATING:
case UNIT_DEACTIVATING:
return SPECIAL_GLYPH_BLACK_CIRCLE;
case UNIT_MAINTENANCE:
return SPECIAL_GLYPH_WHITE_CIRCLE;
default: if (state < 0)
return SPECIAL_GLYPH_BLACK_CIRCLE; return _SPECIAL_GLYPH_INVALID;
}
assert(state < _UNIT_ACTIVE_STATE_MAX);
return map[state];
} }

View File

@ -3362,4 +3362,4 @@ static int run(int argc, char *argv[]) {
return dispatch_verb(argc, argv, verbs, NULL); return dispatch_verb(argc, argv, verbs, NULL);
} }
DEFINE_MAIN_FUNCTION(run); DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);

View File

@ -2140,6 +2140,8 @@ static int manager_scheduled_shutdown_handler(
target = SPECIAL_POWEROFF_TARGET; target = SPECIAL_POWEROFF_TARGET;
else if (streq(m->scheduled_shutdown_type, "reboot")) else if (streq(m->scheduled_shutdown_type, "reboot"))
target = SPECIAL_REBOOT_TARGET; target = SPECIAL_REBOOT_TARGET;
else if (streq(m->scheduled_shutdown_type, "kexec"))
target = SPECIAL_KEXEC_TARGET;
else if (streq(m->scheduled_shutdown_type, "halt")) else if (streq(m->scheduled_shutdown_type, "halt"))
target = SPECIAL_HALT_TARGET; target = SPECIAL_HALT_TARGET;
else else
@ -2205,7 +2207,7 @@ static int method_schedule_shutdown(sd_bus_message *message, void *userdata, sd_
action = "org.freedesktop.login1.power-off"; action = "org.freedesktop.login1.power-off";
action_multiple_sessions = "org.freedesktop.login1.power-off-multiple-sessions"; action_multiple_sessions = "org.freedesktop.login1.power-off-multiple-sessions";
action_ignore_inhibit = "org.freedesktop.login1.power-off-ignore-inhibit"; action_ignore_inhibit = "org.freedesktop.login1.power-off-ignore-inhibit";
} else if (streq(type, "reboot")) { } else if (STR_IN_SET(type, "reboot", "kexec")) {
action = "org.freedesktop.login1.reboot"; action = "org.freedesktop.login1.reboot";
action_multiple_sessions = "org.freedesktop.login1.reboot-multiple-sessions"; action_multiple_sessions = "org.freedesktop.login1.reboot-multiple-sessions";
action_ignore_inhibit = "org.freedesktop.login1.reboot-ignore-inhibit"; action_ignore_inhibit = "org.freedesktop.login1.reboot-ignore-inhibit";

View File

@ -25,6 +25,13 @@
#include "radv-internal.h" #include "radv-internal.h"
#include "web-util.h" #include "web-util.h"
bool link_dhcp6_with_address_enabled(Link *link) {
if (!link_dhcp6_enabled(link))
return false;
return link->network->dhcp6_use_address;
}
bool link_dhcp6_pd_is_enabled(Link *link) { bool link_dhcp6_pd_is_enabled(Link *link) {
assert(link); assert(link);

View File

@ -26,6 +26,7 @@ typedef struct DHCP6DelegatedPrefix {
DHCP6DelegatedPrefix *dhcp6_pd_free(DHCP6DelegatedPrefix *p); DHCP6DelegatedPrefix *dhcp6_pd_free(DHCP6DelegatedPrefix *p);
DEFINE_TRIVIAL_CLEANUP_FUNC(DHCP6DelegatedPrefix*, dhcp6_pd_free); DEFINE_TRIVIAL_CLEANUP_FUNC(DHCP6DelegatedPrefix*, dhcp6_pd_free);
bool link_dhcp6_with_address_enabled(Link *link);
bool link_dhcp6_pd_is_enabled(Link *link); bool link_dhcp6_pd_is_enabled(Link *link);
int dhcp6_pd_remove(Link *link); int dhcp6_pd_remove(Link *link);
int dhcp6_configure(Link *link); int dhcp6_configure(Link *link);

View File

@ -779,7 +779,7 @@ void link_check_ready(Link *link) {
break; break;
} }
if ((link_dhcp4_enabled(link) || link_dhcp6_enabled(link) || link_ipv4ll_enabled(link)) && if ((link_dhcp4_enabled(link) || link_dhcp6_with_address_enabled(link) || link_ipv4ll_enabled(link)) &&
!link->dhcp_address && set_isempty(link->dhcp6_addresses) && !has_ndisc_address && !link->dhcp_address && set_isempty(link->dhcp6_addresses) && !has_ndisc_address &&
!link->ipv4ll_address_configured) !link->ipv4ll_address_configured)
/* When DHCP[46] or IPv4LL is enabled, at least one address is acquired by them. */ /* When DHCP[46] or IPv4LL is enabled, at least one address is acquired by them. */

View File

@ -1656,10 +1656,9 @@ static int create_directory_or_subvolume(const char *path, mode_t mode, bool sub
return log_error_errno(r, "%s does not exist and cannot be created as the file system is read-only.", path); return log_error_errno(r, "%s does not exist and cannot be created as the file system is read-only.", path);
if (k < 0) if (k < 0)
return log_error_errno(k, "Failed to check if %s exists: %m", path); return log_error_errno(k, "Failed to check if %s exists: %m", path);
if (!k) { if (!k)
log_warning("\"%s\" already exists and is not a directory.", path); return log_warning_errno(SYNTHETIC_ERRNO(EEXIST),
return -EEXIST; "\"%s\" already exists and is not a directory.", path);
}
*creation = CREATION_EXISTING; *creation = CREATION_EXISTING;
} else } else
@ -1742,10 +1741,10 @@ static int empty_directory(Item *i, const char *path) {
} }
if (r < 0) if (r < 0)
return log_error_errno(r, "is_dir() failed on path %s: %m", path); return log_error_errno(r, "is_dir() failed on path %s: %m", path);
if (r == 0) if (r == 0) {
return log_error_errno(SYNTHETIC_ERRNO(EEXIST), log_warning("\"%s\" already exists and is not a directory.", path);
"'%s' already exists and is not a directory.", return 0;
path); }
return path_set_perms(i, path); return path_set_perms(i, path);
} }
@ -1804,7 +1803,7 @@ static int create_device(Item *i, mode_t file_type) {
return log_error_errno(r, "Failed to create device node \"%s\": %m", i->path); return log_error_errno(r, "Failed to create device node \"%s\": %m", i->path);
creation = CREATION_FORCE; creation = CREATION_FORCE;
} else { } else {
log_debug("%s is not a device node.", i->path); log_warning("\"%s\" already exists is not a device node.", i->path);
return 0; return 0;
} }
} else } else
@ -2575,7 +2574,9 @@ static int patch_var_run(const char *fname, unsigned line, char **path) {
/* Also log about this briefly. We do so at LOG_NOTICE level, as we fixed up the situation automatically, hence /* Also log about this briefly. We do so at LOG_NOTICE level, as we fixed up the situation automatically, hence
* there's no immediate need for action by the user. However, in the interest of making things less confusing * there's no immediate need for action by the user. However, in the interest of making things less confusing
* to the user, let's still inform the user that these snippets should really be updated. */ * to the user, let's still inform the user that these snippets should really be updated. */
log_syntax(NULL, LOG_NOTICE, fname, line, 0, "Line references path below legacy directory /var/run/, updating %s → %s; please update the tmpfiles.d/ drop-in file accordingly.", *path, n); log_syntax(NULL, LOG_NOTICE, fname, line, 0,
"Line references path below legacy directory /var/run/, updating %s → %s; please update the tmpfiles.d/ drop-in file accordingly.",
*path, n);
free_and_replace(*path, n); free_and_replace(*path, n);

View File

@ -16,4 +16,4 @@ NSPAWN_TIMEOUT=20
# only found from the console during the poweroff. # only found from the console during the poweroff.
rm -f /tmp/honorfirstshutdown.log >/dev/null rm -f /tmp/honorfirstshutdown.log >/dev/null
do_test "$@" 52 > /tmp/honorfirstshutdown.log do_test "$@" 52 >/tmp/honorfirstshutdown.log

View File

@ -2,8 +2,8 @@
Description=Test for StandardOutput=append: Description=Test for StandardOutput=append:
[Service] [Service]
ExecStartPre=sh -c 'printf "hello\n" > /tmp/test-exec-standardoutput-output' ExecStartPre=sh -c 'printf "hello\n" >/tmp/test-exec-standardoutput-output'
ExecStartPre=sh -c 'printf "hello\nhello\n" > /tmp/test-exec-standardoutput-expected' ExecStartPre=sh -c 'printf "hello\nhello\n" >/tmp/test-exec-standardoutput-expected'
StandardInput=data StandardInput=data
StandardInputText=hello StandardInputText=hello
StandardOutput=append:/tmp/test-exec-standardoutput-output StandardOutput=append:/tmp/test-exec-standardoutput-output

View File

@ -2,8 +2,8 @@
Description=Test for StandardOutput=file: Description=Test for StandardOutput=file:
[Service] [Service]
ExecStartPre=sh -c 'printf "nooo\nhello\n" > /tmp/test-exec-standardoutput-output' ExecStartPre=sh -c 'printf "nooo\nhello\n" >/tmp/test-exec-standardoutput-output'
ExecStartPre=sh -c 'printf "hello\nello\n" > /tmp/test-exec-standardoutput-expected' ExecStartPre=sh -c 'printf "hello\nello\n" >/tmp/test-exec-standardoutput-expected'
StandardInput=data StandardInput=data
StandardInputText=hello StandardInputText=hello
StandardOutput=file:/tmp/test-exec-standardoutput-output StandardOutput=file:/tmp/test-exec-standardoutput-output

View File

@ -2,8 +2,8 @@
Description=Test for StandardOutput=truncate: Description=Test for StandardOutput=truncate:
[Service] [Service]
ExecStartPre=sh -c 'printf "hello\n" > /tmp/test-exec-standardoutput-output' ExecStartPre=sh -c 'printf "hello\n" >/tmp/test-exec-standardoutput-output'
ExecStartPre=sh -c 'printf "hi\n" > /tmp/test-exec-standardoutput-expected' ExecStartPre=sh -c 'printf "hi\n" >/tmp/test-exec-standardoutput-expected'
StandardInput=data StandardInput=data
StandardInputText=hi StandardInputText=hi
StandardOutput=truncate:/tmp/test-exec-standardoutput-output StandardOutput=truncate:/tmp/test-exec-standardoutput-output

View File

@ -503,13 +503,13 @@ install_verity_minimal() {
ln -s ../usr/lib/os-release $initdir/etc/os-release ln -s ../usr/lib/os-release $initdir/etc/os-release
touch $initdir/etc/machine-id $initdir/etc/resolv.conf touch $initdir/etc/machine-id $initdir/etc/resolv.conf
touch $initdir/opt/some_file touch $initdir/opt/some_file
echo MARKER=1 >> $initdir/usr/lib/os-release echo MARKER=1 >>$initdir/usr/lib/os-release
echo -e "[Service]\nExecStartPre=cat /usr/lib/os-release\nExecStart=sleep 120" > $initdir/usr/lib/systemd/system/app0.service echo -e "[Service]\nExecStartPre=cat /usr/lib/os-release\nExecStart=sleep 120" >$initdir/usr/lib/systemd/system/app0.service
cp $initdir/usr/lib/systemd/system/app0.service $initdir/usr/lib/systemd/system/app0-foo.service cp $initdir/usr/lib/systemd/system/app0.service $initdir/usr/lib/systemd/system/app0-foo.service
mksquashfs $initdir $oldinitdir/usr/share/minimal_0.raw mksquashfs $initdir $oldinitdir/usr/share/minimal_0.raw
veritysetup format $oldinitdir/usr/share/minimal_0.raw $oldinitdir/usr/share/minimal_0.verity | \ veritysetup format $oldinitdir/usr/share/minimal_0.raw $oldinitdir/usr/share/minimal_0.verity | \
grep '^Root hash:' | cut -f2 | tr -d '\n' > $oldinitdir/usr/share/minimal_0.roothash grep '^Root hash:' | cut -f2 | tr -d '\n' >$oldinitdir/usr/share/minimal_0.roothash
sed -i "s/MARKER=1/MARKER=2/g" $initdir/usr/lib/os-release sed -i "s/MARKER=1/MARKER=2/g" $initdir/usr/lib/os-release
rm $initdir/usr/lib/systemd/system/app0-foo.service rm $initdir/usr/lib/systemd/system/app0-foo.service
@ -517,7 +517,7 @@ install_verity_minimal() {
mksquashfs $initdir $oldinitdir/usr/share/minimal_1.raw mksquashfs $initdir $oldinitdir/usr/share/minimal_1.raw
veritysetup format $oldinitdir/usr/share/minimal_1.raw $oldinitdir/usr/share/minimal_1.verity | \ veritysetup format $oldinitdir/usr/share/minimal_1.raw $oldinitdir/usr/share/minimal_1.verity | \
grep '^Root hash:' | cut -f2 | tr -d '\n' > $oldinitdir/usr/share/minimal_1.roothash grep '^Root hash:' | cut -f2 | tr -d '\n' >$oldinitdir/usr/share/minimal_1.roothash
# Rolling distros like Arch do not set VERSION_ID # Rolling distros like Arch do not set VERSION_ID
local version_id="" local version_id=""
@ -527,42 +527,42 @@ install_verity_minimal() {
export initdir=$TESTDIR/app0 export initdir=$TESTDIR/app0
mkdir -p $initdir/usr/lib/extension-release.d $initdir/usr/lib/systemd/system $initdir/opt mkdir -p $initdir/usr/lib/extension-release.d $initdir/usr/lib/systemd/system $initdir/opt
grep "^ID=" $os_release > $initdir/usr/lib/extension-release.d/extension-release.app0 grep "^ID=" $os_release >$initdir/usr/lib/extension-release.d/extension-release.app0
echo "${version_id}" >> $initdir/usr/lib/extension-release.d/extension-release.app0 echo "${version_id}" >>$initdir/usr/lib/extension-release.d/extension-release.app0
cat <<EOF > $initdir/usr/lib/systemd/system/app0.service cat <<EOF >$initdir/usr/lib/systemd/system/app0.service
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/opt/script0.sh ExecStart=/opt/script0.sh
EOF EOF
cat <<EOF > $initdir/opt/script0.sh cat <<EOF >$initdir/opt/script0.sh
#!/bin/bash #!/bin/bash
set -e set -e
test -e /usr/lib/os-release test -e /usr/lib/os-release
cat /usr/lib/extension-release.d/extension-release.app0 cat /usr/lib/extension-release.d/extension-release.app0
EOF EOF
chmod +x $initdir/opt/script0.sh chmod +x $initdir/opt/script0.sh
echo MARKER=1 > $initdir/usr/lib/systemd/system/some_file echo MARKER=1 >$initdir/usr/lib/systemd/system/some_file
mksquashfs $initdir $oldinitdir/usr/share/app0.raw mksquashfs $initdir $oldinitdir/usr/share/app0.raw
export initdir=$TESTDIR/app1 export initdir=$TESTDIR/app1
mkdir -p $initdir/usr/lib/extension-release.d $initdir/usr/lib/systemd/system $initdir/opt mkdir -p $initdir/usr/lib/extension-release.d $initdir/usr/lib/systemd/system $initdir/opt
grep "^ID=" $os_release > $initdir/usr/lib/extension-release.d/extension-release.app1 grep "^ID=" $os_release >$initdir/usr/lib/extension-release.d/extension-release.app1
echo "${version_id}" >> $initdir/usr/lib/extension-release.d/extension-release.app1 echo "${version_id}" >>$initdir/usr/lib/extension-release.d/extension-release.app1
cat <<EOF > $initdir/usr/lib/systemd/system/app1.service cat <<EOF >$initdir/usr/lib/systemd/system/app1.service
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/opt/script1.sh ExecStart=/opt/script1.sh
EOF EOF
cat <<EOF > $initdir/opt/script1.sh cat <<EOF >$initdir/opt/script1.sh
#!/bin/bash #!/bin/bash
set -e set -e
test -e /usr/lib/os-release test -e /usr/lib/os-release
cat /usr/lib/extension-release.d/extension-release.app1 cat /usr/lib/extension-release.d/extension-release.app1
EOF EOF
chmod +x $initdir/opt/script1.sh chmod +x $initdir/opt/script1.sh
echo MARKER=1 > $initdir/usr/lib/systemd/system/other_file echo MARKER=1 >$initdir/usr/lib/systemd/system/other_file
mksquashfs $initdir $oldinitdir/usr/share/app1.raw mksquashfs $initdir $oldinitdir/usr/share/app1.raw
) )
} }
@ -700,7 +700,7 @@ if [[ "$ASAN_COMPILER" == "clang" ]]; then
# Let's add the ASan DSO's path to the dynamic linker's cache. This is pretty # Let's add the ASan DSO's path to the dynamic linker's cache. This is pretty
# unnecessary for gcc & libasan, however, for clang this is crucial, as its # unnecessary for gcc & libasan, however, for clang this is crucial, as its
# runtime ASan DSO is in a non-standard (library) path. # runtime ASan DSO is in a non-standard (library) path.
echo "${ASAN_RT_PATH%/*}" > /etc/ld.so.conf.d/asan-path-override.conf echo "${ASAN_RT_PATH%/*}" >/etc/ld.so.conf.d/asan-path-override.conf
ldconfig ldconfig
fi fi
echo DefaultEnvironment=\$DEFAULT_ENVIRONMENT >>/etc/systemd/system.conf echo DefaultEnvironment=\$DEFAULT_ENVIRONMENT >>/etc/systemd/system.conf
@ -741,7 +741,7 @@ printf "[Service]\nEnvironment=ASAN_OPTIONS=leak_check_at_exit=false\n" >/etc/sy
# they're uninstrumented (like dmsetup). Let's add a simple rule which sets # they're uninstrumented (like dmsetup). Let's add a simple rule which sets
# LD_PRELOAD to the ASan RT library to fix this. # LD_PRELOAD to the ASan RT library to fix this.
mkdir -p /etc/udev/rules.d mkdir -p /etc/udev/rules.d
cat > /etc/udev/rules.d/00-set-LD_PRELOAD.rules << INNER_EOF cat >/etc/udev/rules.d/00-set-LD_PRELOAD.rules <<INNER_EOF
SUBSYSTEM=="block", ENV{LD_PRELOAD}="$ASAN_RT_PATH" SUBSYSTEM=="block", ENV{LD_PRELOAD}="$ASAN_RT_PATH"
INNER_EOF INNER_EOF
chmod 0644 /etc/udev/rules.d/00-set-LD_PRELOAD.rules chmod 0644 /etc/udev/rules.d/00-set-LD_PRELOAD.rules
@ -856,9 +856,9 @@ install_systemd() {
[[ "$LOOKS_LIKE_SUSE" ]] && setup_suse [[ "$LOOKS_LIKE_SUSE" ]] && setup_suse
# enable debug logging in PID1 # enable debug logging in PID1
echo LogLevel=debug >> $initdir/etc/systemd/system.conf echo LogLevel=debug >>$initdir/etc/systemd/system.conf
# store coredumps in journal # store coredumps in journal
echo Storage=journal >> $initdir/etc/systemd/coredump.conf echo Storage=journal >>$initdir/etc/systemd/coredump.conf
} }
get_ldpath() { get_ldpath() {
@ -1174,12 +1174,12 @@ install_config_files() {
inst_any /etc/os-release /usr/lib/os-release inst_any /etc/os-release /usr/lib/os-release
inst /etc/localtime inst /etc/localtime
# we want an empty environment # we want an empty environment
> $initdir/etc/environment >$initdir/etc/environment
> $initdir/etc/machine-id >$initdir/etc/machine-id
> $initdir/etc/resolv.conf >$initdir/etc/resolv.conf
# set the hostname # set the hostname
echo systemd-testsuite > $initdir/etc/hostname echo systemd-testsuite >$initdir/etc/hostname
# let's set up just one image with the traditional verbose output # let's set up just one image with the traditional verbose output
if [ ${IMAGE_NAME} != "basic" ]; then if [ ${IMAGE_NAME} != "basic" ]; then
@ -1202,9 +1202,9 @@ install_debug_tools() {
# Set default TERM from vt220 to linux, so at least basic key shortcuts work # Set default TERM from vt220 to linux, so at least basic key shortcuts work
local _getty_override="$initdir/etc/systemd/system/serial-getty@.service.d" local _getty_override="$initdir/etc/systemd/system/serial-getty@.service.d"
mkdir -p "$_getty_override" mkdir -p "$_getty_override"
echo -e "[Service]\nEnvironment=TERM=linux" > "$_getty_override/default-TERM.conf" echo -e "[Service]\nEnvironment=TERM=linux" >"$_getty_override/default-TERM.conf"
cat > "$initdir/etc/motd" << EOF cat >"$initdir/etc/motd" <<EOF
To adjust the terminal size use: To adjust the terminal size use:
export COLUMNS=xx export COLUMNS=xx
export LINES=yy export LINES=yy
@ -1246,7 +1246,7 @@ install_dbus() {
# setup policy for Type=dbus test # setup policy for Type=dbus test
mkdir -p $initdir/etc/dbus-1/system.d mkdir -p $initdir/etc/dbus-1/system.d
cat > $initdir/etc/dbus-1/system.d/systemd.test.ExecStopPost.conf <<EOF cat >$initdir/etc/dbus-1/system.d/systemd.test.ExecStopPost.conf <<EOF
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
@ -1987,7 +1987,7 @@ install_kmod_with_fw() {
fi fi
[ -d "$initdir/.kernelmodseen" ] && \ [ -d "$initdir/.kernelmodseen" ] && \
> "$initdir/.kernelmodseen/${1##*/}" >"$initdir/.kernelmodseen/${1##*/}"
inst_simple "$1" "/lib/modules/$KERNEL_VER/${1##*/lib/modules/$KERNEL_VER/}" \ inst_simple "$1" "/lib/modules/$KERNEL_VER/${1##*/lib/modules/$KERNEL_VER/}" \
|| return $? || return $?
@ -2059,11 +2059,11 @@ filter_kernel_modules_by_path () (
for _modname in $(eval $_filtercmd); do for _modname in $(eval $_filtercmd); do
case $_modname in case $_modname in
*.ko) "$2" "$_modname" && echo "$_modname";; *.ko) "$2" "$_modname" && echo "$_modname";;
*.ko.gz) gzip -dc "$_modname" > $initdir/$$.ko *.ko.gz) gzip -dc "$_modname" >$initdir/$$.ko
$2 $initdir/$$.ko && echo "$_modname" $2 $initdir/$$.ko && echo "$_modname"
rm -f $initdir/$$.ko rm -f $initdir/$$.ko
;; ;;
*.ko.xz) xz -dc "$_modname" > $initdir/$$.ko *.ko.xz) xz -dc "$_modname" >$initdir/$$.ko
$2 $initdir/$$.ko && echo "$_modname" $2 $initdir/$$.ko && echo "$_modname"
rm -f $initdir/$$.ko rm -f $initdir/$$.ko
;; ;;
@ -2276,7 +2276,7 @@ test_setup() {
fi fi
local hook_defined=1 local hook_defined=1
if declare -f -F test_append_files > /dev/null; then if declare -f -F test_append_files >/dev/null; then
hook_defined=$? hook_defined=$?
fi fi

View File

@ -7,4 +7,4 @@ After=testsuite-28-pre.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=test -f /tmp/test-specifier-j-%j ExecStart=test -f /tmp/test-specifier-j-%j
ExecStart=sh -c 'echo OK > /testok' ExecStart=sh -c 'echo OK >/testok'

View File

@ -3,7 +3,7 @@ set -ex
set -o pipefail set -o pipefail
if ! test -x /usr/lib/systemd/tests/testdata/units/test-honor-first-shutdown.sh ; then if ! test -x /usr/lib/systemd/tests/testdata/units/test-honor-first-shutdown.sh ; then
echo "honor-first-shutdown script not found - FAIL" > /testok echo "honor-first-shutdown script not found - FAIL" >/testok
exit 0 exit 0
fi fi
@ -13,6 +13,6 @@ systemd-analyze log-target console
systemctl enable test-honor-first-shutdown.service systemctl enable test-honor-first-shutdown.service
systemctl start test-honor-first-shutdown.service systemctl start test-honor-first-shutdown.service
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -6,9 +6,9 @@ set -ex
systemctl start --no-block hello-after-sleep.target systemctl start --no-block hello-after-sleep.target
systemctl list-jobs > /root/list-jobs.txt systemctl list-jobs >/root/list-jobs.txt
while ! grep 'sleep\.service.*running' /root/list-jobs.txt; do while ! grep 'sleep\.service.*running' /root/list-jobs.txt; do
systemctl list-jobs > /root/list-jobs.txt systemctl list-jobs >/root/list-jobs.txt
done done
grep 'hello\.service.*waiting' /root/list-jobs.txt grep 'hello\.service.*waiting' /root/list-jobs.txt
@ -19,20 +19,20 @@ systemctl start --job-mode=ignore-dependencies hello
END_SEC=$(date -u '+%s') END_SEC=$(date -u '+%s')
ELAPSED=$(($END_SEC-$START_SEC)) ELAPSED=$(($END_SEC-$START_SEC))
[ "$ELAPSED" -lt 3 ] test "$ELAPSED" -lt 3
# sleep should still be running, hello not. # sleep should still be running, hello not.
systemctl list-jobs > /root/list-jobs.txt systemctl list-jobs >/root/list-jobs.txt
grep 'sleep\.service.*running' /root/list-jobs.txt grep 'sleep\.service.*running' /root/list-jobs.txt
grep 'hello\.service' /root/list-jobs.txt && exit 1 grep 'hello\.service' /root/list-jobs.txt && exit 1
systemctl stop sleep.service hello-after-sleep.target systemctl stop sleep.service hello-after-sleep.target
# Some basic testing that --show-transaction does something useful # Some basic testing that --show-transaction does something useful
! systemctl is-active systemd-importd systemctl is-active systemd-importd && { echo 'unexpected success'; exit 1; }
systemctl -T start systemd-importd systemctl -T start systemd-importd
systemctl is-active systemd-importd systemctl is-active systemd-importd
systemctl --show-transaction stop systemd-importd systemctl --show-transaction stop systemd-importd
! systemctl is-active systemd-importd systemctl is-active systemd-importd && { echo 'unexpected success'; exit 1; }
# Test for a crash when enqueuing a JOB_NOP when other job already exists # Test for a crash when enqueuing a JOB_NOP when other job already exists
systemctl start --no-block hello-after-sleep.target systemctl start --no-block hello-after-sleep.target
@ -58,13 +58,13 @@ systemctl stop --job-mode=replace-irreversibly unstoppable.service
systemctl start unstoppable.service systemctl start unstoppable.service
# Test waiting for a started unit(s) to terminate again # Test waiting for a started unit(s) to terminate again
cat <<EOF > /run/systemd/system/wait2.service cat <<EOF >/run/systemd/system/wait2.service
[Unit] [Unit]
Description=Wait for 2 seconds Description=Wait for 2 seconds
[Service] [Service]
ExecStart=/bin/sh -ec 'sleep 2' ExecStart=/bin/sh -ec 'sleep 2'
EOF EOF
cat <<EOF > /run/systemd/system/wait5fail.service cat <<EOF >/run/systemd/system/wait5fail.service
[Unit] [Unit]
Description=Wait for 5 seconds and fail Description=Wait for 5 seconds and fail
[Service] [Service]
@ -80,7 +80,7 @@ ELAPSED=$(($END_SEC-$START_SEC))
# wait5fail fails, so systemctl should fail # wait5fail fails, so systemctl should fail
START_SEC=$(date -u '+%s') START_SEC=$(date -u '+%s')
! systemctl start --wait wait2.service wait5fail.service || exit 1 systemctl start --wait wait2.service wait5fail.service && { echo 'unexpected success'; exit 1; }
END_SEC=$(date -u '+%s') END_SEC=$(date -u '+%s')
ELAPSED=$(($END_SEC-$START_SEC)) ELAPSED=$(($END_SEC-$START_SEC))
[[ "$ELAPSED" -ge 5 ]] && [[ "$ELAPSED" -le 7 ]] || exit 1 [[ "$ELAPSED" -ge 5 ]] && [[ "$ELAPSED" -le 7 ]] || exit 1

View File

@ -59,19 +59,19 @@ journalctl -b -o export --output-fields=MESSAGE,FOO --output-fields=PRIORITY,MES
grep -q '^__CURSOR=' /output grep -q '^__CURSOR=' /output
grep -q '^MESSAGE=foo$' /output grep -q '^MESSAGE=foo$' /output
grep -q '^PRIORITY=6$' /output grep -q '^PRIORITY=6$' /output
! grep -q '^FOO=' /output grep '^FOO=' /output && { echo 'unexpected success'; exit 1; }
! grep -q '^SYSLOG_FACILITY=' /output grep '^SYSLOG_FACILITY=' /output && { echo 'unexpected success'; exit 1; }
# `-b all` negates earlier use of -b (-b and -m are otherwise exclusive) # `-b all` negates earlier use of -b (-b and -m are otherwise exclusive)
journalctl -b -1 -b all -m > /dev/null journalctl -b -1 -b all -m >/dev/null
# -b always behaves like -b0 # -b always behaves like -b0
journalctl -q -b-1 -b0 | head -1 > /expected journalctl -q -b-1 -b0 | head -1 >/expected
journalctl -q -b-1 -b | head -1 > /output journalctl -q -b-1 -b | head -1 >/output
cmp /expected /output cmp /expected /output
# ... even when another option follows (both of these should fail due to -m) # ... even when another option follows (both of these should fail due to -m)
{ journalctl -ball -b0 -m 2>&1 || :; } | head -1 > /expected { journalctl -ball -b0 -m 2>&1 || :; } | head -1 >/expected
{ journalctl -ball -b -m 2>&1 || :; } | head -1 > /output { journalctl -ball -b -m 2>&1 || :; } | head -1 >/output
cmp /expected /output cmp /expected /output
# https://github.com/systemd/systemd/issues/13708 # https://github.com/systemd/systemd/issues/13708

View File

@ -14,7 +14,7 @@ SocketGroup=adm
SocketMode=0660 SocketMode=0660
EOF EOF
cat <<'EOF' > /run/systemd/system/test12@.service cat <<'EOF' >/run/systemd/system/test12@.service
[Unit] [Unit]
Description=Test service Description=Test service
[Service] [Service]

View File

@ -51,9 +51,9 @@ function check_norbind {
local _root="/var/lib/machines/testsuite-13.norbind-path" local _root="/var/lib/machines/testsuite-13.norbind-path"
rm -rf "$_root" rm -rf "$_root"
mkdir -p /tmp/binddir/subdir mkdir -p /tmp/binddir/subdir
echo -n "outer" > /tmp/binddir/subdir/file echo -n "outer" >/tmp/binddir/subdir/file
mount -t tmpfs tmpfs /tmp/binddir/subdir mount -t tmpfs tmpfs /tmp/binddir/subdir
echo -n "inner" > /tmp/binddir/subdir/file echo -n "inner" >/tmp/binddir/subdir/file
/usr/lib/systemd/tests/testdata/create-busybox-container "$_root" /usr/lib/systemd/tests/testdata/create-busybox-container "$_root"
systemd-nspawn $SUSE_OPTS--register=no -D "$_root" --bind=/tmp/binddir:/mnt:norbind /bin/sh -c 'CONTENT=$(cat /mnt/subdir/file); if [[ $CONTENT != "outer" ]]; then echo "*** unexpected content: $CONTENT"; return 1; fi' systemd-nspawn $SUSE_OPTS--register=no -D "$_root" --bind=/tmp/binddir:/mnt:norbind /bin/sh -c 'CONTENT=$(cat /mnt/subdir/file); if [[ $CONTENT != "outer" ]]; then echo "*** unexpected content: $CONTENT"; return 1; fi'
} }
@ -73,7 +73,7 @@ if [ -n "${VERSION_ID:+set}" ] && [ "${VERSION_ID}" != "${container_host_version
if [ -n "${BUILD_ID:+set}" ] && [ "${BUILD_ID}" != "${container_host_build_id}" ]; then exit 1; fi if [ -n "${BUILD_ID:+set}" ] && [ "${BUILD_ID}" != "${container_host_build_id}" ]; then exit 1; fi
if [ -n "${VARIANT_ID:+set}" ] && [ "${VARIANT_ID}" != "${container_host_variant_id}" ]; then exit 1; fi if [ -n "${VARIANT_ID:+set}" ] && [ "${VARIANT_ID}" != "${container_host_variant_id}" ]; then exit 1; fi
cd /tmp; (cd /run/host; md5sum os-release) | md5sum -c cd /tmp; (cd /run/host; md5sum os-release) | md5sum -c
if echo test >> /run/host/os-release; then exit 1; fi if echo test >>/run/host/os-release; then exit 1; fi
' '
local _os_release_source="/etc/os-release" local _os_release_source="/etc/os-release"
@ -82,7 +82,7 @@ if echo test >> /run/host/os-release; then exit 1; fi
elif [ -L "${_os_release_source}" ] && rm /etc/os-release; then elif [ -L "${_os_release_source}" ] && rm /etc/os-release; then
# Ensure that /etc always wins if available # Ensure that /etc always wins if available
cp /usr/lib/os-release /etc cp /usr/lib/os-release /etc
echo MARKER=1 >> /etc/os-release echo MARKER=1 >>/etc/os-release
fi fi
systemd-nspawn $SUSE_OPTS--register=no -D /testsuite-13.nc-container --bind="${_os_release_source}":/tmp/os-release /bin/sh -x -e -c "$_cmd" systemd-nspawn $SUSE_OPTS--register=no -D /testsuite-13.nc-container --bind="${_os_release_source}":/tmp/os-release /bin/sh -x -e -c "$_cmd"
@ -96,7 +96,7 @@ if echo test >> /run/host/os-release; then exit 1; fi
function check_machinectl_bind { function check_machinectl_bind {
local _cmd='for i in $(seq 1 20); do if test -f /tmp/marker; then exit 0; fi; sleep 0.5; done; exit 1;' local _cmd='for i in $(seq 1 20); do if test -f /tmp/marker; then exit 0; fi; sleep 0.5; done; exit 1;'
cat <<EOF > /run/systemd/system/nspawn_machinectl_bind.service cat <<EOF >/run/systemd/system/nspawn_machinectl_bind.service
[Service] [Service]
Type=notify Type=notify
ExecStart=systemd-nspawn $SUSE_OPTS -D /testsuite-13.nc-container --notify-ready=no /bin/sh -x -e -c "$_cmd" ExecStart=systemd-nspawn $SUSE_OPTS -D /testsuite-13.nc-container --notify-ready=no /bin/sh -x -e -c "$_cmd"

View File

@ -165,7 +165,7 @@ test_hierarchical_dropins () {
echo " echo "
[Service] [Service]
ExecCondition=/bin/echo $dropin ExecCondition=/bin/echo $dropin
" > /usr/lib/systemd/system/$dropin/override.conf " >/usr/lib/systemd/system/$dropin/override.conf
systemctl daemon-reload systemctl daemon-reload
check_ok a-b-c ExecCondition "/bin/echo $dropin" check_ok a-b-c ExecCondition "/bin/echo $dropin"
done done

View File

@ -19,7 +19,7 @@ while : ; do
sleep .5 sleep .5
done done
cat > /run/udev/rules.d/50-testsuite.rules <<EOF cat >/run/udev/rules.d/50-testsuite.rules <<EOF
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="sda", ENV{SYSTEMD_WANTS}="foobar.service" ACTION!="remove", SUBSYSTEM=="block", KERNEL=="sda", ENV{SYSTEMD_WANTS}="foobar.service"
EOF EOF
udevadm control --reload udevadm control --reload
@ -36,7 +36,7 @@ while : ; do
sleep .5 sleep .5
done done
cat > /run/udev/rules.d/50-testsuite.rules <<EOF cat >/run/udev/rules.d/50-testsuite.rules <<EOF
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="sda", ENV{SYSTEMD_WANTS}="waldo.service" ACTION!="remove", SUBSYSTEM=="block", KERNEL=="sda", ENV{SYSTEMD_WANTS}="waldo.service"
EOF EOF
udevadm control --reload udevadm control --reload

View File

@ -4,7 +4,7 @@ set -o pipefail
mkdir -p /run/udev/rules.d/ mkdir -p /run/udev/rules.d/
cat > /run/udev/rules.d/50-testsuite.rules <<EOF cat >/run/udev/rules.d/50-testsuite.rules <<EOF
ACTION=="remove", GOTO="lo_end" ACTION=="remove", GOTO="lo_end"
SUBSYSTEM=="net", KERNEL=="lo", TAG+="systemd", ENV{SYSTEMD_ALIAS}+="/sys/subsystem/net/devices/lo" SUBSYSTEM=="net", KERNEL=="lo", TAG+="systemd", ENV{SYSTEMD_ALIAS}+="/sys/subsystem/net/devices/lo"

View File

@ -7,9 +7,9 @@ test_rule="/run/udev/rules.d/49-test.rules"
setup() { setup() {
mkdir -p "${test_rule%/*}" mkdir -p "${test_rule%/*}"
cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bckp cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bckp
echo 'KERNEL=="lo", SUBSYSTEM=="net", PROGRAM=="/bin/sleep 60"' > "${test_rule}" echo 'KERNEL=="lo", SUBSYSTEM=="net", PROGRAM=="/bin/sleep 60"' >"${test_rule}"
echo "event_timeout=30" >> /etc/udev/udev.conf echo "event_timeout=30" >>/etc/udev/udev.conf
echo "timeout_signal=SIGABRT" >> /etc/udev/udev.conf echo "timeout_signal=SIGABRT" >>/etc/udev/udev.conf
systemctl restart systemd-udevd.service systemctl restart systemd-udevd.service
} }
@ -25,7 +25,7 @@ teardown() {
run_test() { run_test() {
since="$(date +%T)" since="$(date +%T)"
echo add > /sys/class/net/lo/uevent echo add >/sys/class/net/lo/uevent
for n in {1..20}; do for n in {1..20}; do
sleep 5 sleep 5

View File

@ -4,14 +4,11 @@ set -o pipefail
mkdir -p /run/udev/rules.d/ mkdir -p /run/udev/rules.d/
! test -f /run/udev/tags/added/c1:3 && test ! -f /run/udev/tags/added/c1:3
! test -f /run/udev/tags/changed/c1:3 && test ! -f /run/udev/tags/changed/c1:3
udevadm info /dev/null | grep -q -v 'E: TAGS=.*:added:.*' && udevadm info /dev/null | grep -E 'E: (TAGS|CURRENT_TAGS)=.*:(added|changed):' && exit 1
udevadm info /dev/null | grep -q -v 'E: CURRENT_TAGS=.*:added:.*' &&
udevadm info /dev/null | grep -q -v 'E: TAGS=.*:changed:.*' &&
udevadm info /dev/null | grep -q -v 'E: CURRENT_TAGS=.*:changed:.*'
cat > /run/udev/rules.d/50-testsuite.rules <<EOF cat >/run/udev/rules.d/50-testsuite.rules <<EOF
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", TAG+="added" ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", TAG+="added"
ACTION=="change", SUBSYSTEM=="mem", KERNEL=="null", TAG+="changed" ACTION=="change", SUBSYSTEM=="mem", KERNEL=="null", TAG+="changed"
EOF EOF
@ -19,45 +16,39 @@ EOF
udevadm control --reload udevadm control --reload
udevadm trigger -c add /dev/null udevadm trigger -c add /dev/null
while : ; do while test ! -f /run/udev/tags/added/c1:3 ||
test -f /run/udev/tags/added/c1:3 && test -f /run/udev/tags/changed/c1:3 ||
! test -f /run/udev/tags/changed/c1:3 && ! udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' ||
udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' && ! udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*' ||
udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*' && udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' ||
udevadm info /dev/null | grep -q -v 'E: TAGS=.*:changed:.*' && udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*'
udevadm info /dev/null | grep -q -v 'E: CURRENT_TAGS=.*:changed:.*' && do
break
sleep .5 sleep .5
done done
udevadm control --reload udevadm control --reload
udevadm trigger -c change /dev/null udevadm trigger -c change /dev/null
while : ; do while test ! -f /run/udev/tags/added/c1:3 ||
test -f /run/udev/tags/added/c1:3 && test ! -f /run/udev/tags/changed/c1:3 ||
test -f /run/udev/tags/changed/c1:3 && ! udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' ||
udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' && udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*' ||
udevadm info /dev/null | grep -q -v 'E: CURRENT_TAGS=.*:added:.*' && ! udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' ||
udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' && ! udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*'
udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*' && do
break
sleep .5 sleep .5
done done
udevadm control --reload udevadm control --reload
udevadm trigger -c add /dev/null udevadm trigger -c add /dev/null
while : ; do while test ! -f /run/udev/tags/added/c1:3 ||
test -f /run/udev/tags/added/c1:3 && test ! -f /run/udev/tags/changed/c1:3 ||
test -f /run/udev/tags/changed/c1:3 && ! udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' ||
udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' && ! udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*' ||
udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*' && ! udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' ||
udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' && udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*'
udevadm info /dev/null | grep -q -v 'E: CURRENT_TAGS=.*:changed:.*' && do
break
sleep .5 sleep .5
done done

View File

@ -4,7 +4,7 @@ set -o pipefail
mkdir -p /run/udev/rules.d/ mkdir -p /run/udev/rules.d/
cat > /run/udev/rules.d/50-testsuite.rules <<EOF cat >/run/udev/rules.d/50-testsuite.rules <<EOF
SUBSYSTEM=="mem", KERNEL=="null", OPTIONS="log_level=debug" SUBSYSTEM=="mem", KERNEL=="null", OPTIONS="log_level=debug"
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", IMPORT{program}="/bin/echo -e HOGE=aa\\\\x20\\\\x20\\\\x20bb\nFOO=\\\\x20aaa\\\\x20\n\n\n" ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", IMPORT{program}="/bin/echo -e HOGE=aa\\\\x20\\\\x20\\\\x20bb\nFOO=\\\\x20aaa\\\\x20\n\n\n"
EOF EOF

View File

@ -3,13 +3,13 @@ set -ex
set -o pipefail set -o pipefail
systemd-run --wait -p FailureAction=poweroff true systemd-run --wait -p FailureAction=poweroff true
! systemd-run --wait -p SuccessAction=poweroff false systemd-run --wait -p SuccessAction=poweroff false && { echo 'unexpected success'; exit 1; }
if ! test -f /firstphase ; then if ! test -f /firstphase ; then
echo OK > /firstphase echo OK >/firstphase
systemd-run --wait -p SuccessAction=reboot true systemd-run --wait -p SuccessAction=reboot true
else else
echo OK > /testok echo OK >/testok
systemd-run --wait -p FailureAction=poweroff false systemd-run --wait -p FailureAction=poweroff false
fi fi

View File

@ -34,6 +34,6 @@ else
echo "Skipping TEST-19-DELEGATE, as the kernel doesn't actually support cgroup v2" >&2 echo "Skipping TEST-19-DELEGATE, as the kernel doesn't actually support cgroup v2" >&2
fi fi
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -71,7 +71,7 @@ disown
sleep infinity & sleep infinity &
disown disown
echo \$MAINPID > /run/mainpidsh/pid echo \$MAINPID >/run/mainpidsh/pid
EOF EOF
chmod +x /tmp/test20-mainpid.sh chmod +x /tmp/test20-mainpid.sh
@ -95,7 +95,7 @@ disown
sleep infinity & sleep infinity &
disown disown
echo \$MAINPID > /run/mainpidsh2/pid echo \$MAINPID >/run/mainpidsh2/pid
chown 1001:1001 /run/mainpidsh2/pid chown 1001:1001 /run/mainpidsh2/pid
EOF EOF
chmod +x /tmp/test20-mainpid2.sh chmod +x /tmp/test20-mainpid2.sh
@ -126,14 +126,24 @@ test -f /run/mainpidsh3/pid
EOF EOF
chmod 755 /dev/shm/test20-mainpid3.sh chmod 755 /dev/shm/test20-mainpid3.sh
# This has to fail, as we shouldn't accept the dangerous PID file, and then inotify-wait on it to be corrected which we never do # This has to fail, as we shouldn't accept the dangerous PID file, and then
! systemd-run --unit=test20-mainpidsh3.service -p StandardOutput=tty -p StandardError=tty -p Type=forking -p RuntimeDirectory=mainpidsh3 -p PIDFile=/run/mainpidsh3/pid -p DynamicUser=1 -p TimeoutStartSec=2s /dev/shm/test20-mainpid3.sh # inotify-wait on it to be corrected which we never do.
systemd-run --unit=test20-mainpidsh3.service \
-p StandardOutput=tty \
-p StandardError=tty \
-p Type=forking \
-p RuntimeDirectory=mainpidsh3 \
-p PIDFile=/run/mainpidsh3/pid \
-p DynamicUser=1 \
-p TimeoutStartSec=2s \
/dev/shm/test20-mainpid3.sh \
&& { echo 'unexpected success'; exit 1; }
# Test that this failed due to timeout, and not some other error # Test that this failed due to timeout, and not some other error
test `systemctl show -P Result test20-mainpidsh3.service` = timeout test $(systemctl show -P Result test20-mainpidsh3.service) = timeout
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -10,4 +10,4 @@ rm -fr /tmp/test
echo "e /tmp/test - root root 1d" | systemd-tmpfiles --create - echo "e /tmp/test - root root 1d" | systemd-tmpfiles --create -
! test -e /tmp/test test ! -e /tmp/test

View File

@ -63,7 +63,7 @@ e /tmp/e/1 0755 daemon daemon - -
e /tmp/e/2/* 0755 daemon daemon - - e /tmp/e/2/* 0755 daemon daemon - -
EOF EOF
! test -d /tmp/e/1 test ! -d /tmp/e/1
test -d /tmp/e/2 test -d /tmp/e/2
test $(stat -c %U:%G:%a /tmp/e/2) = "root:root:777" test $(stat -c %U:%G:%a /tmp/e/2) = "root:root:777"
@ -80,7 +80,7 @@ chmod 777 /tmp/e/3/d*
touch /tmp/e/3/f1 touch /tmp/e/3/f1
chmod 644 /tmp/e/3/f1 chmod 644 /tmp/e/3/f1
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF
e /tmp/e/3/* 0755 daemon daemon - - e /tmp/e/3/* 0755 daemon daemon - -
EOF EOF
@ -115,7 +115,7 @@ test $(stat -c %U:%G:%a /tmp/C/1/f1) = "daemon:daemon:755"
test -d /tmp/C/2 test -d /tmp/C/2
test $(stat -c %U:%G:%a /tmp/C/2/f1) = "daemon:daemon:755" test $(stat -c %U:%G:%a /tmp/C/2/f1) = "daemon:daemon:755"
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF
C /tmp/C/3 0755 daemon daemon - /tmp/C/3-origin C /tmp/C/3 0755 daemon daemon - /tmp/C/3-origin
EOF EOF

View File

@ -19,7 +19,7 @@ f /tmp/f/2 0644 - - - This string should be written
EOF EOF
### '1' should exist and be empty ### '1' should exist and be empty
test -f /tmp/f/1; ! test -s /tmp/f/1 test -f /tmp/f/1; test ! -s /tmp/f/1
test $(stat -c %U:%G:%a /tmp/f/1) = "root:root:644" test $(stat -c %U:%G:%a /tmp/f/1) = "root:root:644"
test $(stat -c %U:%G:%a /tmp/f/2) = "root:root:644" test $(stat -c %U:%G:%a /tmp/f/2) = "root:root:644"
@ -31,7 +31,7 @@ f /tmp/f/1 0666 daemon daemon - This string should not be written
EOF EOF
# file should be empty # file should be empty
! test -s /tmp/f/1 test ! -s /tmp/f/1
test $(stat -c %U:%G:%a /tmp/f/1) = "daemon:daemon:666" test $(stat -c %U:%G:%a /tmp/f/1) = "daemon:daemon:666"
### But we shouldn't try to set perms on an existing file which is not a ### But we shouldn't try to set perms on an existing file which is not a
@ -39,7 +39,7 @@ test $(stat -c %U:%G:%a /tmp/f/1) = "daemon:daemon:666"
mkfifo /tmp/f/fifo mkfifo /tmp/f/fifo
chmod 644 /tmp/f/fifo chmod 644 /tmp/f/fifo
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
f /tmp/f/fifo 0666 daemon daemon - This string should not be written f /tmp/f/fifo 0666 daemon daemon - This string should not be written
EOF EOF
@ -50,11 +50,11 @@ test $(stat -c %U:%G:%a /tmp/f/fifo) = "root:root:644"
ln -s missing /tmp/f/dangling ln -s missing /tmp/f/dangling
ln -s /tmp/file-owned-by-root /tmp/f/symlink ln -s /tmp/file-owned-by-root /tmp/f/symlink
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
f /tmp/f/dangling 0644 daemon daemon - - f /tmp/f/dangling 0644 daemon daemon - -
f /tmp/f/symlink 0644 daemon daemon - - f /tmp/f/symlink 0644 daemon daemon - -
EOF EOF
! test -e /tmp/f/missing test ! -e /tmp/f/missing
test $(stat -c %U:%G:%a /tmp/file-owned-by-root) = "root:root:644" test $(stat -c %U:%G:%a /tmp/file-owned-by-root) = "root:root:644"
### Handle read-only filesystem gracefully: we shouldn't fail if the target ### Handle read-only filesystem gracefully: we shouldn't fail if the target
@ -70,27 +70,27 @@ mount -o bind,ro /tmp/f/rw-fs /tmp/f/ro-fs
systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF
f /tmp/f/ro-fs/foo 0644 - - - - This string should not be written f /tmp/f/ro-fs/foo 0644 - - - - This string should not be written
EOF EOF
test -f /tmp/f/ro-fs/foo; ! test -s /tmp/f/ro-fs/foo test -f /tmp/f/ro-fs/foo; test ! -s /tmp/f/ro-fs/foo
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
f /tmp/f/ro-fs/foo 0666 - - - - f /tmp/f/ro-fs/foo 0666 - - - -
EOF EOF
test $(stat -c %U:%G:%a /tmp/f/fifo) = "root:root:644" test $(stat -c %U:%G:%a /tmp/f/fifo) = "root:root:644"
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
f /tmp/f/ro-fs/bar 0644 - - - - f /tmp/f/ro-fs/bar 0644 - - - -
EOF EOF
! test -e /tmp/f/ro-fs/bar test ! -e /tmp/f/ro-fs/bar
### 'f' shouldn't follow unsafe paths. ### 'f' shouldn't follow unsafe paths.
mkdir /tmp/f/daemon mkdir /tmp/f/daemon
ln -s /root /tmp/f/daemon/unsafe-symlink ln -s /root /tmp/f/daemon/unsafe-symlink
chown -R --no-dereference daemon:daemon /tmp/f/daemon chown -R --no-dereference daemon:daemon /tmp/f/daemon
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
f /tmp/f/daemon/unsafe-symlink/exploit 0644 daemon daemon - - f /tmp/f/daemon/unsafe-symlink/exploit 0644 daemon daemon - -
EOF EOF
! test -e /tmp/f/daemon/unsafe-symlink/exploit test ! -e /tmp/f/daemon/unsafe-symlink/exploit
# #
# 'F' # 'F'
@ -105,10 +105,10 @@ F /tmp/F/truncated 0666 daemon daemon - -
F /tmp/F/truncated-with-content 0666 daemon daemon - new content F /tmp/F/truncated-with-content 0666 daemon daemon - new content
EOF EOF
test -f /tmp/F/created; ! test -s /tmp/F/created test -f /tmp/F/created; test ! -s /tmp/F/created
test -f /tmp/F/created-with-content test -f /tmp/F/created-with-content
test "$(< /tmp/F/created-with-content)" = "new content" test "$(< /tmp/F/created-with-content)" = "new content"
test -f /tmp/F/truncated; ! test -s /tmp/F/truncated test -f /tmp/F/truncated; test ! -s /tmp/F/truncated
test $(stat -c %U:%G:%a /tmp/F/truncated) = "daemon:daemon:666" test $(stat -c %U:%G:%a /tmp/F/truncated) = "daemon:daemon:666"
test -s /tmp/F/truncated-with-content test -s /tmp/F/truncated-with-content
test $(stat -c %U:%G:%a /tmp/F/truncated-with-content) = "daemon:daemon:666" test $(stat -c %U:%G:%a /tmp/F/truncated-with-content) = "daemon:daemon:666"
@ -117,7 +117,7 @@ test $(stat -c %U:%G:%a /tmp/F/truncated-with-content) = "daemon:daemon:666"
### unspecified in the other cases. ### unspecified in the other cases.
mkfifo /tmp/F/fifo mkfifo /tmp/F/fifo
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
F /tmp/F/fifo 0644 - - - - F /tmp/F/fifo 0644 - - - -
EOF EOF
@ -127,11 +127,11 @@ test -p /tmp/F/fifo
ln -s missing /tmp/F/dangling ln -s missing /tmp/F/dangling
ln -s /tmp/file-owned-by-root /tmp/F/symlink ln -s /tmp/file-owned-by-root /tmp/F/symlink
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
f /tmp/F/dangling 0644 daemon daemon - - f /tmp/F/dangling 0644 daemon daemon - -
f /tmp/F/symlink 0644 daemon daemon - - f /tmp/F/symlink 0644 daemon daemon - -
EOF EOF
! test -e /tmp/F/missing test ! -e /tmp/F/missing
test $(stat -c %U:%G:%a /tmp/file-owned-by-root) = "root:root:644" test $(stat -c %U:%G:%a /tmp/file-owned-by-root) = "root:root:644"
### Handle read-only filesystem gracefully: we shouldn't fail if the target ### Handle read-only filesystem gracefully: we shouldn't fail if the target
@ -147,40 +147,41 @@ mount -o bind,ro /tmp/F/rw-fs /tmp/F/ro-fs
systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF
F /tmp/F/ro-fs/foo 0644 - - - - F /tmp/F/ro-fs/foo 0644 - - - -
EOF EOF
test -f /tmp/F/ro-fs/foo; ! test -s /tmp/F/ro-fs/foo test -f /tmp/F/ro-fs/foo; test ! -s /tmp/F/ro-fs/foo
echo "truncating is not allowed anymore" >/tmp/F/rw-fs/foo echo "truncating is not allowed anymore" >/tmp/F/rw-fs/foo
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
F /tmp/F/ro-fs/foo 0644 - - - - F /tmp/F/ro-fs/foo 0644 - - - -
EOF EOF
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
F /tmp/F/ro-fs/foo 0644 - - - - This string should not be written F /tmp/F/ro-fs/foo 0644 - - - - This string should not be written
EOF EOF
test -f /tmp/F/ro-fs/foo; ! test -s /tmp/F/ro-fs/foo test -f /tmp/F/ro-fs/foo
grep -q 'truncating is not allowed' /tmp/F/ro-fs/foo
# Trying to change the perms should fail. # Trying to change the perms should fail.
>/tmp/F/rw-fs/foo >/tmp/F/rw-fs/foo
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
F /tmp/F/ro-fs/foo 0666 - - - - F /tmp/F/ro-fs/foo 0666 - - - -
EOF EOF
test $(stat -c %U:%G:%a /tmp/F/ro-fs/foo) = "root:root:644" test $(stat -c %U:%G:%a /tmp/F/ro-fs/foo) = "root:root:644"
### Try to create a new file. ### Try to create a new file.
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
F /tmp/F/ro-fs/bar 0644 - - - - F /tmp/F/ro-fs/bar 0644 - - - -
EOF EOF
! test -e /tmp/F/ro-fs/bar test ! -e /tmp/F/ro-fs/bar
### 'F' shouldn't follow unsafe paths. ### 'F' shouldn't follow unsafe paths.
mkdir /tmp/F/daemon mkdir /tmp/F/daemon
ln -s /root /tmp/F/daemon/unsafe-symlink ln -s /root /tmp/F/daemon/unsafe-symlink
chown -R --no-dereference daemon:daemon /tmp/F/daemon chown -R --no-dereference daemon:daemon /tmp/F/daemon
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
F /tmp/F/daemon/unsafe-symlink/exploit 0644 daemon daemon - - F /tmp/F/daemon/unsafe-symlink/exploit 0644 daemon daemon - -
EOF EOF
! test -e /tmp/F/daemon/unsafe-symlink/exploit test ! -e /tmp/F/daemon/unsafe-symlink/exploit
# #
# 'w' # 'w'
@ -191,10 +192,10 @@ touch /tmp/w/overwritten
systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF
w /tmp/w/unexistent 0644 - - - new content w /tmp/w/unexistent 0644 - - - new content
EOF EOF
! test -e /tmp/w/unexistent test ! -e /tmp/w/unexistent
### no argument given -> fails. ### no argument given -> fails.
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
w /tmp/w/unexistent 0644 - - - - w /tmp/w/unexistent 0644 - - - -
EOF EOF
@ -230,7 +231,7 @@ mkdir /tmp/w/daemon
ln -s /root /tmp/w/daemon/unsafe-symlink ln -s /root /tmp/w/daemon/unsafe-symlink
chown -R --no-dereference daemon:daemon /tmp/w/daemon chown -R --no-dereference daemon:daemon /tmp/w/daemon
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF && { echo 'unexpected success'; exit 1; }
f /tmp/w/daemon/unsafe-symlink/exploit 0644 daemon daemon - - f /tmp/w/daemon/unsafe-symlink/exploit 0644 daemon daemon - -
EOF EOF
! test -e /tmp/w/daemon/unsafe-symlink/exploit test ! -e /tmp/w/daemon/unsafe-symlink/exploit

View File

@ -17,8 +17,8 @@ EOF
test -p /tmp/p/fifo1 test -p /tmp/p/fifo1
test $(stat -c %U:%G:%a /tmp/p/fifo1) = "root:root:666" test $(stat -c %U:%G:%a /tmp/p/fifo1) = "root:root:666"
# it should refuse to overwrite an existing file # Refuse to overwrite an existing file. Error is not propagated.
! systemd-tmpfiles --create - <<EOF systemd-tmpfiles --create - <<EOF
p /tmp/p/f1 0666 - - - - p /tmp/p/f1 0666 - - - -
EOF EOF

View File

@ -18,8 +18,8 @@ test -d /var/tmp/foobar-test-06
test -d /var/tmp/foobar-test-06/important test -d /var/tmp/foobar-test-06/important
test_snippet --remove test_snippet --remove
! test -f /var/tmp/foobar-test-06 test ! -f /var/tmp/foobar-test-06
! test -f /var/tmp/foobar-test-06/important test ! -f /var/tmp/foobar-test-06/important
test_snippet --create test_snippet --create
test -d /var/tmp/foobar-test-06 test -d /var/tmp/foobar-test-06
@ -35,4 +35,4 @@ test -f /var/tmp/foobar-test-06/something-else
test_snippet --create --remove test_snippet --create --remove
test -d /var/tmp/foobar-test-06 test -d /var/tmp/foobar-test-06
test -d /var/tmp/foobar-test-06/important test -d /var/tmp/foobar-test-06/important
! test -f /var/tmp/foobar-test-06/something-else test ! -f /var/tmp/foobar-test-06/something-else

View File

@ -16,8 +16,8 @@ r /tmp/test-prefix
r /tmp/test-prefix/file r /tmp/test-prefix/file
EOF EOF
! test -f /tmp/test-prefix/file test ! -f /tmp/test-prefix/file
! test -f /tmp/test-prefix test ! -f /tmp/test-prefix
mkdir /tmp/test-prefix mkdir /tmp/test-prefix
touch /tmp/test-prefix/file touch /tmp/test-prefix/file
@ -27,5 +27,5 @@ r /tmp/test-prefix/file
r /tmp/test-prefix r /tmp/test-prefix
EOF EOF
! test -f /tmp/test-prefix/file test ! -f /tmp/test-prefix/file
! test -f /tmp/test-prefix test ! -f /tmp/test-prefix

View File

@ -22,10 +22,12 @@ test -d /tmp/root/test2
# Verify the command fails to write to a root-owned subdirectory under an # Verify the command fails to write to a root-owned subdirectory under an
# unprivileged user's directory when it's not part of the prefix, as expected # unprivileged user's directory when it's not part of the prefix, as expected
# by the unsafe_transition function. # by the unsafe_transition function.
! echo 'd /tmp/user/root/test' | systemd-tmpfiles --create - echo 'd /tmp/user/root/test' | systemd-tmpfiles --create - \
! test -e /tmp/user/root/test && { echo 'unexpected success'; exit 1; }
! echo 'd /user/root/test' | systemd-tmpfiles --root=/tmp --create - test ! -e /tmp/user/root/test
! test -e /tmp/user/root/test echo 'd /user/root/test' | systemd-tmpfiles --root=/tmp --create - \
&& { echo 'unexpected success'; exit 1; }
test ! -e /tmp/user/root/test
# Verify the above works when all user-owned directories are in the prefix. # Verify the above works when all user-owned directories are in the prefix.
echo 'd /test' | systemd-tmpfiles --root=/tmp/user/root --create - echo 'd /test' | systemd-tmpfiles --root=/tmp/user/root --create -

View File

@ -16,8 +16,8 @@ systemd-run --unit=three -p Type=simple /tmp/brokenbinary
# And now, do the same with Type=exec, where the latter two should fail # And now, do the same with Type=exec, where the latter two should fail
systemd-run --unit=four -p Type=exec /bin/sleep infinity systemd-run --unit=four -p Type=exec /bin/sleep infinity
! systemd-run --unit=five -p Type=exec -p User=idontexist /bin/sleep infinity systemd-run --unit=five -p Type=exec -p User=idontexist /bin/sleep infinity && { echo 'unexpected success'; exit 1; }
! systemd-run --unit=six -p Type=exec /tmp/brokenbinary systemd-run --unit=six -p Type=exec /tmp/brokenbinary && { echo 'unexpected success'; exit 1; }
systemd-run --unit=seven -p KillSignal=SIGTERM -p RestartKillSignal=SIGINT -p Type=exec /bin/sleep infinity systemd-run --unit=seven -p KillSignal=SIGTERM -p RestartKillSignal=SIGINT -p Type=exec /bin/sleep infinity
# Both TERM and SIGINT happen to have the same number on all architectures # Both TERM and SIGINT happen to have the same number on all architectures
@ -29,6 +29,6 @@ systemctl stop seven.service
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -34,8 +34,8 @@ cmp /var/tmp/testimage.raw /var/lib/machines/testimage3.raw
# Test removal # Test removal
machinectl remove testimage machinectl remove testimage
! test -f /var/lib/machines/testimage.raw test ! -f /var/lib/machines/testimage.raw
! machinectl image-status testimage machinectl image-status testimage && { echo 'unexpected success'; exit 1; }
# Test export of clone # Test export of clone
machinectl export-raw testimage3 /var/tmp/testimage3.raw machinectl export-raw testimage3 /var/tmp/testimage3.raw
@ -46,8 +46,8 @@ rm /var/tmp/testimage3.raw
machinectl rename testimage3 testimage4 machinectl rename testimage3 testimage4
test -f /var/lib/machines/testimage4.raw test -f /var/lib/machines/testimage4.raw
machinectl image-status testimage4 machinectl image-status testimage4
! test -f /var/lib/machines/testimage3.raw test ! -f /var/lib/machines/testimage3.raw
! machinectl image-status testimage3 machinectl image-status testimage3 && { echo 'unexpected success'; exit 1; }
cmp /var/tmp/testimage.raw /var/lib/machines/testimage4.raw cmp /var/tmp/testimage.raw /var/lib/machines/testimage4.raw
# Test export of rename # Test export of rename
@ -57,8 +57,8 @@ rm /var/tmp/testimage4.raw
# Test removal # Test removal
machinectl remove testimage4 machinectl remove testimage4
! test -f /var/lib/machines/testimage4.raw test ! -f /var/lib/machines/testimage4.raw
! machinectl image-status testimage4 machinectl image-status testimage4 && { echo 'unexpected success'; exit 1; }
# → And now, let's test directory trees ← # # → And now, let's test directory trees ← #
@ -67,7 +67,7 @@ mkdir /var/tmp/scratch
mv /var/tmp/testimage.raw /var/tmp/scratch/ mv /var/tmp/testimage.raw /var/tmp/scratch/
touch /var/tmp/scratch/anotherfile touch /var/tmp/scratch/anotherfile
mkdir /var/tmp/scratch/adirectory mkdir /var/tmp/scratch/adirectory
echo "piep" > /var/tmp/scratch/adirectory/athirdfile echo "piep" >/var/tmp/scratch/adirectory/athirdfile
# Test import-fs # Test import-fs
machinectl import-fs /var/tmp/scratch/ machinectl import-fs /var/tmp/scratch/
@ -90,8 +90,8 @@ diff -r /var/tmp/scratch/ /var/lib/machines/scratch2
# Test removal # Test removal
machinectl remove scratch machinectl remove scratch
! test -f /var/lib/machines/scratch test ! -f /var/lib/machines/scratch
! machinectl image-status scratch machinectl image-status scratchi && { echo 'unexpected success'; exit 1; }
# Test clone # Test clone
machinectl clone scratch2 scratch3 machinectl clone scratch2 scratch3
@ -103,21 +103,21 @@ diff -r /var/tmp/scratch/ /var/lib/machines/scratch3
# Test removal # Test removal
machinectl remove scratch2 machinectl remove scratch2
! test -f /var/lib/machines/scratch2 test ! -f /var/lib/machines/scratch2
! machinectl image-status scratch2 machinectl image-status scratch2 && { echo 'unexpected success'; exit 1; }
# Test rename # Test rename
machinectl rename scratch3 scratch4 machinectl rename scratch3 scratch4
test -d /var/lib/machines/scratch4 test -d /var/lib/machines/scratch4
machinectl image-status scratch4 machinectl image-status scratch4
! test -f /var/lib/machines/scratch3 test ! -f /var/lib/machines/scratch3
! machinectl image-status scratch3 machinectl image-status scratch3 && { echo 'unexpected success'; exit 1; }
diff -r /var/tmp/scratch/ /var/lib/machines/scratch4 diff -r /var/tmp/scratch/ /var/lib/machines/scratch4
# Test removal # Test removal
machinectl remove scratch4 machinectl remove scratch4
! test -f /var/lib/machines/scratch4 test ! -f /var/lib/machines/scratch4
! machinectl image-status scratch4 machinectl image-status scratch4 && { echo 'unexpected success'; exit 1; }
# Test import-tar hyphen/stdin pipe behavior # Test import-tar hyphen/stdin pipe behavior
cat /var/tmp/scratch.tar.gz | machinectl import-tar - scratch5 cat /var/tmp/scratch.tar.gz | machinectl import-tar - scratch5
@ -135,9 +135,9 @@ rm -rf /var/tmp/scratch
# Test removal # Test removal
machinectl remove scratch5 machinectl remove scratch5
! test -f /var/lib/machines/scratch5 test ! -f /var/lib/machines/scratch5
! machinectl image-status scratch5 machinectl image-status scratch5 && { echo 'unexpected success'; exit 1; }
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -22,10 +22,10 @@ systemctl show-environment | grep -q '^FOO=BAR$'
systemctl unset-environment FOO PATH systemctl unset-environment FOO PATH
# Check that one is gone and the other reverted to the built-in # Check that one is gone and the other reverted to the built-in
! (systemctl show-environment | grep -q '^FOO=$') systemctl show-environment | grep '^FOO=$' && exit 1
! (systemctl show-environment | grep -q '^PATH=.*testaddition$') systemctl show-environment | grep '^PATH=.*testaddition$' && exit 1
systemctl show-environment | grep -q '^PATH=' systemctl show-environment | grep -q '^PATH='
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -93,6 +93,6 @@ umount /tmp/overlay
umount /tmp/rootdir umount /tmp/rootdir
umount /tmp/app1 umount /tmp/app1
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -13,19 +13,19 @@ timedatectl set-time 1980-10-15
systemd-run --on-timezone-change touch /tmp/timezone-changed systemd-run --on-timezone-change touch /tmp/timezone-changed
systemd-run --on-clock-change touch /tmp/clock-changed systemd-run --on-clock-change touch /tmp/clock-changed
! test -f /tmp/timezone-changed test ! -f /tmp/timezone-changed
! test -f /tmp/clock-changed test ! -f /tmp/clock-changed
timedatectl set-timezone Europe/Kiev timedatectl set-timezone Europe/Kiev
while ! test -f /tmp/timezone-changed ; do sleep .5 ; done while test ! -f /tmp/timezone-changed ; do sleep .5 ; done
timedatectl set-time 2018-1-1 timedatectl set-time 2018-1-1
while ! test -f /tmp/clock-changed ; do sleep .5 ; done while test ! -f /tmp/clock-changed ; do sleep .5 ; done
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -6,5 +6,5 @@ if journalctl -b -t systemd --grep '\.device: Changed plugged -> dead'; then
exit 1 exit 1
fi fi
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -4,7 +4,7 @@
set -ex set -ex
set -o pipefail set -o pipefail
cat > /etc/systemd/system/testservice.service <<EOF cat >/etc/systemd/system/testservice.service <<EOF
[Service] [Service]
ConfigurationDirectory=testservice ConfigurationDirectory=testservice
RuntimeDirectory=testservice RuntimeDirectory=testservice
@ -18,11 +18,11 @@ EOF
systemctl daemon-reload systemctl daemon-reload
! test -e /etc/testservice test ! -e /etc/testservice
! test -e /run/testservice test ! -e /run/testservice
! test -e /var/lib/testservice test ! -e /var/lib/testservice
! test -e /var/cache/testservice test ! -e /var/cache/testservice
! test -e /var/log/testservice test ! -e /var/log/testservice
systemctl start testservice systemctl start testservice
@ -32,7 +32,7 @@ test -d /var/lib/testservice
test -d /var/cache/testservice test -d /var/cache/testservice
test -d /var/log/testservice test -d /var/log/testservice
! systemctl clean testservice systemctl clean testservice && { echo 'unexpected success'; exit 1; }
systemctl stop testservice systemctl stop testservice
@ -44,7 +44,7 @@ test -d /var/log/testservice
systemctl clean testservice --what=configuration systemctl clean testservice --what=configuration
! test -e /etc/testservice test ! -e /etc/testservice
test -d /run/testservice test -d /run/testservice
test -d /var/lib/testservice test -d /var/lib/testservice
test -d /var/cache/testservice test -d /var/cache/testservice
@ -52,29 +52,29 @@ test -d /var/log/testservice
systemctl clean testservice systemctl clean testservice
! test -e /etc/testservice test ! -e /etc/testservice
! test -e /run/testservice test ! -e /run/testservice
test -d /var/lib/testservice test -d /var/lib/testservice
! test -e /var/cache/testservice test ! -e /var/cache/testservice
test -d /var/log/testservice test -d /var/log/testservice
systemctl clean testservice --what=logs systemctl clean testservice --what=logs
! test -e /etc/testservice test ! -e /etc/testservice
! test -e /run/testservice test ! -e /run/testservice
test -d /var/lib/testservice test -d /var/lib/testservice
! test -e /var/cache/testservice test ! -e /var/cache/testservice
! test -e /var/log/testservice test ! -e /var/log/testservice
systemctl clean testservice --what=all systemctl clean testservice --what=all
! test -e /etc/testservice test ! -e /etc/testservice
! test -e /run/testservice test ! -e /run/testservice
! test -e /var/lib/testservice test ! -e /var/lib/testservice
! test -e /var/cache/testservice test ! -e /var/cache/testservice
! test -e /var/log/testservice test ! -e /var/log/testservice
cat > /etc/systemd/system/testservice.service <<EOF cat >/etc/systemd/system/testservice.service <<EOF
[Service] [Service]
DynamicUser=yes DynamicUser=yes
ConfigurationDirectory=testservice ConfigurationDirectory=testservice
@ -89,11 +89,11 @@ EOF
systemctl daemon-reload systemctl daemon-reload
! test -e /etc/testservice test ! -e /etc/testservice
! test -e /run/testservice test ! -e /run/testservice
! test -e /var/lib/testservice test ! -e /var/lib/testservice
! test -e /var/cache/testservice test ! -e /var/cache/testservice
! test -e /var/log/testservice test ! -e /var/log/testservice
systemctl restart testservice systemctl restart testservice
@ -107,7 +107,7 @@ test -L /var/lib/testservice
test -L /var/cache/testservice test -L /var/cache/testservice
test -L /var/log/testservice test -L /var/log/testservice
! systemctl clean testservice systemctl clean testservice && { echo 'unexpected success'; exit 1; }
systemctl stop testservice systemctl stop testservice
@ -123,7 +123,7 @@ test -L /var/log/testservice
systemctl clean testservice --what=configuration systemctl clean testservice --what=configuration
! test -d /etc/testservice test ! -d /etc/testservice
test -d /run/private/testservice test -d /run/private/testservice
test -d /var/lib/private/testservice test -d /var/lib/private/testservice
test -d /var/cache/private/testservice test -d /var/cache/private/testservice
@ -135,41 +135,41 @@ test -L /var/log/testservice
systemctl clean testservice systemctl clean testservice
! test -d /etc/testservice test ! -d /etc/testservice
! test -d /run/private/testservice test ! -d /run/private/testservice
test -d /var/lib/private/testservice test -d /var/lib/private/testservice
! test -d /var/cache/private/testservice test ! -d /var/cache/private/testservice
test -d /var/log/private/testservice test -d /var/log/private/testservice
! test -L /run/testservice test ! -L /run/testservice
test -L /var/lib/testservice test -L /var/lib/testservice
! test -L /var/cache/testservice test ! -L /var/cache/testservice
test -L /var/log/testservice test -L /var/log/testservice
systemctl clean testservice --what=logs systemctl clean testservice --what=logs
! test -d /etc/testservice test ! -d /etc/testservice
! test -d /run/private/testservice test ! -d /run/private/testservice
test -d /var/lib/private/testservice test -d /var/lib/private/testservice
! test -d /var/cache/private/testservice test ! -d /var/cache/private/testservice
! test -d /var/log/private/testservice test ! -d /var/log/private/testservice
! test -L /run/testservice test ! -L /run/testservice
test -L /var/lib/testservice test -L /var/lib/testservice
! test -L /var/cache/testservice test ! -L /var/cache/testservice
! test -L /var/log/testservice test ! -L /var/log/testservice
systemctl clean testservice --what=all systemctl clean testservice --what=all
! test -d /etc/testservice test ! -d /etc/testservice
! test -d /run/private/testservice test ! -d /run/private/testservice
! test -d /var/lib/private/testservice test ! -d /var/lib/private/testservice
! test -d /var/cache/private/testservice test ! -d /var/cache/private/testservice
! test -d /var/log/private/testservice test ! -d /var/log/private/testservice
! test -L /run/testservice test ! -L /run/testservice
! test -L /var/lib/testservice test ! -L /var/lib/testservice
! test -L /var/cache/testservice test ! -L /var/cache/testservice
! test -L /var/log/testservice test ! -L /var/log/testservice
cat > /etc/systemd/system/tmp-hoge.mount <<EOF cat >/etc/systemd/system/tmp-hoge.mount <<EOF
[Mount] [Mount]
What=tmpfs What=tmpfs
Type=tmpfs Type=tmpfs
@ -182,11 +182,11 @@ EOF
systemctl daemon-reload systemctl daemon-reload
! test -e /etc/hoge test ! -e /etc/hoge
! test -e /run/hoge test ! -e /run/hoge
! test -e /var/lib/hoge test ! -e /var/lib/hoge
! test -e /var/cache/hoge test ! -e /var/cache/hoge
! test -e /var/log/hoge test ! -e /var/log/hoge
systemctl start tmp-hoge.mount systemctl start tmp-hoge.mount
@ -196,7 +196,7 @@ test -d /var/lib/hoge
test -d /var/cache/hoge test -d /var/cache/hoge
test -d /var/log/hoge test -d /var/log/hoge
! systemctl clean tmp-hoge.mount systemctl clean tmp-hoge.mount && { echo 'unexpected success'; exit 1; }
test -d /etc/hoge test -d /etc/hoge
test -d /run/hoge test -d /run/hoge
@ -207,44 +207,44 @@ test -d /var/log/hoge
systemctl stop tmp-hoge.mount systemctl stop tmp-hoge.mount
test -d /etc/hoge test -d /etc/hoge
! test -d /run/hoge test ! -d /run/hoge
test -d /var/lib/hoge test -d /var/lib/hoge
test -d /var/cache/hoge test -d /var/cache/hoge
test -d /var/log/hoge test -d /var/log/hoge
systemctl clean tmp-hoge.mount --what=configuration systemctl clean tmp-hoge.mount --what=configuration
! test -d /etc/hoge test ! -d /etc/hoge
! test -d /run/hoge test ! -d /run/hoge
test -d /var/lib/hoge test -d /var/lib/hoge
test -d /var/cache/hoge test -d /var/cache/hoge
test -d /var/log/hoge test -d /var/log/hoge
systemctl clean tmp-hoge.mount systemctl clean tmp-hoge.mount
! test -d /etc/hoge test ! -d /etc/hoge
! test -d /run/hoge test ! -d /run/hoge
test -d /var/lib/hoge test -d /var/lib/hoge
! test -d /var/cache/hoge test ! -d /var/cache/hoge
test -d /var/log/hoge test -d /var/log/hoge
systemctl clean tmp-hoge.mount --what=logs systemctl clean tmp-hoge.mount --what=logs
! test -d /etc/hoge test ! -d /etc/hoge
! test -d /run/hoge test ! -d /run/hoge
test -d /var/lib/hoge test -d /var/lib/hoge
! test -d /var/cache/hoge test ! -d /var/cache/hoge
! test -d /var/log/hoge test ! -d /var/log/hoge
systemctl clean tmp-hoge.mount --what=all systemctl clean tmp-hoge.mount --what=all
! test -d /etc/hoge test ! -d /etc/hoge
! test -d /run/hoge test ! -d /run/hoge
! test -d /var/lib/hoge test ! -d /var/lib/hoge
! test -d /var/cache/hoge test ! -d /var/cache/hoge
! test -d /var/log/hoge test ! -d /var/log/hoge
cat > /etc/systemd/system/testservice.socket <<EOF cat >/etc/systemd/system/testservice.socket <<EOF
[Socket] [Socket]
ListenSequentialPacket=/run/testservice.socket ListenSequentialPacket=/run/testservice.socket
RemoveOnStop=yes RemoveOnStop=yes
@ -258,62 +258,62 @@ EOF
systemctl daemon-reload systemctl daemon-reload
! test -e /etc/testsocket test ! -e /etc/testsocket
! test -e /run/testsocket test ! -e /run/testsocket
! test -e /var/lib/testsocket test ! -e /var/lib/testsocket
! test -e /var/cache/testsocket test ! -e /var/cache/testsocket
! test -e /var/log/testsocket test ! -e /var/log/testsocket
systemctl start testservice.socket systemctl start testservice.socket
test -d /etc/testsocket test -d /etc/testsocket
! test -d /run/testsocket test -d /run/testsocket
test -d /var/lib/testsocket test -d /var/lib/testsocket
test -d /var/cache/testsocket test -d /var/cache/testsocket
test -d /var/log/testsocket test -d /var/log/testsocket
! systemctl clean testservice.socket systemctl clean testservice.socket && { echo 'unexpected success'; exit 1; }
systemctl stop testservice.socket systemctl stop testservice.socket
test -d /etc/testsocket test -d /etc/testsocket
! test -d /run/testsocket test ! -d /run/testsocket
test -d /var/lib/testsocket test -d /var/lib/testsocket
test -d /var/cache/testsocket test -d /var/cache/testsocket
test -d /var/log/testsocket test -d /var/log/testsocket
systemctl clean testservice.socket --what=configuration systemctl clean testservice.socket --what=configuration
! test -e /etc/testsocket test ! -e /etc/testsocket
! test -d /run/testsocket test ! -d /run/testsocket
test -d /var/lib/testsocket test -d /var/lib/testsocket
test -d /var/cache/testsocket test -d /var/cache/testsocket
test -d /var/log/testsocket test -d /var/log/testsocket
systemctl clean testservice.socket systemctl clean testservice.socket
! test -e /etc/testsocket test ! -e /etc/testsocket
! test -e /run/testsocket test ! -e /run/testsocket
test -d /var/lib/testsocket test -d /var/lib/testsocket
! test -e /var/cache/testsocket test ! -e /var/cache/testsocket
test -d /var/log/testsocket test -d /var/log/testsocket
systemctl clean testservice.socket --what=logs systemctl clean testservice.socket --what=logs
! test -e /etc/testsocket test ! -e /etc/testsocket
! test -e /run/testsocket test ! -e /run/testsocket
test -d /var/lib/testsocket test -d /var/lib/testsocket
! test -e /var/cache/testsocket test ! -e /var/cache/testsocket
! test -e /var/log/testsocket test ! -e /var/log/testsocket
systemctl clean testservice.socket --what=all systemctl clean testservice.socket --what=all
! test -e /etc/testsocket test ! -e /etc/testsocket
! test -e /run/testsocket test ! -e /run/testsocket
! test -e /var/lib/testsocket test ! -e /var/lib/testsocket
! test -e /var/cache/testsocket test ! -e /var/cache/testsocket
! test -e /var/log/testsocket test ! -e /var/log/testsocket
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -9,38 +9,41 @@ systemd-analyze log-target console
systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz touch /var/lib/zzz/test systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz touch /var/lib/zzz/test
systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test
! systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing \
&& { echo 'unexpected success'; exit 1; }
test -d /var/lib/zzz test -d /var/lib/zzz
! test -L /var/lib/zzz test ! -L /var/lib/zzz
! test -e /var/lib/private/zzz test ! -e /var/lib/private/zzz
test -f /var/lib/zzz/test test -f /var/lib/zzz/test
! test -f /var/lib/zzz/test-missing test ! -f /var/lib/zzz/test-missing
# Convert to DynamicUser=1 # Convert to DynamicUser=1
systemd-run --wait -p DynamicUser=1 -p StateDirectory=zzz test -f /var/lib/zzz/test systemd-run --wait -p DynamicUser=1 -p StateDirectory=zzz test -f /var/lib/zzz/test
! systemd-run --wait -p DynamicUser=1 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing systemd-run --wait -p DynamicUser=1 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing \
&& { echo 'unexpected success'; exit 1; }
test -L /var/lib/zzz test -L /var/lib/zzz
test -d /var/lib/private/zzz test -d /var/lib/private/zzz
test -f /var/lib/zzz/test test -f /var/lib/zzz/test
! test -f /var/lib/zzz/test-missing test ! -f /var/lib/zzz/test-missing
# Convert back # Convert back
systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test
! systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing \
&& { echo 'unexpected success'; exit 1; }
test -d /var/lib/zzz test -d /var/lib/zzz
! test -L /var/lib/zzz test ! -L /var/lib/zzz
! test -e /var/lib/private/zzz test ! -e /var/lib/private/zzz
test -f /var/lib/zzz/test test -f /var/lib/zzz/test
! test -f /var/lib/zzz/test-missing test ! -f /var/lib/zzz/test-missing
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -55,7 +55,7 @@ stopJournalctl() {
# the --sync wait until the synchronization is complete # the --sync wait until the synchronization is complete
echo "Force journald to write all queued messages" echo "Force journald to write all queued messages"
journalctl --sync journalctl --sync
journalctl -u $unit --cursor-file="$journalCursorFile" > "$journalLog" journalctl -u $unit --cursor-file="$journalCursorFile" >"$journalLog"
} }
checkNUMA() { checkNUMA() {
@ -64,21 +64,21 @@ checkNUMA() {
} }
writePID1NUMAPolicy() { writePID1NUMAPolicy() {
echo [Manager] > $confDir/numa.conf echo [Manager] >$confDir/numa.conf
echo NUMAPolicy=$1 >> $confDir/numa.conf echo NUMAPolicy=$1 >>$confDir/numa.conf
echo NUMAMask=$2>> $confDir/numa.conf echo NUMAMask=$2 >>$confDir/numa.conf
} }
writeTestUnit() { writeTestUnit() {
mkdir -p $testUnitFile.d/ mkdir -p $testUnitFile.d/
echo [Service] > $testUnitFile echo [Service] >$testUnitFile
echo ExecStart=/bin/sleep 3600 >> $testUnitFile echo ExecStart=/bin/sleep 3600 >>$testUnitFile
} }
writeTestUnitNUMAPolicy() { writeTestUnitNUMAPolicy() {
echo [Service] > $testUnitNUMAConf echo [Service] >$testUnitNUMAConf
echo NUMAPolicy=$1 >> $testUnitNUMAConf echo NUMAPolicy=$1 >>$testUnitNUMAConf
echo NUMAMask=$2>> $testUnitNUMAConf echo NUMAMask=$2 >>$testUnitNUMAConf
systemctl daemon-reload systemctl daemon-reload
} }
@ -115,13 +115,13 @@ pid1StopUnit() {
systemctlCheckNUMAProperties() { systemctlCheckNUMAProperties() {
local LOGFILE="$(mktemp)" local LOGFILE="$(mktemp)"
systemctl show -p NUMAPolicy $1 > "$LOGFILE" systemctl show -p NUMAPolicy $1 >"$LOGFILE"
grep "NUMAPolicy=$2" "$LOGFILE" grep "NUMAPolicy=$2" "$LOGFILE"
> "$LOGFILE" >"$LOGFILE"
if [ -n "$3" ]; then if [ -n "$3" ]; then
systemctl show -p NUMAMask $1 > "$LOGFILE" systemctl show -p NUMAMask $1 >"$LOGFILE"
grep "NUMAMask=$3" "$LOGFILE" grep "NUMAMask=$3" "$LOGFILE"
fi fi
} }
@ -281,7 +281,7 @@ else
echo "Unit file CPUAffinity=NUMA support" echo "Unit file CPUAffinity=NUMA support"
writeTestUnitNUMAPolicy "bind" "0" writeTestUnitNUMAPolicy "bind" "0"
echo "CPUAffinity=numa" >> $testUnitNUMAConf echo "CPUAffinity=numa" >>$testUnitNUMAConf
systemctl daemon-reload systemctl daemon-reload
systemctl start $testUnit systemctl start $testUnit
systemctlCheckNUMAProperties $testUnit "bind" "0" systemctlCheckNUMAProperties $testUnit "bind" "0"
@ -336,6 +336,6 @@ systemctl daemon-reload
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -12,8 +12,8 @@ touch /tmp/aaa/bbb
systemctl restart tmp-aaa.mount systemctl restart tmp-aaa.mount
test -e /run/hoge/foo test -e /run/hoge/foo
! test -e /tmp/aaa/bbb test ! -e /tmp/aaa/bbb
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -245,7 +245,7 @@ test_preserve_state() {
echo "Test that freezer state is preserved when recursive freezing is initiated from outside (e.g. by manager up the tree):" echo "Test that freezer state is preserved when recursive freezing is initiated from outside (e.g. by manager up the tree):"
echo -n " - freeze from outside: " echo -n " - freeze from outside: "
echo 1 > /sys/fs/cgroup/"${slice}"/cgroup.freeze echo 1 >/sys/fs/cgroup/"${slice}"/cgroup.freeze
# Give kernel some time to freeze the slice # Give kernel some time to freeze the slice
sleep 1 sleep 1
@ -259,7 +259,7 @@ test_preserve_state() {
echo "[ OK ]" echo "[ OK ]"
echo -n " - thaw from outside: " echo -n " - thaw from outside: "
echo 0 > /sys/fs/cgroup/"${slice}"/cgroup.freeze echo 0 >/sys/fs/cgroup/"${slice}"/cgroup.freeze
sleep 1 sleep 1
check_freezer_state "${unit}" "running" check_freezer_state "${unit}" "running"
@ -271,8 +271,8 @@ test_preserve_state() {
echo -n " - thaw from outside while inner service is frozen: " echo -n " - thaw from outside while inner service is frozen: "
systemctl freeze "$unit" systemctl freeze "$unit"
check_freezer_state "${unit}" "frozen" check_freezer_state "${unit}" "frozen"
echo 1 > /sys/fs/cgroup/"${slice}"/cgroup.freeze echo 1 >/sys/fs/cgroup/"${slice}"/cgroup.freeze
echo 0 > /sys/fs/cgroup/"${slice}"/cgroup.freeze echo 0 >/sys/fs/cgroup/"${slice}"/cgroup.freeze
check_freezer_state "${slice}" "running" check_freezer_state "${slice}" "running"
check_freezer_state "${unit}" "frozen" check_freezer_state "${unit}" "frozen"
echo "[ OK ]" echo "[ OK ]"
@ -293,5 +293,5 @@ test -e /sys/fs/cgroup/system.slice/cgroup.freeze && {
test_preserve_state test_preserve_state
} }
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -11,7 +11,7 @@ SERVICE_PATH="$(mktemp /etc/systemd/system/execreloadXXX.service)"
SERVICE_NAME="${SERVICE_PATH##*/}" SERVICE_NAME="${SERVICE_PATH##*/}"
echo "[#1] Failing ExecReload= should not kill the service" echo "[#1] Failing ExecReload= should not kill the service"
cat > "$SERVICE_PATH" << EOF cat >"$SERVICE_PATH" <<EOF
[Service] [Service]
ExecStart=/bin/sleep infinity ExecStart=/bin/sleep infinity
ExecReload=/bin/false ExecReload=/bin/false
@ -21,13 +21,13 @@ systemctl daemon-reload
systemctl start $SERVICE_NAME systemctl start $SERVICE_NAME
systemctl status $SERVICE_NAME systemctl status $SERVICE_NAME
# The reload SHOULD fail but SHOULD NOT affect the service state # The reload SHOULD fail but SHOULD NOT affect the service state
! systemctl reload $SERVICE_NAME systemctl reload $SERVICE_NAME && { echo 'unexpected success'; exit 1; }
systemctl status $SERVICE_NAME systemctl status $SERVICE_NAME
systemctl stop $SERVICE_NAME systemctl stop $SERVICE_NAME
echo "[#2] Failing ExecReload= should not kill the service (multiple ExecReload=)" echo "[#2] Failing ExecReload= should not kill the service (multiple ExecReload=)"
cat > "$SERVICE_PATH" << EOF cat >"$SERVICE_PATH" <<EOF
[Service] [Service]
ExecStart=/bin/sleep infinity ExecStart=/bin/sleep infinity
ExecReload=/bin/true ExecReload=/bin/true
@ -39,12 +39,12 @@ systemctl daemon-reload
systemctl start $SERVICE_NAME systemctl start $SERVICE_NAME
systemctl status $SERVICE_NAME systemctl status $SERVICE_NAME
# The reload SHOULD fail but SHOULD NOT affect the service state # The reload SHOULD fail but SHOULD NOT affect the service state
! systemctl reload $SERVICE_NAME systemctl reload $SERVICE_NAME && { echo 'unexpected success'; exit 1; }
systemctl status $SERVICE_NAME systemctl status $SERVICE_NAME
systemctl stop $SERVICE_NAME systemctl stop $SERVICE_NAME
echo "[#3] Failing ExecReload=- should not affect reload's exit code" echo "[#3] Failing ExecReload=- should not affect reload's exit code"
cat > "$SERVICE_PATH" << EOF cat >"$SERVICE_PATH" <<EOF
[Service] [Service]
ExecStart=/bin/sleep infinity ExecStart=/bin/sleep infinity
ExecReload=-/bin/false ExecReload=-/bin/false
@ -59,6 +59,6 @@ systemctl stop $SERVICE_NAME
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -41,6 +41,6 @@ done
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -9,7 +9,8 @@ systemd-analyze log-level debug
systemd-analyze log-target console systemd-analyze log-target console
# test one: Restart=on-failure should restart the service # test one: Restart=on-failure should restart the service
! systemd-run --unit=one -p Type=oneshot -p Restart=on-failure /bin/bash -c "exit 1" systemd-run --unit=one -p Type=oneshot -p Restart=on-failure /bin/bash -c "exit 1" \
&& { echo 'unexpected success'; exit 1; }
for ((secs=0; secs<$MAX_SECS; secs++)); do for ((secs=0; secs<$MAX_SECS; secs++)); do
[[ "$(systemctl show one.service -P NRestarts)" -le 0 ]] || break [[ "$(systemctl show one.service -P NRestarts)" -le 0 ]] || break
@ -25,7 +26,13 @@ TMP_FILE="/tmp/test-41-oneshot-restart-test"
# test two: make sure StartLimitBurst correctly limits the number of restarts # test two: make sure StartLimitBurst correctly limits the number of restarts
# and restarts execution of the unit from the first ExecStart= # and restarts execution of the unit from the first ExecStart=
! systemd-run --unit=two -p StartLimitIntervalSec=120 -p StartLimitBurst=3 -p Type=oneshot -p Restart=on-failure -p ExecStart="/bin/bash -c \"printf a >> $TMP_FILE\"" /bin/bash -c "exit 1" systemd-run --unit=two \
-p StartLimitIntervalSec=120 \
-p StartLimitBurst=3 \
-p Type=oneshot \
-p Restart=on-failure \
-p ExecStart="/bin/bash -c \"printf a >> $TMP_FILE\"" /bin/bash -c "exit 1" \
&& { echo 'unexpected success'; exit 1; }
# wait for at least 3 restarts # wait for at least 3 restarts
for ((secs=0; secs<$MAX_SECS; secs++)); do for ((secs=0; secs<$MAX_SECS; secs++)); do
@ -44,6 +51,6 @@ fi
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -6,16 +6,18 @@ systemd-analyze log-level debug
systemd-run --unit=simple1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple -p ExecStopPost='/bin/touch /run/simple1' true systemd-run --unit=simple1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple -p ExecStopPost='/bin/touch /run/simple1' true
test -f /run/simple1 test -f /run/simple1
! systemd-run --unit=simple2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple -p ExecStopPost='/bin/touch /run/simple2' false systemd-run --unit=simple2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple -p ExecStopPost='/bin/touch /run/simple2' false \
&& { echo 'unexpected success'; exit 1; }
test -f /run/simple2 test -f /run/simple2
systemd-run --unit=exec1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec -p ExecStopPost='/bin/touch /run/exec1' sleep 1 systemd-run --unit=exec1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec -p ExecStopPost='/bin/touch /run/exec1' sleep 1
test -f /run/exec1 test -f /run/exec1
! systemd-run --unit=exec2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec -p ExecStopPost='/bin/touch /run/exec2' sh -c 'sleep 1; false' systemd-run --unit=exec2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec -p ExecStopPost='/bin/touch /run/exec2' sh -c 'sleep 1; false' \
&& { echo 'unexpected success'; exit 1; }
test -f /run/exec2 test -f /run/exec2
cat > /tmp/forking1.sh <<EOF cat >/tmp/forking1.sh <<EOF
#!/usr/bin/env bash #!/usr/bin/env bash
set -eux set -eux
@ -31,7 +33,7 @@ chmod +x /tmp/forking1.sh
systemd-run --unit=forking1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=forking -p NotifyAccess=exec -p ExecStopPost='/bin/touch /run/forking1' /tmp/forking1.sh systemd-run --unit=forking1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=forking -p NotifyAccess=exec -p ExecStopPost='/bin/touch /run/forking1' /tmp/forking1.sh
test -f /run/forking1 test -f /run/forking1
cat > /tmp/forking2.sh <<EOF cat >/tmp/forking2.sh <<EOF
#!/usr/bin/env bash #!/usr/bin/env bash
set -eux set -eux
@ -44,13 +46,15 @@ systemd-notify MAINPID=\$MAINPID
EOF EOF
chmod +x /tmp/forking2.sh chmod +x /tmp/forking2.sh
! systemd-run --unit=forking2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=forking -p NotifyAccess=exec -p ExecStopPost='/bin/touch /run/forking2' /tmp/forking2.sh systemd-run --unit=forking2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=forking -p NotifyAccess=exec -p ExecStopPost='/bin/touch /run/forking2' /tmp/forking2.sh \
&& { echo 'unexpected success'; exit 1; }
test -f /run/forking2 test -f /run/forking2
systemd-run --unit=oneshot1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=oneshot -p ExecStopPost='/bin/touch /run/oneshot1' true systemd-run --unit=oneshot1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=oneshot -p ExecStopPost='/bin/touch /run/oneshot1' true
test -f /run/oneshot1 test -f /run/oneshot1
! systemd-run --unit=oneshot2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=oneshot -p ExecStopPost='/bin/touch /run/oneshot2' false systemd-run --unit=oneshot2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=oneshot -p ExecStopPost='/bin/touch /run/oneshot2' false \
&& { echo 'unexpected success'; exit 1; }
test -f /run/oneshot2 test -f /run/oneshot2
systemd-run --unit=dbus1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost -p ExecStopPost='/bin/touch /run/dbus1' \ systemd-run --unit=dbus1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost -p ExecStopPost='/bin/touch /run/dbus1' \
@ -58,10 +62,10 @@ systemd-run --unit=dbus1.service --wait -p StandardOutput=tty -p StandardError=t
|| : || :
test -f /run/dbus1 test -f /run/dbus1
! systemd-run --unit=dbus2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost -p ExecStopPost='/bin/touch /run/dbus2' true systemd-run --unit=dbus2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost -p ExecStopPost='/bin/touch /run/dbus2' true
test -f /run/dbus2 test -f /run/dbus2
cat > /tmp/notify1.sh <<EOF cat >/tmp/notify1.sh <<EOF
#!/usr/bin/env bash #!/usr/bin/env bash
set -eux set -eux
@ -73,17 +77,19 @@ chmod +x /tmp/notify1.sh
systemd-run --unit=notify1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=notify -p ExecStopPost='/bin/touch /run/notify1' /tmp/notify1.sh systemd-run --unit=notify1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=notify -p ExecStopPost='/bin/touch /run/notify1' /tmp/notify1.sh
test -f /run/notify1 test -f /run/notify1
! systemd-run --unit=notify2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=notify -p ExecStopPost='/bin/touch /run/notify2' true systemd-run --unit=notify2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=notify -p ExecStopPost='/bin/touch /run/notify2' true \
&& { echo 'unexpected success'; exit 1; }
test -f /run/notify2 test -f /run/notify2
systemd-run --unit=idle1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle -p ExecStopPost='/bin/touch /run/idle1' true systemd-run --unit=idle1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle -p ExecStopPost='/bin/touch /run/idle1' true
test -f /run/idle1 test -f /run/idle1
! systemd-run --unit=idle2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle -p ExecStopPost='/bin/touch /run/idle2' false systemd-run --unit=idle2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle -p ExecStopPost='/bin/touch /run/idle2' false \
&& { echo 'unexpected success'; exit 1; }
test -f /run/idle2 test -f /run/idle2
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -34,9 +34,10 @@ test -e /home/testuser/works.txt
runas testuser systemd-run --wait --user --unit=test-protect-home-read-only \ runas testuser systemd-run --wait --user --unit=test-protect-home-read-only \
-p PrivateUsers=yes -p ProtectHome=read-only \ -p PrivateUsers=yes -p ProtectHome=read-only \
-P bash -c ' -P bash -c '
test -e /home/testuser/works.txt test -e /home/testuser/works.txt || exit 10
! touch /home/testuser/blocked.txt touch /home/testuser/blocked.txt && exit 11
' ' \
&& { echo 'unexpected success'; exit 1; }
test ! -e /home/testuser/blocked.txt test ! -e /home/testuser/blocked.txt
# Check that tmpfs hides the whole directory # Check that tmpfs hides the whole directory
@ -57,12 +58,13 @@ runas testuser systemd-run --wait --user --unit=test-protect-home-yes \
# namespace (no CAP_SETGID in the parent namespace to write the additional # namespace (no CAP_SETGID in the parent namespace to write the additional
# mapping of the user supplied group and thus cannot change groups to an # mapping of the user supplied group and thus cannot change groups to an
# unmapped group ID) # unmapped group ID)
! runas testuser systemd-run --wait --user --unit=test-group-fail \ runas testuser systemd-run --wait --user --unit=test-group-fail \
-p PrivateUsers=yes -p Group=daemon \ -p PrivateUsers=yes -p Group=daemon \
-P true -P true \
&& { echo 'unexpected success'; exit 1; }
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -6,14 +6,14 @@ systemd-analyze log-level debug
systemd-run -p LogNamespace=foobar echo "hello world" systemd-run -p LogNamespace=foobar echo "hello world"
journalctl --namespace=foobar --sync journalctl --namespace=foobar --sync
journalctl --namespace=foobar > /tmp/hello-world journalctl -o cat --namespace=foobar >/tmp/hello-world
journalctl > /tmp/no-hello-world journalctl -o cat >/tmp/no-hello-world
grep "hello world" /tmp/hello-world grep "^hello world$" /tmp/hello-world
! grep "hello world" /tmp/no-hello-world grep "^hello world$" /tmp/no-hello-world && { echo 'unexpected success'; exit 1; }
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -4,22 +4,21 @@ set -o pipefail
# Check if homectl is installed, and if it isn't bail out early instead of failing # Check if homectl is installed, and if it isn't bail out early instead of failing
if ! test -x /usr/bin/homectl ; then if ! test -x /usr/bin/homectl ; then
echo OK > /testok echo OK >/testok
exit 0 exit 0
fi fi
inspect() { inspect() {
# As updating disk-size-related attributes can take some time on # As updating disk-size-related attributes can take some time on some
# some filesystems, let's drop these fields before comparing the # filesystems, let's drop these fields before comparing the outputs to
# outputs to avoid unexpected fails. To see the full outputs of both # avoid unexpected fails. To see the full outputs of both homectl &
# homectl & userdbctl (for debugging purposes) drop the fields just # userdbctl (for debugging purposes) drop the fields just before the
# before the comparison. # comparison.
homectl inspect $1 | tee /tmp/a homectl inspect $1 | tee /tmp/a
userdbctl user $1 | tee /tmp/b userdbctl user $1 | tee /tmp/b
local PATTERN='/^\s*Disk (Size|Free|Floor|Ceiling):/d' diff -I '/^\s*Disk (Size|Free|Floor|Ceiling):/' /tmp/{a,b}
diff <(sed -r "$PATTERN" /tmp/a) <(sed -r "$PATTERN" /tmp/b) rm /tmp/{a,b}
rm /tmp/a /tmp/b
} }
systemd-analyze log-level debug systemd-analyze log-level debug
@ -66,16 +65,20 @@ inspect test-user
PASSWORD=xEhErW0ndafV4s homectl deactivate test-user PASSWORD=xEhErW0ndafV4s homectl deactivate test-user
inspect test-user inspect test-user
! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
&& { echo 'unexpected success'; exit 1; }
PASSWORD=xEhErW0ndafV4s homectl with test-user -- touch /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- touch /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- rm /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- rm /home/test-user/xyz
! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
&& { echo 'unexpected success'; exit 1; }
homectl remove test-user homectl remove test-user
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
sleep infinity & sleep infinity &
echo $! > /leakedtestpid echo $! >/leakedtestpid
wait $! wait $!

View File

@ -20,6 +20,6 @@ ps -p "$leaked_pid" && exit 42
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -3,7 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
set -ex set -ex
cat > /run/systemd/system/testservice-48.target <<EOF cat >/run/systemd/system/testservice-48.target <<EOF
[Unit] [Unit]
Wants=testservice-48.service Wants=testservice-48.service
EOF EOF
@ -23,7 +23,7 @@ systemctl start testservice-48.target
# May 07 23:12:20 systemd-testsuite testsuite-48.sh[53]: ef53 # May 07 23:12:20 systemd-testsuite testsuite-48.sh[53]: ef53
sleep 3.1 sleep 3.1
cat > /run/systemd/system/testservice-48.service <<EOF cat >/run/systemd/system/testservice-48.service <<EOF
[Service] [Service]
ExecStart=/bin/sleep infinity ExecStart=/bin/sleep infinity
EOF EOF
@ -39,7 +39,7 @@ systemctl daemon-reload
sleep 3.1 sleep 3.1
cat > /run/systemd/system/testservice-48.service <<EOF cat >/run/systemd/system/testservice-48.service <<EOF
[Service] [Service]
ExecStart=/bin/sleep infinity ExecStart=/bin/sleep infinity
EOF EOF
@ -61,7 +61,7 @@ systemctl daemon-reload
sleep 3.1 sleep 3.1
cat > /run/systemd/system/testservice-48.target <<EOF cat >/run/systemd/system/testservice-48.target <<EOF
[Unit] [Unit]
Conflicts=shutdown.target Conflicts=shutdown.target
Wants=testservice-48.service Wants=testservice-48.service
@ -71,7 +71,7 @@ systemctl daemon-reload
systemctl start testservice-48.target systemctl start testservice-48.target
cat > /run/systemd/system/testservice-48.service <<EOF cat >/run/systemd/system/testservice-48.service <<EOF
[Service] [Service]
ExecStart=/bin/sleep infinity ExecStart=/bin/sleep infinity
EOF EOF
@ -80,6 +80,6 @@ systemctl restart testservice-48.target
systemctl is-active testservice-48.service systemctl is-active testservice-48.service
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -ex set -ex
echo "MARKER_FIXED" > /run/testservice-49-fixed echo "MARKER_FIXED" >/run/testservice-49-fixed
mkdir -p /run/inaccessible mkdir -p /run/inaccessible
systemctl start testsuite-49-namespaced.service systemctl start testsuite-49-namespaced.service
@ -11,7 +11,7 @@ set +e
systemctl bind --mkdir testsuite-49-namespaced.service /run/testservice-49-fixed /run/inaccessible/testfile_fixed && exit 1 systemctl bind --mkdir testsuite-49-namespaced.service /run/testservice-49-fixed /run/inaccessible/testfile_fixed && exit 1
set -e set -e
echo "MARKER_RUNTIME" > /run/testservice-49-runtime echo "MARKER_RUNTIME" >/run/testservice-49-runtime
systemctl bind --mkdir testsuite-49-namespaced.service /run/testservice-49-runtime /tmp/testfile_runtime systemctl bind --mkdir testsuite-49-namespaced.service /run/testservice-49-runtime /tmp/testfile_runtime
@ -38,6 +38,6 @@ set +e
systemctl is-active testsuite-49-non-namespaced.service && exit 1 systemctl is-active testsuite-49-non-namespaced.service && exit 1
set -e set -e
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -207,7 +207,7 @@ grep -F "squashfs" ${image_dir}/result/c | grep -q -F -v "nosuid"
# Adding a new mounts at runtime works if the unit is in the active state, # Adding a new mounts at runtime works if the unit is in the active state,
# so use Type=notify to make sure there's no race condition in the test # so use Type=notify to make sure there's no race condition in the test
cat > /run/systemd/system/testservice-50d.service <<EOF cat >/run/systemd/system/testservice-50d.service <<EOF
[Service] [Service]
RuntimeMaxSec=300 RuntimeMaxSec=300
Type=notify Type=notify

View File

@ -10,22 +10,24 @@ systemd-run -p LoadCredential=passwd:/etc/passwd \
-p DynamicUser=1 \ -p DynamicUser=1 \
--wait \ --wait \
--pipe \ --pipe \
cat '${CREDENTIALS_DIRECTORY}/passwd' '${CREDENTIALS_DIRECTORY}/shadow' '${CREDENTIALS_DIRECTORY}/dog' > /tmp/ts54-concat cat '${CREDENTIALS_DIRECTORY}/passwd' '${CREDENTIALS_DIRECTORY}/shadow' '${CREDENTIALS_DIRECTORY}/dog' >/tmp/ts54-concat
( cat /etc/passwd /etc/shadow && echo -n wuff ) | cmp /tmp/ts54-concat ( cat /etc/passwd /etc/shadow && echo -n wuff ) | cmp /tmp/ts54-concat
rm /tmp/ts54-concat rm /tmp/ts54-concat
# Verify that the creds are immutable # Verify that the creds are immutable
! systemd-run -p LoadCredential=passwd:/etc/passwd \ systemd-run -p LoadCredential=passwd:/etc/passwd \
-p DynamicUser=1 \ -p DynamicUser=1 \
--wait \ --wait \
touch '${CREDENTIALS_DIRECTORY}/passwd' touch '${CREDENTIALS_DIRECTORY}/passwd' \
! systemd-run -p LoadCredential=passwd:/etc/passwd \ && { echo 'unexpected success'; exit 1; }
systemd-run -p LoadCredential=passwd:/etc/passwd \
-p DynamicUser=1 \ -p DynamicUser=1 \
--wait \ --wait \
rm '${CREDENTIALS_DIRECTORY}/passwd' rm '${CREDENTIALS_DIRECTORY}/passwd' \
&& { echo 'unexpected success'; exit 1; }
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -6,19 +6,19 @@ systemd-analyze log-level debug
systemd-analyze log-target console systemd-analyze log-target console
# Loose checks to ensure the environment has the necessary features for systemd-oomd # Loose checks to ensure the environment has the necessary features for systemd-oomd
[[ -e /proc/pressure ]] || echo "no PSI" >> /skipped [[ -e /proc/pressure ]] || echo "no PSI" >>/skipped
cgroup_type=$(stat -fc %T /sys/fs/cgroup/) cgroup_type=$(stat -fc %T /sys/fs/cgroup/)
if [[ "$cgroup_type" != *"cgroup2"* ]] && [[ "$cgroup_type" != *"0x63677270"* ]]; then if [[ "$cgroup_type" != *"cgroup2"* ]] && [[ "$cgroup_type" != *"0x63677270"* ]]; then
echo "no cgroup2" >> /skipped echo "no cgroup2" >>/skipped
fi fi
if [ ! -f /usr/lib/systemd/systemd-oomd ] && [ ! -f /lib/systemd/systemd-oomd ]; then if [ ! -f /usr/lib/systemd/systemd-oomd ] && [ ! -f /lib/systemd/systemd-oomd ]; then
echo "no oomd" >> /skipped echo "no oomd" >>/skipped
fi fi
[[ -e /skipped ]] && exit 0 || true [[ -e /skipped ]] && exit 0 || true
rm -rf /etc/systemd/system/testsuite-55-testbloat.service.d rm -rf /etc/systemd/system/testsuite-55-testbloat.service.d
echo "DefaultMemoryPressureDurationSec=5s" >> /etc/systemd/oomd.conf echo "DefaultMemoryPressureDurationSec=5s" >>/etc/systemd/oomd.conf
systemctl start testsuite-55-testchill.service systemctl start testsuite-55-testchill.service
systemctl start testsuite-55-testbloat.service systemctl start testsuite-55-testbloat.service
@ -47,8 +47,8 @@ if setfattr -n user.xattr_test -v 1 /sys/fs/cgroup/; then
sleep 120 # wait for systemd-oomd kill cool down and elevated memory pressure to come down sleep 120 # wait for systemd-oomd kill cool down and elevated memory pressure to come down
mkdir -p /etc/systemd/system/testsuite-55-testbloat.service.d/ mkdir -p /etc/systemd/system/testsuite-55-testbloat.service.d/
echo "[Service]" > /etc/systemd/system/testsuite-55-testbloat.service.d/override.conf echo "[Service]" >/etc/systemd/system/testsuite-55-testbloat.service.d/override.conf
echo "ManagedOOMPreference=avoid" >> /etc/systemd/system/testsuite-55-testbloat.service.d/override.conf echo "ManagedOOMPreference=avoid" >>/etc/systemd/system/testsuite-55-testbloat.service.d/override.conf
systemctl daemon-reload systemctl daemon-reload
systemctl start testsuite-55-testchill.service systemctl start testsuite-55-testchill.service
@ -71,6 +71,6 @@ fi
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -29,11 +29,13 @@ systemd-run --wait --unit=one -p ExitType=cgroup /tmp/test56-exit-cgroup.sh
systemd-run --wait --unit=two -p ExitType=cgroup -p ExecCondition=true /tmp/test56-exit-cgroup.sh systemd-run --wait --unit=two -p ExitType=cgroup -p ExecCondition=true /tmp/test56-exit-cgroup.sh
# false exec condition: systemd-run should exit immediately with status code: 1 # false exec condition: systemd-run should exit immediately with status code: 1
! systemd-run --wait --unit=three -p ExitType=cgroup -p ExecCondition=false /tmp/test56-exit-cgroup.sh systemd-run --wait --unit=three -p ExitType=cgroup -p ExecCondition=false /tmp/test56-exit-cgroup.sh \
&& { echo 'unexpected success'; exit 1; }
# service should exit uncleanly # service should exit uncleanly
(sleep 1; systemctl kill --signal 9 four) & (sleep 1; systemctl kill --signal 9 four) &
! systemd-run --wait --unit=four -p ExitType=cgroup /tmp/test56-exit-cgroup.sh systemd-run --wait --unit=four -p ExitType=cgroup /tmp/test56-exit-cgroup.sh \
&& { echo 'unexpected success'; exit 1; }
# Multiple level process tree, parent process exits quickly # Multiple level process tree, parent process exits quickly
@ -55,7 +57,8 @@ systemd-run --wait --unit=five -p ExitType=cgroup /tmp/test56-exit-cgroup-parent
# service should exit uncleanly # service should exit uncleanly
(sleep 1; systemctl kill --signal 9 six) & (sleep 1; systemctl kill --signal 9 six) &
! systemd-run --wait --unit=six -p ExitType=cgroup /tmp/test56-exit-cgroup-parentless.sh systemd-run --wait --unit=six -p ExitType=cgroup /tmp/test56-exit-cgroup-parentless.sh \
&& { echo 'unexpected success'; exit 1; }
# Multiple level process tree, parent process exits uncleanly but last process exits cleanly # Multiple level process tree, parent process exits uncleanly but last process exits cleanly
@ -85,10 +88,11 @@ EOF
chmod +x /tmp/test56-exit-cgroup-unclean.sh chmod +x /tmp/test56-exit-cgroup-unclean.sh
# service should exit uncleanly after 1 second # service should exit uncleanly after 1 second
! systemd-run --wait --unit=eight -p ExitType=cgroup /tmp/test56-exit-cgroup-unclean.sh systemd-run --wait --unit=eight -p ExitType=cgroup /tmp/test56-exit-cgroup-unclean.sh \
&& { echo 'unexpected success'; exit 1; }
systemd-analyze log-level info systemd-analyze log-level info
echo OK > /testok echo OK >/testok
exit 0 exit 0

View File

@ -9,5 +9,5 @@
[Unit] [Unit]
Description=Cryptsetup Units Slice Description=Cryptsetup Units Slice
Documentation=man:systemd.special(7) Documentation=man:systemd-cryptsetup@.service(8)
DefaultDependencies=no DefaultDependencies=no