1
0
mirror of https://github.com/systemd/systemd synced 2025-10-03 18:54:45 +02:00

Compare commits

..

14 Commits

Author SHA1 Message Date
Yu Watanabe
33275ce383 Revert "hwdb: disable Asus ROG keyboards sending poweroff"
This reverts commit 6428c0f48028e09bf5b750fb3fd1f4a3dac7e24e.

The rule seems to match not only keyboard itself but other devices.
Let's revert the change, and consider better way later.

Fixes #38502.
2025-08-06 17:03:24 +01:00
Luca Boccassi
f391d6c9ba test: use Europe/Helsinki instead of Europe/Kyiv in test-calendarspec
Europe/Kyiv was added somewhat recently. Use Europe/Helsinki which is
much older and thus works with older tzdata like version 2022a.

line 193: "2016-03-27 03:17:00" new_tz=:Europe/Kyiv
At: Sun 2016-03-27 03:17:00.000000 Europe
Assertion 'r == -ENOENT' failed at src/test/test-calendarspec.c:70, function _test_next(). Aborting.

Follow-up for aa077884c13769ae3bd6aa98978b4ac9e64b5365
2025-08-06 16:08:54 +01:00
Luca Boccassi
0fa09581b7
Fix build with older python/glibc/bpf and add CI job to cover it (#38500) 2025-08-06 16:08:18 +01:00
Yu Watanabe
0dc0bf4caf profile: replace default bash prompt with more informative one
The default bash PS1 provides mostly no information.
Let's replace it.

Before:
```
[watanabe@thinkpad-x280:~] $ run0
🦸 bash-5.2# echo $PS1
🦸 \s-\v\$
```

After:
```
[watanabe@thinkpad-x280:~] $ run0
🦸 [root@thinkpad-x280 watanabe]# echo $PS1
🦸 [\u@\h \W]\$
```

Fixes #38494.
2025-08-06 14:24:19 +01:00
Luca Boccassi
ea2beb6591
user-runtime-dir: two fixlets for setting disk quota (#38496)
Fixes #38493.
2025-08-06 14:23:41 +01:00
Luca Boccassi
4f49a6f572 ci: add build job on Ubuntu Jammy with Python 3.7
In order to avoid regressions with glibc < 2.39 and Python 3.7
2025-08-06 14:09:33 +01:00
Luca Boccassi
0d333ed8e3 test: fix repeated runs of test-oomd-util by clearing test cgroup
If the test is ran multiple times in a row, without an ephemeral
scope (eg: non-booted nspawn), then subsequent runs will fail as
the test cgroup is not cleared so the previous xattrs are still
present. Trim the test cgroup before and after the test.

Follow-up for 61ff7397d08375ce0950fb7b546c08e4a657f273
2025-08-06 14:09:33 +01:00
Luca Boccassi
14cb1fba91 test: fix assert when running test-cgroup in container
When running in nspawn and thus from the namespaced root cgroup:

Paths for test:
//test-a
//test-b
src/test/test-cgroup.c:77: Assertion failed: Expected "path == test_b", got "/test-b != //test-b"

Use path_simplify() in the test like the code does, so that the results
always match
2025-08-06 14:09:33 +01:00
Luca Boccassi
64a4f3110a test-bpf-token: fix build with libbpf < 0.6
../s/src/test/test-bpf-token.c: In function ‘intro’:
../s/src/test/test-bpf-token.c:10:5: error: "__LIBBPF_CURRENT_VERSION_GEQ" is not defined, evaluates to 0 [-Werror=undef]
   10 | #if __LIBBPF_CURRENT_VERSION_GEQ(1, 5)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../s/src/test/test-bpf-token.c:10:33: error: missing binary operator before token "("
   10 | #if __LIBBPF_CURRENT_VERSION_GEQ(1, 5)

Follow-up for ea9826eb946d57aaba7e6bfa2d6b120136c6b20f
2025-08-06 14:09:33 +01:00
Luca Boccassi
7108a882b3 network: fix build with libbpf < 0.7
bpf_loop() and bpf_strncmp(), used by sysctl-monitor, were introduced
in libbpf 0.7, so skip the module if using an older version

Follow-up for 6d9ef22acdeac4b429efb75164341233955484af
2025-08-06 13:33:21 +01:00
Luca Boccassi
3ec74b96b7 seccomp: fix build with glibc < 2.39
../src/shared/seccomp-util.c: In function ‘seccomp_restrict_sxid’:
../src/shared/seccomp-util.c:2228:25: error: ‘__NR_fchmodat2’ undeclared (first use in this function); did you mean ‘fchmodat2’?
 2228 |                         __NR_fchmodat2,
      |                         ^~~~~~~~~~~~~~
      |                         fchmodat2

The override/sys/syscalls.h needs to be included before the seccomp
headers, otherwise the internal seccomp preprocessor machinery will
not see the local definitions, so the local ifdef will be true but
the seccomp own definitions will be empty
2025-08-06 12:41:03 +01:00
Luca Boccassi
2793d6acf0 meson: fix compatibility with Python 3.7
[8/2759] Generating src/basic/filesystem-sets.c with a custom command (wrapped by meson to capture output)
FAILED: src/basic/filesystem-sets.c
/mnt/work/.local/bin/meson --internal exe --capture src/basic/filesystem-sets.c -- /mnt/work/src/systemd/upstream-fork/main/src/basic/filesystem-sets.py fs-type-to-string filesystem-sets fs-in-group
--- stderr ---
Traceback (most recent call last):
  File "/mnt/work/src/systemd/upstream-fork/main/src/basic/filesystem-sets.py", line 372, in <module>
    generate_fs_in_group()
  File "/mnt/work/src/systemd/upstream-fork/main/src/basic/filesystem-sets.py", line 311, in generate_fs_in_group
    start=[])))
