mpris-proxy: Line-buffer stdout
PATCH 1/1 mpris-proxy: Line-buffer stdout
mpris-proxy reports adapter and player changes with printf() but never flushes stdout. When it runs as a service (tools/mpris-proxy.service) stdout is a pipe to the journal, so glibc fully buffers it and nothing is written until 4 KiB have accumulated or the process exits.
On a system whose Bluetooth adapter went away and came back every two minutes, the "Bluetooth Adapter /org/bluez/hci0 removed" and "... found" messages reached the journal in bursts of exactly 100 lines (about 4096 bytes), all carrying the timestamp of the flush rather than of the event, i.e. up to about 80 minutes late.
Set stdout to line buffered at startup, as bt_shell_init() already does, so every message reaches the journal with an accurate timestamp.
--- tools/mpris-proxy.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/mpris-proxy.c +4 -0
@@ -2954,6 +2954,10 @@ int main(int argc, char *argv[])guint owner_watch, properties_watch, signal_watch;struct sigaction sa; +/* stdout is a pipe to the journal when running as a service, so make +* it line buffered to get the messages out as they happen. */ +setlinebuf (stdout); + context =g_option_context_new (NULL );g_option_context_add_main_entries (context, options,NULL );
Signature · 1 line
2.55.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1175670/
---Test result---
Test Summary:
CheckPatch FAIL 0.31 seconds GitLint PASS 0.22 seconds BuildEll PASS 19.24 seconds BluezMake PASS 372.59 seconds CheckSmatch PASS 290.15 seconds bluezmakeextell PASS 92.76 seconds TestFunctional PASS 1105.85 seconds IncrementalBuild PASS 383.28 seconds ScanBuild PASS 1119.69 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ] mpris-proxy: Line-buffer stdout WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #108: FILE: tools/mpris-proxy.c:2958:
+ * it line buffered to get the messages out as they happen. */
/home/runner/work/bluez/bluez/src/patch/14853746.patch total: 0 errors, 1 warnings, 10 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/home/runner/work/bluez/bluez/src/patch/14853746.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
https://github.com/bluez/bluez/pull/2603
---
Regards,
Linux Bluetooth
PATCH v2 1/1 mpris-proxy: Line-buffer stdout
In reply to Seonggon Chompris-proxy reports adapter and player changes with printf() but never flushes stdout. When it runs as a service (tools/mpris-proxy.service) stdout is a pipe to the journal, so glibc fully buffers it and nothing is written until 4 KiB have accumulated or the process exits.
On a system whose Bluetooth adapter went away and came back every two minutes, the "Bluetooth Adapter /org/bluez/hci0 removed" and "... found" messages reached the journal in bursts of exactly 100 lines (about 4096 bytes), all carrying the timestamp of the flush rather than of the event, i.e. up to about 80 minutes late.
Set stdout to line buffered at startup, as bt_shell_init() already does, so every message reaches the journal with an accurate timestamp.
---
v2: use the block comment style from doc/coding-style.rst (M2), fixes
the checkpatch BLOCK_COMMENT_STYLE warning reported by the CI bot
tools/mpris-proxy.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/mpris-proxy.c +6 -0
@@ -2954,6 +2954,12 @@ int main(int argc, char *argv[])guint owner_watch, properties_watch, signal_watch;struct sigaction sa; +/* +* stdout is a pipe to the journal when running as a service, so make +* it line buffered to get the messages out as they happen. +*/ +setlinebuf (stdout); + context =g_option_context_new (NULL );g_option_context_add_main_entries (context, options,NULL );
Signature · 1 line
2.55.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1175715/
---Test result---
Test Summary:
CheckPatch PASS 0.38 seconds GitLint PASS 0.23 seconds BuildEll PASS 19.21 seconds BluezMake PASS 377.82 seconds CheckSmatch PASS 289.05 seconds bluezmakeextell PASS 92.60 seconds TestFunctional PASS 1109.11 seconds IncrementalBuild PASS 399.36 seconds ScanBuild PASS 1105.02 seconds
https://github.com/bluez/bluez/pull/2604
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 5 lines · On Tue, 29 Sep 2026 02:45:30 +0000 you wrote:
mpris-proxy reports adapter and player changes with
printf()but never flushes stdout. When it runs as a service (tools/mpris-proxy.service) stdout is a pipe to the journal, so glibc fully buffers it and nothing is written until 4 KiB have accumulated or the process exits.
Quoted 7 lines
On a system whose Bluetooth adapter went away and came back every two minutes, the "Bluetooth Adapter /org/bluez/hci0 removed" and "... found" messages reached the journal in bursts of exactly 100 lines (about 4096 bytes), all carrying the timestamp of the flush rather than of the event, i.e. up to about 80 minutes late.
[...]
Here is the summary with links:
- [BlueZ,v2] mpris-proxy: Line-buffer stdout
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a086d234e503
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html