Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

events: formatting: fix newline at end of buffer handling #444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

atenart
Copy link
Contributor

@atenart atenart commented Nov 8, 2024

When a newline is found at the end of the buffer it was printed twice. This is because splitting such string will result in having an empty last split. The logic was then printing a new line for the split and because one was at the end of the buffer.

This also prevents from printing the prefix and fixes cases where a double newline is found in the middle of the buffer.

When a newline is found at the end of the buffer it was printed twice.
This is because splitting such string will result in having an empty
last split. The logic was then printing a new line for the split and
because one was at the end of the buffer.

This also prevents from printing the prefix and fixes cases where a
double newline is found in the middle of the buffer.

Fixes: d5350df ("events: add our own formatter")
Reported-by: Adrian Moreno <[email protected]>
Signed-off-by: Antoine Tenart <[email protected]>
@atenart atenart added this to the v1.5 milestone Nov 8, 2024
Copy link
Contributor

@vlrpl vlrpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.
@amorenoz, I'll leave the last word on this to you as you may have a better chance of finding any potential problem with your repro :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants