Skip to content

Commit 67718f2

Browse files
authored
Merge pull request #629 from jnovy/ffix
Fix k8s-file log format for terminating F-sequence
2 parents 79c334c + 93d4e63 commit 67718f2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/ctr_logging.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,14 @@ static int write_k8s_log(stdpipe_t pipe, const char *buf, ssize_t buflen)
510510

511511
if (writev_buffer_append_segment(k8s_log_fd, &bufv, tsbuf, TSBUFLEN - 1) >= 0) {
512512
timestamp_written = true;
513-
if (writev_buffer_append_segment(k8s_log_fd, &bufv, "F\n", 2) >= 0) {
513+
if (writev_buffer_append_segment(k8s_log_fd, &bufv, "F \n", 3) >= 0) {
514514
f_sequence_written = true;
515515
}
516516
}
517517

518518
if (timestamp_written && f_sequence_written) {
519-
k8s_bytes_written += TSBUFLEN - 1 + 2;
520-
k8s_total_bytes_written += TSBUFLEN - 1 + 2;
519+
k8s_bytes_written += TSBUFLEN - 1 + 3;
520+
k8s_total_bytes_written += TSBUFLEN - 1 + 3;
521521
} else {
522522
if (!timestamp_written) {
523523
nwarn("failed to write timestamp for terminating F-sequence");

test/09-partial-log-test.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ teardown() {
8080
return 1
8181
}
8282

83-
echo "$log_content" | grep -q "stdout F$" || {
83+
echo "$log_content" | grep -q "stdout F $" || {
8484
echo "Expected F-sequence not found"
8585
return 1
8686
}
@@ -133,7 +133,7 @@ teardown() {
133133

134134
# For normal output with newlines, should NOT have standalone F-sequences
135135
# (F-sequences should only appear for partial line termination)
136-
! echo "$log_content" | grep -q "stdout F$" || {
136+
! echo "$log_content" | grep -q "stdout F $" || {
137137
echo "Unexpected standalone F-sequence found for normal output"
138138
return 1
139139
}

0 commit comments

Comments
 (0)