Refactor in 57b0864a4577f880bb9f2bdef89868f7fcef96c5 drops all log messages
还没有人认领这个 Issue。
评估
调研方向
阅读 src/netlog/netlog-journal.c,重点关注 parse_journal_fields 及其调用方 journal_read_input。追踪 JOURNAL_FOREACH_DATA_RETVAL 如何报告迭代结束,以及调用方如何处理返回值。确认成功解析的消息会被保留,错误仍会继续传播。
由索引模型根据 Issue 内容生成。
描述
The refactor in 57b0864a4577f880bb9f2bdef89868f7fcef96c5 (currently unreleased) seems to have a bug that causes it to discard all messages.
parse_journal_fields returns r at the end. r is set by the JOURNAL_FOREACH_DATA_RETVAL macro, which calls sd_journal_enumerate_data. That function indicates iteration done by returning 0.
So on success, parse_journal_fields returns 0.
But its caller, journal_read_input checks for return code 0 and discards the message (returns itself).
I think something like this fixes it:
diff --git a/src/netlog/netlog-journal.c b/src/netlog/netlog-journal.c
index 41dd4d8..ba6a6fb 100644
--- a/src/netlog/netlog-journal.c
+++ b/src/netlog/netlog-journal.c
@@ -127,7 +127,7 @@ static int parse_journal_fields(Manager *m,
return 0;
}
- return r;
+ return r < 0 ? r : 1;
}
static int parse_syslog_severity(Manager *m, const char *priority, unsigned *sev) {
but beware my line numbers are different as I'm working on adding some features.
- 主要语言
- C
- 星标
- 99
- 派生
- 35
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
systemd/systemd-netlogd 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 77/100
systemd/systemd-netlogd#150 ·
-
bug
难度 4/5 3-5 天 新手友好度 48/100
systemd/systemd-netlogd#154 ·
查看 systemd/systemd-netlogd 的全部 Issue
相似的 Issue
-
compiler-rt:asan
难度 2/5 1-3 小时 新手友好度 70/100
llvm/llvm-project#242921 ·
维护者通常 1 天内回复
-
Missing gcc __builtin_stdc_bit_width/floor/ceil signature makes intellisense wrongly report error 70未关闭
难度 2/5 1-3 小时 新手友好度 66/100
microsoft/vscode-cpptools#14874 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
FujiNetWIFI/fujinet-firmware#2401 ·
维护者通常 1 天内回复
-
category:port-update
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
polish
难度 2/5 1-3 小时 新手友好度 82/100
ChupathingyCE/chupathingyce#1366 ·
维护者通常 1 天内回复