Skip to content

[LOGS]: nerdctl logs -f adds extraneous line feed #4201

Closed

Description

@apostasie

Description

logs -f adds a trailing 0a compared with docker.

Steps to reproduce the issue

docker rm -f foo >/dev/null
docker run --name foo debian printf 'bar\nfoo' >/dev/null
docker logs -f foo | hexdump

vs.

nerdctl rm -f foo >/dev/null
nerdctl run --name foo debian printf 'bar\nfoo' >/dev/null
nerdctl logs -f foo | hexdump

Describe the results you received and expected

0000000 6162 0a72 6f66 006f

vs

0000000 6162 0a72 6f66 0a6f

What version of nerdctl are you using?

main

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

Activity

  1. apostasie commented on May 6, 2025

    @apostasie
    ContributorAuthor

    Uncovered while looking into #4200

  2. changed the title [-][LOGS: nerdctl logs -f adds extraneous line feed[/-] [+][LOGS]: nerdctl logs -f adds extraneous line feed[/+] on May 6, 2025
  3. added
    bug
    and removed
    kind/unconfirmed-bug-claim
    on May 7, 2025
  4. self-assigned this
    on May 8, 2025
  5. haytok commented on May 8, 2025

    @haytok
    Member

    FYI:

    It appears that the logic handling newline characters (\n) in these areas are causing this issue.

    dataChan <- strings.TrimSuffix(s, "\n")

    e.Log = logEntry + "\n"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/loggingbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions