summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2025-04-23 09:20:30 +0800
committerSteve Sakoman <steve@sakoman.com>2025-05-02 08:12:41 -0700
commit9ace4f7ae54435e8e48b8fb1c06b09a380cc7f7b (patch)
treecb10fa36f49bd27eb4277002eb34d62f95e42b7e
parenta4ed07274e5164a005334684862592360fe5fec8 (diff)
downloadpoky-9ace4f7ae54435e8e48b8fb1c06b09a380cc7f7b.tar.gz
systemd: backport patch to fix journal issue
Backport a patch to fix systemd journal issue about sd_journal_next not behaving correctly after sd_journal_seek_tail. (From OE-Core rev: ea59aed1ff7dbfb28d1e2cd55adca80dad2502e2) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-core/systemd/systemd/0001-journal-Make-sd_journal_previous-next-return-0-at-HE.patch87
-rw-r--r--meta/recipes-core/systemd/systemd_250.14.bb1
2 files changed, 88 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-journal-Make-sd_journal_previous-next-return-0-at-HE.patch b/meta/recipes-core/systemd/systemd/0001-journal-Make-sd_journal_previous-next-return-0-at-HE.patch
new file mode 100644
index 0000000000..17e83448e3
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-journal-Make-sd_journal_previous-next-return-0-at-HE.patch
@@ -0,0 +1,87 @@
1From e8d0681eb49697d91f277e2f9f4cff32a30b316c Mon Sep 17 00:00:00 2001
2From: Daan De Meyer <daan.j.demeyer@gmail.com>
3Date: Tue, 5 Jul 2022 15:22:01 +0200
4Subject: [PATCH] journal: Make sd_journal_previous/next() return 0 at
5 HEAD/TAIL
6
7Currently, both these functions don't return 0 if we're at HEAD/TAIL
8and move in the corresponding direction. Let's fix that.
9
10Replaces #23480
11
12Upstream-Status: Backport [https://github.com/systemd/systemd/commit/977ad21b5b8f6323515297bd8995dcaaca0905df]
13
14[Rebased for v250]
15Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
16---
17 src/journal/test-journal-interleaving.c | 4 ++++
18 src/libsystemd/sd-journal/sd-journal.c | 8 ++++----
19 2 files changed, 8 insertions(+), 4 deletions(-)
20
21diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c
22index c543b87b69..f0ed1b4c74 100644
23--- a/src/journal/test-journal-interleaving.c
24+++ b/src/journal/test-journal-interleaving.c
25@@ -158,6 +158,7 @@ static void test_skip(void (*setup)(void)) {
26 */
27 assert_ret(sd_journal_open_directory(&j, t, 0));
28 assert_ret(sd_journal_seek_head(j));
29+ assert_ret(sd_journal_previous(j) == 0);
30 assert_ret(sd_journal_next(j));
31 test_check_numbers_down(j, 4);
32 sd_journal_close(j);
33@@ -166,6 +167,7 @@ static void test_skip(void (*setup)(void)) {
34 */
35 assert_ret(sd_journal_open_directory(&j, t, 0));
36 assert_ret(sd_journal_seek_tail(j));
37+ assert_ret(sd_journal_next(j) == 0);
38 assert_ret(sd_journal_previous(j));
39 test_check_numbers_up(j, 4);
40 sd_journal_close(j);
41@@ -174,6 +176,7 @@ static void test_skip(void (*setup)(void)) {
42 */
43 assert_ret(sd_journal_open_directory(&j, t, 0));
44 assert_ret(sd_journal_seek_tail(j));
45+ assert_ret(sd_journal_next(j) == 0);
46 assert_ret(r = sd_journal_previous_skip(j, 4));
47 assert_se(r == 4);
48 test_check_numbers_down(j, 4);
49@@ -183,6 +186,7 @@ static void test_skip(void (*setup)(void)) {
50 */
51 assert_ret(sd_journal_open_directory(&j, t, 0));
52 assert_ret(sd_journal_seek_head(j));
53+ assert_ret(sd_journal_previous(j) == 0);
54 assert_ret(r = sd_journal_next_skip(j, 4));
55 assert_se(r == 4);
56 test_check_numbers_up(j, 4);
57diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
58index 7a6cc4aca3..04cafdf1c8 100644
59--- a/src/libsystemd/sd-journal/sd-journal.c
60+++ b/src/libsystemd/sd-journal/sd-journal.c
61@@ -611,9 +611,9 @@ static int find_location_for_match(
62 /* FIXME: missing: find by monotonic */
63
64 if (j->current_location.type == LOCATION_HEAD)
65- return journal_file_next_entry_for_data(f, dp, DIRECTION_DOWN, ret, offset);
66+ return direction == DIRECTION_DOWN ? journal_file_next_entry_for_data(f, dp, DIRECTION_DOWN, ret, offset) : 0;
67 if (j->current_location.type == LOCATION_TAIL)
68- return journal_file_next_entry_for_data(f, dp, DIRECTION_UP, ret, offset);
69+ return direction == DIRECTION_UP ? journal_file_next_entry_for_data(f, dp, DIRECTION_UP, ret, offset) : 0;
70 if (j->current_location.seqnum_set && sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id))
71 return journal_file_move_to_entry_by_seqnum_for_data(f, dp, j->current_location.seqnum, direction, ret, offset);
72 if (j->current_location.monotonic_set) {
73@@ -704,9 +704,9 @@ static int find_location_with_matches(
74 /* No matches is simple */
75
76 if (j->current_location.type == LOCATION_HEAD)
77- return journal_file_next_entry(f, 0, DIRECTION_DOWN, ret, offset);
78+ return direction == DIRECTION_DOWN ? journal_file_next_entry(f, 0, DIRECTION_DOWN, ret, offset) : 0;
79 if (j->current_location.type == LOCATION_TAIL)
80- return journal_file_next_entry(f, 0, DIRECTION_UP, ret, offset);
81+ return direction == DIRECTION_UP ? journal_file_next_entry(f, 0, DIRECTION_UP, ret, offset) : 0;
82 if (j->current_location.seqnum_set && sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id))
83 return journal_file_move_to_entry_by_seqnum(f, j->current_location.seqnum, direction, ret, offset);
84 if (j->current_location.monotonic_set) {
85--
862.17.1
87
diff --git a/meta/recipes-core/systemd/systemd_250.14.bb b/meta/recipes-core/systemd/systemd_250.14.bb
index ef0476fad9..b79284d79c 100644
--- a/meta/recipes-core/systemd/systemd_250.14.bb
+++ b/meta/recipes-core/systemd/systemd_250.14.bb
@@ -29,6 +29,7 @@ SRC_URI += "file://touchscreen.rules \
29 file://0001-nspawn-make-sure-host-root-can-write-to-the-uidmappe.patch \ 29 file://0001-nspawn-make-sure-host-root-can-write-to-the-uidmappe.patch \
30 file://fix-vlan-qos-mapping.patch \ 30 file://fix-vlan-qos-mapping.patch \
31 file://0001-core-fix-build-when-seccomp-is-off.patch \ 31 file://0001-core-fix-build-when-seccomp-is-off.patch \
32 file://0001-journal-Make-sd_journal_previous-next-return-0-at-HE.patch \
32 " 33 "
33 34
34# patches needed by musl 35# patches needed by musl