1
0
mirror of https://github.com/systemd/systemd synced 2025-11-06 10:24:44 +01:00

Compare commits

..

No commits in common. "fea7f5d68b5a6272ce8989e872a57b42121b5205" and "666cd35be493e2d796c5424eed9a3deeddc9b0fe" have entirely different histories.

9 changed files with 22 additions and 99 deletions

View File

@ -83,7 +83,7 @@
<para>Capsule names may be chosen freely by the user, however, they must be suitable as UNIX filenames
(i.e. 255 characters max, and contain no <literal>/</literal>), and when prefixed with
<literal>c-</literal> be suitable as a user name matching strict POSIX rules, see <ulink
<literal>p-</literal> be suitable as a user name matching strict POSIX rules, see <ulink
url="https://systemd.io/USER_NAMES">User/Group Name Syntax</ulink> for details.</para>
<xi:include href="version-info.xml" xpointer="v256"/>

View File

@ -418,7 +418,7 @@ enum nss_status _nss_resolve_gethostbyname3_r(
if (r < 0)
goto fail;
if (q.family != af)
if (!IN_SET(q.family, AF_INET, AF_INET6))
continue;
if (q.address_size != FAMILY_ADDRESS_SIZE(q.family)) {

View File

@ -16,14 +16,6 @@
#include "strv.h"
#include "time-util.h"
bool bus_property_is_timestamp(const char *name) {
assert(name);
/* Trust me, this naming convention is ironclad. Except for these three. Okay four. Well... */
return endswith(name, "Timestamp") ||
STR_IN_SET(name, "NextElapseUSecRealtime", "LastTriggerUSec", "TimeUSec", "RTCTimeUSec");
}
int bus_print_property_value(const char *name, const char *expected_value, BusPrintPropertyFlags flags, const char *value) {
assert(name);
@ -112,7 +104,12 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
if (r < 0)
return r;
if (bus_property_is_timestamp(name))
/* Yes, heuristics! But we can change this check
* should it turn out to not be sufficient */
if (endswith(name, "Timestamp") ||
STR_IN_SET(name, "NextElapseUSecRealtime", "LastTriggerUSec", "TimeUSec", "RTCTimeUSec"))
bus_print_property_value(name, expected_value, flags, FORMAT_TIMESTAMP(u));
/* Managed OOM pressure default implies "unset" and use the default set in oomd.conf. Without

View File

@ -10,8 +10,6 @@ typedef enum BusPrintPropertyFlags {
typedef int (*bus_message_print_t) (const char *name, const char *expected_value, sd_bus_message *m, BusPrintPropertyFlags flags);
bool bus_property_is_timestamp(const char *name);
int bus_print_property_value(const char *name, const char *expected_value, BusPrintPropertyFlags flags, const char *value);
int bus_print_property_valuef(const char *name, const char *expected_value, BusPrintPropertyFlags flags, const char *fmt, ...) _printf_(4,5);
int bus_message_print_all_properties(sd_bus_message *m, bus_message_print_t func, char **filter, BusPrintPropertyFlags flags, Set **found_properties);

View File

@ -1215,7 +1215,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
break;
case SD_BUS_TYPE_UINT64:
if (bus_property_is_timestamp(name)) {
if (endswith(name, "Timestamp")) {
uint64_t timestamp;
r = sd_bus_message_read_basic(m, bus_type, &timestamp);

View File

@ -81,10 +81,10 @@ valgrind_cmd = ''
enable_debug = True
env = {}
wait_online_env = {}
asan_options = os.getenv('ASAN_OPTIONS')
lsan_options = os.getenv('LSAN_OPTIONS')
ubsan_options = os.getenv('UBSAN_OPTIONS')
with_coverage = os.getenv('COVERAGE_BUILD_DIR') != None
asan_options = None
lsan_options = None
ubsan_options = None
with_coverage = False
show_journal = True # When true, show journal on stopping networkd.
active_units = []
@ -487,19 +487,7 @@ def create_service_dropin(service, command, additional_settings=None):
if ubsan_options:
drop_in += [f'Environment=UBSAN_OPTIONS="{ubsan_options}"']
if asan_options or lsan_options or ubsan_options:
# Disable system call filter when running with sanitizers, as they seem to call filtered syscall at
# the very end of the execution and stuck the process. See issue #39567.
drop_in += [
'LockPersonality=no',
'ProtectClock=no',
'ProtectKernelLogs=no',
'RestrictAddressFamilies=',
'RestrictNamespaces=no',
'RestrictRealtime=no',
'RestrictSUIDSGID=no',
'SystemCallArchitectures=',
'SystemCallFilter=',
]
drop_in += ['SystemCallFilter=']
if use_valgrind or asan_options or lsan_options or ubsan_options:
drop_in += ['MemoryDenyWriteExecute=no']
if use_valgrind:

View File

@ -72,7 +72,7 @@ assert_eq "$(systemctl show "$UNIT_NAME.socket" -P SubState)" "listening"
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
wait_for_start
wait %%
kill %%
touch "/tmp/$UNIT_NAME/flag"
systemctl start "$UNIT_NAME-conflict2.service"
@ -80,7 +80,7 @@ wait_for_stop
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
wait_for_start
wait %%
kill %%
(! systemctl -q is-active "$UNIT_NAME-conflict2.service")
# DeferTrigger=yes
@ -99,7 +99,7 @@ assert_eq "$(systemctl show "$UNIT_NAME-conflict1.service" -P SubState)" "start"
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
timeout 30 bash -c "until [[ \$(systemctl show '$UNIT_NAME.socket' -P SubState) == 'deferred' ]]; do sleep .5; done"
(! systemctl -q is-active "$UNIT_NAME.service")
wait %%
kill %%
assert_eq "$(systemctl show "$UNIT_NAME-conflict1.service" -P SubState)" "start"
systemctl daemon-reload
@ -122,7 +122,7 @@ wait_for_stop
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
timeout 30 bash -c "until [[ \$(systemctl show '$UNIT_NAME.socket' -P SubState) == 'deferred' ]]; do sleep .5; done"
(! systemctl -q is-active "$UNIT_NAME.service")
wait %%
kill %%
rm "/tmp/$UNIT_NAME/flag"
timeout 30 bash -c "while systemctl -q is-active '$UNIT_NAME-conflict2.service'; do sleep .2; done"
@ -138,7 +138,7 @@ assert_eq "$(systemctl show "$UNIT_NAME-conflict1.service" -P SubState)" "start"
socat -u - UNIX-CONNECT:"/tmp/$UNIT_NAME/test" &
timeout 30 bash -c "until [[ \$(systemctl show '$UNIT_NAME.socket' -P SubState) == 'deferred' ]]; do sleep .5; done"
(! systemctl -q is-active "$UNIT_NAME.service")
wait %%
kill %%
echo "DeferTriggerMaxSec=20s" >>/run/systemd/system/"$UNIT_NAME.socket"
systemctl daemon-reload

View File

@ -48,7 +48,6 @@ trap 'touch /terminate; kill 0' RTMIN+3
trap 'touch /poweroff' RTMIN+4
trap 'touch /reboot' INT
trap 'touch /trap' TRAP
trap 'exit 0' TERM
trap 'kill $PID' EXIT
# We need to wait for the sleep process asynchronously in order to allow
@ -326,7 +325,6 @@ ip address add 192.0.2.1/24 dev hoge
PID=0
trap 'kill 0' RTMIN+3
trap 'exit 0' TERM
trap 'kill $PID' EXIT
# We need to wait for the sleep process asynchronously in order to allow
@ -441,14 +439,9 @@ varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.OpenR
# Terminating machine, otherwise acquiring image metadata by io.systemd.MachineImage.List may fail in the below.
machinectl terminate long-running
# Wait for the container to stop, otherwise acquiring image metadata by io.systemd.MachineImage.List below
# may fail.
#
# We need to wait until the systemd-nspawn process is completely stopped, as the lock is held for almost the
# entire life of the process (see the run() function in nspawn.c). This means that the machine gets
# unregistered _before_ this lock is lifted which makes `machinectl status` return non-zero EC earlier than
# we need.
timeout 30 bash -xec 'until [[ "$(systemctl show -P ActiveState systemd-nspawn@long-running.service)" == inactive ]]; do sleep .5; done'
# wait for the container being stopped, otherwise acquiring image metadata by io.systemd.MachineImage.List may fail in the below.
timeout 30 bash -c "while machinectl status long-running &>/dev/null; do sleep .5; done"
systemctl kill --signal=KILL systemd-nspawn@long-running.service || :
# test io.systemd.MachineImage.List
varlinkctl --more call /run/systemd/machine/io.systemd.MachineImage io.systemd.MachineImage.List '{}' | grep 'long-running'

View File

@ -287,59 +287,6 @@ for value in pretty us µs utc us+utc µs+utc; do
systemctl show -P KernelTimestamp --timestamp="$value"
done
# --timestamp with timer properties (issue #39282)
TIMER1="timestamp-test1-$RANDOM.timer"
SERVICE1="${TIMER1%.timer}.service"
cat >"/run/systemd/system/$SERVICE1" <<EOF
[Service]
Type=oneshot
ExecStart=true
EOF
cat >"/run/systemd/system/$TIMER1" <<EOF
[Timer]
OnCalendar=*-*-* 00:00:00
EOF
systemctl daemon-reload
systemctl start "$TIMER1"
output=$(systemctl show -P NextElapseUSecRealtime --timestamp=unix "$TIMER1")
if [[ ! "$output" =~ ^@[0-9]+$ ]]; then
echo "NextElapseUSecRealtime: expected @<number> with --timestamp=unix, got: $output" >&2
exit 1
fi
systemctl stop "$TIMER1"
rm -f "/run/systemd/system/$TIMER1" "/run/systemd/system/$SERVICE1"
TIMER2="timestamp-test2-$RANDOM.timer"
SERVICE2="${TIMER2%.timer}.service"
cat >"/run/systemd/system/$SERVICE2" <<EOF
[Service]
Type=oneshot
ExecStart=true
EOF
cat >"/run/systemd/system/$TIMER2" <<EOF
[Timer]
OnActiveSec=100ms
EOF
systemctl daemon-reload
systemctl start "$TIMER2"
sleep 0.5
output=$(systemctl show -P LastTriggerUSec --timestamp=unix "$TIMER2")
if [[ ! "$output" =~ ^@[0-9]+$ ]]; then
echo "LastTriggerUSec: expected @<number> with --timestamp=unix, got: $output" >&2
exit 1
fi
systemctl stop "$TIMER2"
rm -f "/run/systemd/system/$TIMER2" "/run/systemd/system/$SERVICE2"
systemctl daemon-reload
# set-default/get-default
test_get_set_default() {
target="$(systemctl get-default "$@")"