laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34975?usp=email )
Change subject: logging: ensure ANSI color escape is sent in same line/before newline
......................................................................
logging: ensure ANSI color escape is sent in same line/before newline
This fixes multi-line color clobbering in logging daemons like
systemd-journald, which work with single-lines only.
Change-Id: Ia7de9d88aa5ac48ec0d5c1a931a89d21c02c5433
Closes: OS#6249
---
M src/core/logging.c
M tests/loggingrb/logging_test.err
2 files changed, 24 insertions(+), 4 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/core/logging.c b/src/core/logging.c
index c6774f5..dc19cf3 100644
--- a/src/core/logging.c
+++ b/src/core/logging.c
@@ -616,7 +616,15 @@
}
if (target->use_color && c_subsys) {
- ret = snprintf(buf + offset, rem, OSMO_LOGCOLOR_END);
+ /* Ensure the last color escape is sent before the newline
+ * (to not clobber journald, which works on single-lines only) */
+ if (offset > 0 && buf[offset - 1] == '\n') {
+ offset--; rem++;
+ ret = snprintf(buf + offset, rem, OSMO_LOGCOLOR_END "\n");
+ } else {
+ ret = snprintf(buf + offset, rem, OSMO_LOGCOLOR_END);
+ }
+
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);
diff --git a/tests/loggingrb/logging_test.err b/tests/loggingrb/logging_test.err
index b59d2e8..e070561 100644
--- a/tests/loggingrb/logging_test.err
+++ b/tests/loggingrb/logging_test.err
@@ -1,3 +1,2 @@
-[1;31mYou should see this
-[0;m[1;32mYou should see this
-[0;m
\ No newline at end of file
+[1;31mYou should see this[0;m
+[1;32mYou should see this[0;m
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34975?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia7de9d88aa5ac48ec0d5c1a931a89d21c02c5433
Gerrit-Change-Number: 34975
Gerrit-PatchSet: 5
Gerrit-Owner: manawyrm <osmocom.account(a)tbspace.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: fixeria, laforge, manawyrm, neels, osmith.
laforge has uploaded a new patch set (#5) to the change originally created by manawyrm. ( https://gerrit.osmocom.org/c/libosmocore/+/34975?usp=email )
The following approvals got outdated and were removed:
Code-Review+1 by fixeria, Code-Review+1 by osmith, Code-Review+2 by laforge
The change is no longer submittable: Code-Review is unsatisfied now.
Change subject: logging: ensure ANSI color escape is sent in same line/before newline
......................................................................
logging: ensure ANSI color escape is sent in same line/before newline
This fixes multi-line color clobbering in logging daemons like
systemd-journald, which work with single-lines only.
Change-Id: Ia7de9d88aa5ac48ec0d5c1a931a89d21c02c5433
Closes: OS#6249
---
M src/core/logging.c
M tests/loggingrb/logging_test.err
2 files changed, 24 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/34975/5
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34975?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia7de9d88aa5ac48ec0d5c1a931a89d21c02c5433
Gerrit-Change-Number: 34975
Gerrit-PatchSet: 5
Gerrit-Owner: manawyrm <osmocom.account(a)tbspace.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: manawyrm <osmocom.account(a)tbspace.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: Hoernchen, fixeria.
Hello Jenkins Builder, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-trx/+/34972?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+1 by fixeria
Change subject: devices: fix wrong gain to power mapping
......................................................................
devices: fix wrong gain to power mapping
The dev type was set too early, but the actual dev is only being
discovered during open, so update it. This broke the gain to power mapping by defaulting to a wrong device.
Change-Id: I1dda6023ca6f15bc063c3dfbc704db2410ff7c98
---
M Transceiver52M/device/bladerf/bladerf.cpp
M Transceiver52M/device/common/bandmanager.h
M Transceiver52M/device/lms/LMSDevice.cpp
M Transceiver52M/device/uhd/UHDDevice.cpp
4 files changed, 21 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/72/34972/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/34972?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I1dda6023ca6f15bc063c3dfbc704db2410ff7c98
Gerrit-Change-Number: 34972
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newpatchset