TypeError: sum() takes no keyword arguments
2025-08-06 12:40:27 +01:00
Yu Watanabe
6d30c40d6c user-runtime-dir: fix logged quota size
'v' is a number of blocks, rather than bytes.
2025-08-06 12:54:26 +09:00
Yu Watanabe
ef7698f7aa user-runtime-dir: skip setting quota if not requested
Fixes the following spurious warning:

systemd-user-runtime-dir[865]: Failed to set disk quota limit to '15.9P' on /tmp for UID 991, ignoring: Numerical result out of range

Fixes #38493.
2025-08-06 12:54:23 +09:00
18 changed files with 76 additions and 44 deletions

View File

@ -124,10 +124,15 @@ fi
# This is added by default, and it is often broken, but we don't need anything from it # This is added by default, and it is often broken, but we don't need anything from it
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.{list,sources} sudo rm -f /etc/apt/sources.list.d/microsoft-prod.{list,sources}
# add-apt-repository --enable-source does not work on deb822 style sources. if grep -q 'VERSION_CODENAME=jammy' /usr/lib/os-release; then
for f in /etc/apt/sources.list.d/*.sources; do sudo add-apt-repository -y --no-update ppa:upstream-systemd-ci/systemd-ci
sudo sed -i "s/Types: deb/Types: deb deb-src/g" "$f" sudo add-apt-repository -y --no-update --enable-source
done else
# add-apt-repository --enable-source does not work on deb822 style sources.
for f in /etc/apt/sources.list.d/*.sources; do
sudo sed -i "s/Types: deb/Types: deb deb-src/g" "$f"
done
fi
sudo apt-get -y update sudo apt-get -y update
sudo apt-get -y build-dep systemd sudo apt-get -y build-dep systemd
sudo apt-get -y install "${PACKAGES[@]}" sudo apt-get -y install "${PACKAGES[@]}"
@ -138,6 +143,11 @@ sudo apt-get -y install "${PACKAGES[@]}"
pip3 install --user -r .github/workflows/requirements.txt --require-hashes --break-system-packages pip3 install --user -r .github/workflows/requirements.txt --require-hashes --break-system-packages
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"
if [[ -n "$CUSTOM_PYTHON" ]]; then
# If CUSTOM_PYTHON is set we need to pull jinja2 from pip, as a local interpreter is used
pip3 install --user --break-system-packages jinja2
fi
$CC --version $CC --version
meson --version meson --version
ninja --version ninja --version

View File

@ -19,12 +19,13 @@ jobs:
build: build:
runs-on: ${{ matrix.runner }} runs-on: ${{ matrix.runner }}
concurrency: concurrency:
group: ${{ github.workflow }}-${{ toJSON(matrix.env) }}-${{ github.ref }}-${{ matrix.runner }} group: ${{ github.workflow }}-${{ toJSON(matrix.env) }}-${{ github.ref }}-${{ matrix.runner }}-${{ matrix.python-version }}
cancel-in-progress: true cancel-in-progress: true
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
runner: [ ubuntu-24.04 ] runner: [ ubuntu-24.04 ]
python-version: [ '' ]
env: env:
- { COMPILER: "gcc", COMPILER_VERSION: "11", LINKER: "bfd" } - { COMPILER: "gcc", COMPILER_VERSION: "11", LINKER: "bfd" }
- { COMPILER: "gcc", COMPILER_VERSION: "13", LINKER: "mold" } - { COMPILER: "gcc", COMPILER_VERSION: "13", LINKER: "mold" }
@ -34,13 +35,26 @@ jobs:
include: include:
- env: { COMPILER: "gcc", COMPILER_VERSION: "11", LINKER: "bfd" } - env: { COMPILER: "gcc", COMPILER_VERSION: "11", LINKER: "bfd" }
runner: [ ubuntu-24.04-ppc64le ] runner: [ ubuntu-24.04-ppc64le ]
python-version: ''
- env: { COMPILER: "gcc", COMPILER_VERSION: "13", LINKER: "mold" } - env: { COMPILER: "gcc", COMPILER_VERSION: "13", LINKER: "mold" }
runner: [ ubuntu-24.04-arm ] runner: [ ubuntu-24.04-arm ]
python-version: ''
- env: { COMPILER: "clang", COMPILER_VERSION: "18", LINKER: "lld" } - env: { COMPILER: "clang", COMPILER_VERSION: "18", LINKER: "lld" }
runner: [ ubuntu-24.04-s390x ] runner: [ ubuntu-24.04-s390x ]
python-version: ''
# Do one run with the oldest supported python version to ensure there are no regressions
# It is only available on Jammy, which is useful as it will also provide a build check for
# older glibc
- env: { COMPILER: "gcc", COMPILER_VERSION: "12", LINKER: "bfd", CUSTOM_PYTHON: "1" }
runner: [ ubuntu-22.04 ]
python-version: '3.7'
env: ${{ matrix.env }} env: ${{ matrix.env }}
steps: steps:
- name: Repository checkout - name: Repository checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: ${{ matrix.python-version }}
- name: Build check - name: Build check
run: .github/workflows/build-test.sh run: .github/workflows/build-test.sh

View File

@ -285,21 +285,6 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnASUS:pn*:*
KEYBOARD_KEY_ee=volumedown KEYBOARD_KEY_ee=volumedown
KEYBOARD_KEY_ef=mute KEYBOARD_KEY_ef=mute
# Asus ROG series
# Prevents the keyboard from sending POWER and SLEEP key presses
# when the keyboard goes to sleep.
evdev:input:b*v0B05p*e0111*
KEYBOARD_KEY_10081=reserved
KEYBOARD_KEY_10082=reserved
KEYBOARD_KEY_70070=reserved
KEYBOARD_KEY_70071=reserved
KEYBOARD_KEY_70072=reserved
KEYBOARD_KEY_70073=reserved
KEYBOARD_KEY_70074=reserved
KEYBOARD_KEY_70075=reserved
KEYBOARD_KEY_70076=reserved
KEYBOARD_KEY_70077=reserved
# Asus TF103C misses the home button in its PNP0C40 GPIO resources # Asus TF103C misses the home button in its PNP0C40 GPIO resources
# causing the volume-button mappings to be off by one, correct this # causing the volume-button mappings to be off by one, correct this
evdev:name:gpio-keys:phys:gpio-keys/input0:ev:3:dmi:*:svnASUSTeKCOMPUTERINC.:pnTF103C*:* evdev:name:gpio-keys:phys:gpio-keys/input0:ev:3:dmi:*:svnASUSTeKCOMPUTERINC.:pnTF103C*:*

View File

@ -1958,6 +1958,8 @@ endif
conf.set10('HAVE_VMLINUX_H', use_provided_vmlinux_h or use_generated_vmlinux_h) conf.set10('HAVE_VMLINUX_H', use_provided_vmlinux_h or use_generated_vmlinux_h)
conf.set10('ENABLE_SYSCTL_BPF', conf.get('HAVE_VMLINUX_H') == 1 and libbpf.version().version_compare('>= 0.7'))
##################################################################### #####################################################################
check_version_history_py = files('tools/check-version-history.py') check_version_history_py = files('tools/check-version-history.py')

View File

@ -13,10 +13,16 @@
# are propagated into these environment variables by pam_systemd(8). # are propagated into these environment variables by pam_systemd(8).
if [ -n "${SHELL_PROMPT_PREFIX-}" ]; then if [ -n "${SHELL_PROMPT_PREFIX-}" ]; then
if [ -n "${BASH_VERSION-}" ] && [ "$PS1" = "\\s-\\v\\\$ " ]; then
PS1="[\u@\h \W]\\$ "
fi
PS1="$SHELL_PROMPT_PREFIX$PS1" PS1="$SHELL_PROMPT_PREFIX$PS1"
fi fi
if [ -n "${SHELL_PROMPT_SUFFIX-}" ]; then if [ -n "${SHELL_PROMPT_SUFFIX-}" ]; then
if [ -n "${BASH_VERSION-}" ] && [ "$PS1" = "\\s-\\v\\\$ " ]; then
PS1="[\u@\h \W]\\$ "
fi
PS1="$PS1$SHELL_PROMPT_SUFFIX" PS1="$PS1$SHELL_PROMPT_SUFFIX"
fi fi

View File

@ -307,8 +307,7 @@ def generate_fs_in_group():
print(' switch (fs_group) {') print(' switch (fs_group) {')
for name, _, *filesystems in FILESYSTEM_SETS: for name, _, *filesystems in FILESYSTEM_SETS:
magics = sorted(set(sum((NAME_TO_MAGIC[fs] for fs in filesystems), magics = sorted(set(sum((NAME_TO_MAGIC[fs] for fs in filesystems), [])))
start=[])))
enum = 'FILESYSTEM_SET_' + name[1:].upper().replace('-', '_') enum = 'FILESYSTEM_SET_' + name[1:].upper().replace('-', '_')
print(f' case {enum}:') print(f' case {enum}:')
opts = '\n || '.join(f'F_TYPE_EQUAL(st->f_type, {magic})' opts = '\n || '.join(f'F_TYPE_EQUAL(st->f_type, {magic})'
@ -355,7 +354,7 @@ def magic_defines():
def check(): def check():
kernel_magics = set(magic_defines()) kernel_magics = set(magic_defines())
our_magics = set(sum(NAME_TO_MAGIC.values(), start=[])) our_magics = set(sum(NAME_TO_MAGIC.values(), []))
extra = kernel_magics - our_magics extra = kernel_magics - our_magics
if extra: if extra:
sys.exit(f"kernel knows additional filesystem magics: {', '.join(sorted(extra))}") sys.exit(f"kernel knows additional filesystem magics: {', '.join(sorted(extra))}")

View File

@ -210,6 +210,11 @@ static int apply_tmpfs_quota(
assert(uid_is_valid(uid)); assert(uid_is_valid(uid));
STRV_FOREACH(p, paths) { STRV_FOREACH(p, paths) {
if (limit == UINT64_MAX && scale == UINT32_MAX) {
log_debug("No disk quota on '%s' is requested.", *p);
continue;
}
_cleanup_close_ int fd = open(*p, O_DIRECTORY|O_CLOEXEC); _cleanup_close_ int fd = open(*p, O_DIRECTORY|O_CLOEXEC);
if (fd < 0) { if (fd < 0) {
log_warning_errno(errno, "Failed to open '%s' in order to set quota, ignoring: %m", *p); log_warning_errno(errno, "Failed to open '%s' in order to set quota, ignoring: %m", *p);
@ -284,7 +289,8 @@ static int apply_tmpfs_quota(
log_debug_errno(r, "Lacking privileges to set UID quota on %s, skipping: %m", *p); log_debug_errno(r, "Lacking privileges to set UID quota on %s, skipping: %m", *p);
continue; continue;
} else if (r < 0) { } else if (r < 0) {
log_warning_errno(r, "Failed to set disk quota limit to '%s' on %s for UID " UID_FMT ", ignoring: %m", FORMAT_BYTES(v), *p, uid); log_warning_errno(r, "Failed to set disk quota limit to %s on %s for UID " UID_FMT ", ignoring: %m",
FORMAT_BYTES(v * QIF_DQBLKSIZE), *p, uid);
continue; continue;
} }

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('HAVE_VMLINUX_H') != 1 if conf.get('ENABLE_SYSCTL_BPF') != 1
subdir_done() subdir_done()
endif endif

View File

@ -140,7 +140,7 @@ networkctl_sources = files(
networkd_network_gperf_gperf = files('networkd-network-gperf.gperf') networkd_network_gperf_gperf = files('networkd-network-gperf.gperf')
networkd_netdev_gperf_gperf = files('netdev/netdev-gperf.gperf') networkd_netdev_gperf_gperf = files('netdev/netdev-gperf.gperf')
if conf.get('HAVE_VMLINUX_H') == 1 if conf.get('ENABLE_SYSCTL_BPF') == 1
systemd_networkd_extract_sources += sysctl_monitor_skel_h systemd_networkd_extract_sources += sysctl_monitor_skel_h
endif endif

View File

@ -646,7 +646,7 @@ int manager_new(Manager **ret, bool test_mode) {
.dhcp_server_persist_leases = DHCP_SERVER_PERSIST_LEASES_YES, .dhcp_server_persist_leases = DHCP_SERVER_PERSIST_LEASES_YES,
.serialization_fd = -EBADF, .serialization_fd = -EBADF,
.ip_forwarding = { -1, -1, }, .ip_forwarding = { -1, -1, },
#if HAVE_VMLINUX_H #if ENABLE_SYSCTL_BPF
.cgroup_fd = -EBADF, .cgroup_fd = -EBADF,
#endif #endif
}; };

View File

@ -117,7 +117,7 @@ typedef struct Manager {
/* sysctl */ /* sysctl */
int ip_forwarding[2]; int ip_forwarding[2];
#if HAVE_VMLINUX_H #if ENABLE_SYSCTL_BPF
Hashmap *sysctl_shadow; Hashmap *sysctl_shadow;
sd_event_source *sysctl_event_source; sd_event_source *sysctl_event_source;
struct ring_buffer *sysctl_buffer; struct ring_buffer *sysctl_buffer;
@ -148,7 +148,7 @@ int manager_set_timezone(Manager *m, const char *timezone);
int manager_reload(Manager *m, sd_bus_message *message); int manager_reload(Manager *m, sd_bus_message *message);
static inline Hashmap** manager_get_sysctl_shadow(Manager *manager) { static inline Hashmap** manager_get_sysctl_shadow(Manager *manager) {
#if HAVE_VMLINUX_H #if ENABLE_SYSCTL_BPF
return &ASSERT_PTR(manager)->sysctl_shadow; return &ASSERT_PTR(manager)->sysctl_shadow;
#else #else
return NULL; return NULL;

View File

@ -26,7 +26,7 @@
#include "string-util.h" #include "string-util.h"
#include "sysctl-util.h" #include "sysctl-util.h"
#if HAVE_VMLINUX_H #if ENABLE_SYSCTL_BPF
#include "bpf-link.h" #include "bpf-link.h"
#include "bpf/sysctl-monitor/sysctl-monitor-skel.h" #include "bpf/sysctl-monitor/sysctl-monitor-skel.h"

View File

@ -22,7 +22,7 @@ typedef enum IPReversePathFilter {
_IP_REVERSE_PATH_FILTER_INVALID = -EINVAL, _IP_REVERSE_PATH_FILTER_INVALID = -EINVAL,
} IPReversePathFilter; } IPReversePathFilter;
#if HAVE_VMLINUX_H #if ENABLE_SYSCTL_BPF
int manager_install_sysctl_monitor(Manager *manager); int manager_install_sysctl_monitor(Manager *manager);
void manager_remove_sysctl_monitor(Manager *manager); void manager_remove_sysctl_monitor(Manager *manager);
int link_clear_sysctl_shadows(Link *link); int link_clear_sysctl_shadows(Link *link);

View File

@ -68,6 +68,8 @@ TEST(oomd_cgroup_kill) {
/* Create another cgroup below this one for the pids we forked off. We need this to be managed /* Create another cgroup below this one for the pids we forked off. We need this to be managed
* by the test so that pid1 doesn't delete it before we can read the xattrs. */ * by the test so that pid1 doesn't delete it before we can read the xattrs. */
ASSERT_NOT_NULL(subcgroup = path_join(cgroup, "oomdkilltest")); ASSERT_NOT_NULL(subcgroup = path_join(cgroup, "oomdkilltest"));
/* Always start clean, in case of repeated runs and failures */
ASSERT_OK(cg_trim(subcgroup, /* delete_root */ true));
ASSERT_OK(cg_create(subcgroup)); ASSERT_OK(cg_create(subcgroup));
/* If we don't have permissions to set xattrs we're likely in a userns or missing capabilities */ /* If we don't have permissions to set xattrs we're likely in a userns or missing capabilities */
@ -106,6 +108,8 @@ TEST(oomd_cgroup_kill) {
ASSERT_OK(cg_get_xattr(subcgroup, "user.oomd_kill", &v, /* ret_size= */ NULL)); ASSERT_OK(cg_get_xattr(subcgroup, "user.oomd_kill", &v, /* ret_size= */ NULL));
ASSERT_STREQ(v, i == 0 ? "2" : "4"); ASSERT_STREQ(v, i == 0 ? "2" : "4");
} }
ASSERT_OK(cg_trim(subcgroup, /* delete_root */ true));
} }
TEST(oomd_cgroup_context_acquire_and_insert) { TEST(oomd_cgroup_context_acquire_and_insert) {

View File

@ -1,5 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
/* This needs to be included before the seccomp headers, otherwise missing syscalls will be defined in this
* file and pass the ifdef, but they won't be defined in the seccomp headers so things like
* SCMP_SYS(fchmodat2) will resolve as empty and fail the build with older glibc/libseccomp. */
#include <sys/syscall.h>
#include <fcntl.h> #include <fcntl.h>
#include <linux/seccomp.h> #include <linux/seccomp.h>
#include <sched.h> #include <sched.h>

View File

@ -7,7 +7,7 @@
#include "tests.h" #include "tests.h"
static int intro(void) { static int intro(void) {
#if __LIBBPF_CURRENT_VERSION_GEQ(1, 5) #if defined(LIBBPF_MAJOR_VERSION) && (LIBBPF_MAJOR_VERSION > 1 || (LIBBPF_MAJOR_VERSION == 1 && LIBBPF_MINOR_VERSION >= 5))
_cleanup_close_ int bpffs_fd = open("/sys/fs/bpf", O_RDONLY); _cleanup_close_ int bpffs_fd = open("/sys/fs/bpf", O_RDONLY);
if (bpffs_fd < 0) if (bpffs_fd < 0)
return log_error_errno(errno, "Failed to open '/sys/fs/bpf': %m"); return log_error_errno(errno, "Failed to open '/sys/fs/bpf': %m");

View File

@ -190,16 +190,16 @@ TEST(calendar_spec_one) {
TEST(calendar_spec_next) { TEST(calendar_spec_next) {
test_next("2016-03-27 03:17:00", "", 12345, 1459048620000000); test_next("2016-03-27 03:17:00", "", 12345, 1459048620000000);
test_next("2016-03-27 03:17:00", "Europe/Berlin", 12345, 1459041420000000); test_next("2016-03-27 03:17:00", "Europe/Berlin", 12345, 1459041420000000);
test_next("2016-03-27 03:17:00", "Europe/Kyiv", 12345, -1); test_next("2016-03-27 03:17:00", "Europe/Helsinki", 12345, -1);
test_next("2016-03-27 03:17:00 UTC", NULL, 12345, 1459048620000000); test_next("2016-03-27 03:17:00 UTC", NULL, 12345, 1459048620000000);
test_next("2016-03-27 03:17:00 UTC", "", 12345, 1459048620000000); test_next("2016-03-27 03:17:00 UTC", "", 12345, 1459048620000000);
test_next("2016-03-27 03:17:00 UTC", "Europe/Berlin", 12345, 1459048620000000); test_next("2016-03-27 03:17:00 UTC", "Europe/Berlin", 12345, 1459048620000000);
test_next("2016-03-27 03:17:00 UTC", "Europe/Kyiv", 12345, 1459048620000000); test_next("2016-03-27 03:17:00 UTC", "Europe/Helsinki", 12345, 1459048620000000);
test_next("2016-03-27 03:17:00.420000001 UTC", "Europe/Kyiv", 12345, 1459048620420000); test_next("2016-03-27 03:17:00.420000001 UTC", "Europe/Helsinki", 12345, 1459048620420000);
test_next("2016-03-27 03:17:00.4200005 UTC", "Europe/Kyiv", 12345, 1459048620420001); test_next("2016-03-27 03:17:00.4200005 UTC", "Europe/Helsinki", 12345, 1459048620420001);
test_next("2015-11-13 09:11:23.42", "Europe/Kyiv", 12345, 1447398683420000); test_next("2015-11-13 09:11:23.42", "Europe/Helsinki", 12345, 1447398683420000);
test_next("2015-11-13 09:11:23.42/1.77", "Europe/Kyiv", 1447398683420000, 1447398685190000); test_next("2015-11-13 09:11:23.42/1.77", "Europe/Helsinki", 1447398683420000, 1447398685190000);
test_next("2015-11-13 09:11:23.42/1.77", "Europe/Kyiv", 1447398683419999, 1447398683420000); test_next("2015-11-13 09:11:23.42/1.77", "Europe/Helsinki", 1447398683419999, 1447398683420000);
test_next("Sun 16:00:00", "Europe/Berlin", 1456041600123456, 1456066800000000); test_next("Sun 16:00:00", "Europe/Berlin", 1456041600123456, 1456066800000000);
test_next("*-04-31", "", 12345, -1); test_next("*-04-31", "", 12345, -1);
test_next("2016-02~01 UTC", "", 12345, 1456704000000000); test_next("2016-02~01 UTC", "", 12345, 1456704000000000);
@ -219,7 +219,7 @@ TEST(calendar_spec_next) {
test_next("2017-04-02 03:30:00 Pacific/Auckland", "", 12345, 1491060600000000); test_next("2017-04-02 03:30:00 Pacific/Auckland", "", 12345, 1491060600000000);
/* Confirm that timezones in the Spec work regardless of current timezone */ /* Confirm that timezones in the Spec work regardless of current timezone */
test_next("2017-09-09 20:42:00 Pacific/Auckland", "", 12345, 1504946520000000); test_next("2017-09-09 20:42:00 Pacific/Auckland", "", 12345, 1504946520000000);
test_next("2017-09-09 20:42:00 Pacific/Auckland", "Europe/Kyiv", 12345, 1504946520000000); test_next("2017-09-09 20:42:00 Pacific/Auckland", "Europe/Helsinki", 12345, 1504946520000000);
/* Check that we don't start looping if mktime() moves us backwards */ /* Check that we don't start looping if mktime() moves us backwards */
test_next("Sun *-*-* 01:00:00 Europe/Dublin", "", 1616412478000000, 1617494400000000); test_next("Sun *-*-* 01:00:00 Europe/Dublin", "", 1616412478000000, 1617494400000000);
test_next("Sun *-*-* 01:00:00 Europe/Dublin", "IST", 1616412478000000, 1617494400000000); test_next("Sun *-*-* 01:00:00 Europe/Dublin", "IST", 1616412478000000, 1617494400000000);

View File

@ -51,10 +51,12 @@ TEST(cg_create) {
_cleanup_free_ char *here = NULL; _cleanup_free_ char *here = NULL;
ASSERT_OK(cg_pid_get_path_shifted(0, NULL, &here)); ASSERT_OK(cg_pid_get_path_shifted(0, NULL, &here));
_cleanup_free_ char *test_a = ASSERT_NOT_NULL(path_join(here, "/test-a")), /* cg_* will use path_simplify(), so use it here too otherwise when running in a container at the
*test_b = ASSERT_NOT_NULL(path_join(here, "/test-b")), * root it asserts with "/test-b != //test-b" */
*test_c = ASSERT_NOT_NULL(path_join(here, "/test-b/test-c")), _cleanup_free_ char *test_a = ASSERT_NOT_NULL(path_simplify(path_join(here, "/test-a"))),
*test_d = ASSERT_NOT_NULL(path_join(here, "/test-b/test-d")); *test_b = ASSERT_NOT_NULL(path_simplify(path_join(here, "/test-b"))),
*test_c = ASSERT_NOT_NULL(path_simplify(path_join(here, "/test-b/test-c"))),
*test_d = ASSERT_NOT_NULL(path_simplify(path_join(here, "/test-b/test-d")));
char *path; char *path;
log_info("Paths for test:\n%s\n%s", test_a, test_b); log_info("Paths for test:\n%s\n%s", test_a, test_b);